forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
On macOS we should never use @blas and @lapack, but in order for `bazel query` to succeed, all branches of select() statements need to resolve, so because Ubuntu has real @blas and @lapack, we need to stub these out on macOS. The stubs merely have to load -- the library targets do not need to (and should not) compile successfully.
- Loading branch information
1 parent
8121951
commit 016a94a
Showing
5 changed files
with
79 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- python -*- | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
# On macOS, no targets should depend on @blas. | ||
cc_library( | ||
name = "blas", | ||
srcs = ["missing-macos.cc"], | ||
) |
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,17 +1,36 @@ | ||
# -*- mode: python -*- | ||
|
||
load( | ||
"@drake//tools/workspace:os.bzl", | ||
"determine_os", | ||
) | ||
load( | ||
"@drake//tools/workspace:pkg_config.bzl", | ||
"pkg_config_repository", | ||
"setup_pkg_config_repository", | ||
) | ||
|
||
def blas_repository( | ||
name, | ||
licenses = ["notice"], # BSD-3-Clause | ||
modname = "blas", | ||
**kwargs): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
**kwargs) | ||
def _impl(repo_ctx): | ||
# On Ubuntu, we'll use use pkg-config to find libblas. | ||
# On macOS, no targets should depend on @blas. | ||
os_result = determine_os(repo_ctx) | ||
if os_result.error != None: | ||
fail(os_result.error) | ||
if os_result.is_ubuntu: | ||
error = setup_pkg_config_repository(repo_ctx).error | ||
if error != None: | ||
fail(error) | ||
else: | ||
repo_ctx.symlink( | ||
Label("@drake//tools/workspace/blas:package-macos.BUILD.bazel"), | ||
"BUILD.bazel") | ||
|
||
blas_repository = repository_rule( | ||
# TODO(jamiesnape): Pass down licenses to setup_pkg_config_repository. | ||
# The license for this package should be: | ||
# licenses(["notice"]) # BSD-3-Clause | ||
attrs = { | ||
"modname": attr.string(default = "blas"), | ||
}, | ||
local = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- python -*- | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
# On macOS, no targets should depend on @lapack. | ||
cc_library( | ||
name = "lapack", | ||
srcs = ["missing-macos.cc"], | ||
) |
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,17 +1,36 @@ | ||
# -*- mode: python -*- | ||
|
||
load( | ||
"@drake//tools/workspace:os.bzl", | ||
"determine_os", | ||
) | ||
load( | ||
"@drake//tools/workspace:pkg_config.bzl", | ||
"pkg_config_repository", | ||
"setup_pkg_config_repository", | ||
) | ||
|
||
def lapack_repository( | ||
name, | ||
licenses = ["notice"], # BSD-3-Clause | ||
modname = "lapack", | ||
**kwargs): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
**kwargs) | ||
def _impl(repo_ctx): | ||
# On Ubuntu, we'll use use pkg-config to find liblapack. | ||
# On macOS, no targets should depend on @lapack. | ||
os_result = determine_os(repo_ctx) | ||
if os_result.error != None: | ||
fail(os_result.error) | ||
if os_result.is_ubuntu: | ||
error = setup_pkg_config_repository(repo_ctx).error | ||
if error != None: | ||
fail(error) | ||
else: | ||
repo_ctx.symlink( | ||
Label("@drake//tools/workspace/lapack:package-macos.BUILD.bazel"), | ||
"BUILD.bazel") | ||
|
||
lapack_repository = repository_rule( | ||
# TODO(jamiesnape): Pass down licenses to setup_pkg_config_repository. | ||
# The license for this package should be: | ||
# licenses(["notice"]) # BSD-3-Clause | ||
attrs = { | ||
"modname": attr.string(default = "lapack"), | ||
}, | ||
local = True, | ||
implementation = _impl, | ||
) |