forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[workspace] Factor glx and x11 to share a common implementation (Robo…
…tLocomotion#20585) The logic for "Call pkg-config using deferred error handling on macOS" is common to these two modules, and can be moved up into pkg_config.bzl directly.
- Loading branch information
1 parent
26129cf
commit 584ea80
Showing
7 changed files
with
48 additions
and
105 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,13 @@ | ||
load("//tools/workspace:os.bzl", "determine_os") | ||
|
||
def _impl(repository_ctx): | ||
os_result = determine_os(repository_ctx) | ||
|
||
if os_result.error != None: | ||
fail(os_result.error) | ||
|
||
if os_result.is_macos: | ||
# On macOS, no targets should depend on @glx. | ||
build_flavor = "macos" | ||
elif os_result.is_ubuntu or os_result.is_manylinux: | ||
build_flavor = "ubuntu" | ||
hdrs = [ | ||
"GL/glx.h", | ||
"GL/glxext.h", | ||
] | ||
for hdr in hdrs: | ||
repository_ctx.symlink( | ||
"/usr/include/{}".format(hdr), | ||
"include/{}".format(hdr), | ||
) | ||
else: | ||
fail("Operating system is NOT supported {}".format(os_result)) | ||
|
||
repository_ctx.symlink( | ||
Label( | ||
"@drake//tools/workspace/glx:package-{}.BUILD.bazel".format( | ||
build_flavor, | ||
), | ||
), | ||
"BUILD.bazel", | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def glx_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = ["notice"], # SGI-B-2.0 | ||
modname = "glx", | ||
extra_deps = [ | ||
"@opengl", | ||
"@x11", | ||
], | ||
defer_error_os_names = ["mac os x"], | ||
) | ||
|
||
glx_repository = repository_rule( | ||
local = True, | ||
configure = True, | ||
implementation = _impl, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,9 @@ | ||
load("//tools/workspace:os.bzl", "determine_os") | ||
load("//tools/workspace:pkg_config.bzl", "setup_pkg_config_repository") | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def _impl(repo_ctx): | ||
# Only available on Ubuntu. On macOS, no targets should depend on @x11. | ||
os_result = determine_os(repo_ctx) | ||
if os_result.error != None: | ||
fail(os_result.error) | ||
if os_result.is_ubuntu or os_result.is_manylinux: | ||
error = setup_pkg_config_repository(repo_ctx).error | ||
if error != None: | ||
fail(error) | ||
else: | ||
repo_ctx.symlink( | ||
Label("@drake//tools/workspace/x11:package-macos.BUILD.bazel"), | ||
"BUILD.bazel", | ||
) | ||
|
||
x11_repository = repository_rule( | ||
attrs = { | ||
"modname": attr.string(default = "x11"), | ||
"licenses": attr.string_list(default = ["notice"]), # X11/MIT. | ||
}, | ||
local = True, | ||
configure = True, | ||
implementation = _impl, | ||
) | ||
def x11_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = ["notice"], # X11/MIT | ||
modname = "x11", | ||
defer_error_os_names = ["mac os x"], | ||
) |