Skip to content

Commit

Permalink
Factor pkg_config_repository calls into bzl helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri committed Jan 12, 2018
1 parent 36bd231 commit 4d95df4
Show file tree
Hide file tree
Showing 30 changed files with 305 additions and 66 deletions.
114 changes: 48 additions & 66 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ workspace(name = "drake")

load("//tools/workspace:bitbucket.bzl", "bitbucket_archive")
load("//tools/workspace:github.bzl", "github_archive")
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository")
load("//tools/workspace:which.bzl", "which")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

Expand All @@ -45,8 +44,8 @@ github_archive(
)

# This local repository imports the protobuf build rules for Bazel (based on
# the upstream protobuf.bzl build rules). The protobuf runtime is loaded
# into "libprotobuf" via pkg-config below.
# the upstream protobuf.bzl build rules); in constrast, the protobuf runtime is
# loaded as @libprotobuf.
local_repository(
name = "com_google_protobuf",
# TODO(clalancette) Per https://github.com/RobotLocomotion/drake/pull/7361
Expand All @@ -62,32 +61,27 @@ new_local_repository(
path = __workspace_dir__ + "/third_party/com_kitware_gitlab_cmake_cmake",
)

pkg_config_repository(
name = "ibex",
modname = "ibex",
)
load("//tools/workspace/ibex:package.bzl", "ibex_repository")

pkg_config_repository(
name = "dreal",
modname = "dreal",
)
ibex_repository(name = "ibex")

pkg_config_repository(
name = "glib",
modname = "glib-2.0",
)
load("//tools/workspace/dreal:package.bzl", "dreal_repository")

pkg_config_repository(
name = "gthread",
modname = "gthread-2.0",
)
dreal_repository(name = "dreal")

load("//tools/workspace/glib:package.bzl", "glib_repository")

glib_repository(name = "glib")

load("//tools/workspace/gthread:package.bzl", "gthread_repository")

gthread_repository(name = "gthread")

load("//tools/workspace/libprotobuf:package.bzl", "libprotobuf_repository")

# Load in the paths and flags to the system version of the protobuf runtime;
# the Bazel build rules are loaded into "protobuf" via local_repository above.
pkg_config_repository(
name = "libprotobuf",
modname = "protobuf",
)
# in contrast, the Bazel build rules are loaded as @com_google_protobuf.
libprotobuf_repository(name = "libprotobuf")

# Find the protoc binary on $PATH.
which(
Expand Down Expand Up @@ -237,15 +231,13 @@ github_archive(
build_file = "@drake//tools/workspace/fcl:package.BUILD.bazel",
)

pkg_config_repository(
name = "ipopt",
modname = "ipopt",
)
load("//tools/workspace/ipopt:package.bzl", "ipopt_repository")

pkg_config_repository(
name = "nlopt",
modname = "nlopt",
)
ipopt_repository(name = "ipopt")

load("//tools/workspace/nlopt:package.bzl", "nlopt_repository")

nlopt_repository(name = "nlopt")

github_archive(
name = "optitrack_driver",
Expand Down Expand Up @@ -278,15 +270,13 @@ github_archive(
build_file = "@drake//tools/workspace/lcmtypes_robotlocomotion:package.BUILD.bazel", # noqa
)

pkg_config_repository(
name = "blas",
modname = "blas",
)
load("//tools/workspace/blas:package.bzl", "blas_repository")

pkg_config_repository(
name = "lapack",
modname = "lapack",
)
blas_repository(name = "blas")

load("//tools/workspace/lapack:package.bzl", "lapack_repository")

lapack_repository(name = "lapack")

github_archive(
name = "scs",
Expand All @@ -304,12 +294,9 @@ github_archive(
build_file = "@drake//tools/workspace/tinyobjloader:package.BUILD.bazel",
)

pkg_config_repository(
name = "yaml_cpp",
modname = "yaml-cpp",
atleast_version = "0.5.2",
extra_deps = ["@boost//:boost_headers"],
)
load("//tools/workspace/yaml_cpp:package.bzl", "yaml_cpp_repository")

yaml_cpp_repository(name = "yaml_cpp")

load("//tools/workspace/buildifier:package.bzl", "buildifier_repository")

Expand Down Expand Up @@ -414,30 +401,25 @@ load("//tools/workspace/expat:package.bzl", "expat_repository")

expat_repository(name = "expat")

pkg_config_repository(
name = "glew",
modname = "glew",
)
load("//tools/workspace/glew:package.bzl", "glew_repository")

pkg_config_repository(
name = "liblz4",
modname = "liblz4",
)
glew_repository(name = "glew")

pkg_config_repository(
name = "libpng",
modname = "libpng",
)
load("//tools/workspace/liblz4:package.bzl", "liblz4_repository")

pkg_config_repository(
name = "tinyxml",
modname = "tinyxml",
)
liblz4_repository(name = "liblz4")

pkg_config_repository(
name = "tinyxml2",
modname = "tinyxml2",
)
load("//tools/workspace/libpng:package.bzl", "libpng_repository")

libpng_repository(name = "libpng")

load("//tools/workspace/tinyxml:package.bzl", "tinyxml_repository")

tinyxml_repository(name = "tinyxml")

load("//tools/workspace/tinyxml2:package.bzl", "tinyxml2_repository")

tinyxml2_repository(name = "tinyxml2")

load("//tools/workspace/zlib:package.bzl", "zlib_repository")

Expand Down
8 changes: 8 additions & 0 deletions tools/workspace/blas/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/blas/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def blas_repository(name, modname = "blas", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/dreal/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/dreal/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def dreal_repository(name, modname = "dreal", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/glew/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/glew/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def glew_repository(name, modname = "glew", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/glib/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/glib/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def glib_repository(name, modname = "glib-2.0", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/gthread/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/gthread/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def gthread_repository(name, modname = "gthread-2.0", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/ibex/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/ibex/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def ibex_repository(name, modname = "ibex", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/ipopt/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/ipopt/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def ipopt_repository(name, modname = "ipopt", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/lapack/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/lapack/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def lapack_repository(name, modname = "lapack", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/liblz4/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/liblz4/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def liblz4_repository(name, modname = "liblz4", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/libpng/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/libpng/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def libpng_repository(name, modname = "libpng", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/libprotobuf/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
9 changes: 9 additions & 0 deletions tools/workspace/libprotobuf/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- mode: python -*-

load(
"@drake//tools/workspace:pkg_config.bzl",
"pkg_config_repository",
)

def libprotobuf_repository(name, modname = "protobuf", **kwargs):
pkg_config_repository(name = name, modname = modname, **kwargs)
8 changes: 8 additions & 0 deletions tools/workspace/nlopt/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- python -*-

# This file exists to make our directory into a Bazel package, so that our
# neighboring *.bzl file can be loaded elsewhere.

load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
Loading

0 comments on commit 4d95df4

Please sign in to comment.