Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixup! Build ibex 2.8.6 from source #44

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/install/libdrake/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ cc_library(
}),
)

# Depend on a shared library used by dReal iff dReal is enabled.
# Depend on the shared libraries used by dReal iff dReal is enabled.
cc_library(
name = "dreal_deps",
deps = select({
Expand Down
83 changes: 59 additions & 24 deletions tools/workspace/ibex/package.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -276,26 +276,48 @@ IBEX_CONFIG = [
]
]

IBEX_HEADERS = glob([
_IBEX_HEADERS = glob([
"src/**/*.h",
"plugins/optim/src/**/*.h",
], exclude = [
"src/bin/*",
]) + [
"src/ibex_Setting.h",
"src/symbolic/ibex_ExprOperators.h",
":src/ibex_Setting.h",
":src/symbolic/ibex_ExprOperators.h",
"interval_lib_wrapper/filib/ibex_IntervalLibWrapper.h",
"interval_lib_wrapper/filib/ibex_IntervalLibWrapper.inl",
"lp_lib_wrapper/clp/ibex_LPLibWrapper.h",
]

_IBEX_INCLUDES = glob(
["src/*", "plugins/optim/src/*"],
exclude = ["src/wscript", "src/*.*"],
exclude_directories = 0,
) + [
"interval_lib_wrapper/filib",
"lp_lib_wrapper/clp",
"src",
]

drake_generate_include_header(
name = "gen_ibex_h",
out = "src/ibex.h",
hdrs = IBEX_HEADERS,
hdrs = _IBEX_HEADERS,
strip_prefix = ["src/"],
)

cc_library(
name = "ibex_headers",
hdrs = _IBEX_HEADERS + _FILIB_HEADER_FILES + [
":src/ibex.h",
"src/parser/parser.tab.hh",
],
includes = _IBEX_INCLUDES + [
"filibsrc-3.0.2.2",
"", # For plugins
],
)

# Note: We have committed the flex and yacc generated outputs to our fork of
# ibex to avoid the unnecessary dependency here. If we need to revisit this
# decision, the genrules needed are:
Expand All @@ -308,8 +330,14 @@ drake_generate_include_header(
# "@dreal//third_party/com_github_google_kythe/tools/build_rules:lexyacc.bzl"
# is close to what we need to pull in flex and bison.

cc_library(
name = "ibex",
# We only build a shared-library flavor of libdrake_ibex.so, because it is
# LGPL-licensed and thus should never be linked statically. Building C++
# shared libraries in Bazel is a bit arcane. This rule creates the runtime
# artifact -- a loadable shared library. The `name = "ibex"` rule below
# provides the compile-time artifact that combines the shared library with
# its headers.
cc_binary(
name = "libdrake_ibex.so",
srcs = glob([
"src/**/*.cpp",
"src/parser/*.cc",
Expand All @@ -320,42 +348,49 @@ cc_library(
# These files must be generated:
"interval_lib_wrapper/filib/ibex_IntervalLibWrapper.cpp",
"lp_lib_wrapper/clp/ibex_LPLibWrapper.cpp",
"src/symbolic/ibex_ExprOperators.cpp",
],
hdrs = IBEX_HEADERS + [
"src/ibex.h",
"src/parser/parser.tab.hh",
],
includes = glob(
["src/*", "plugins/optim/src/*"],
exclude = ["src/wscript", "src/*.*"],
exclude_directories = 0,
) + [
"src",
"interval_lib_wrapper/filib",
"lp_lib_wrapper/clp",
"", # For plugins
":src/symbolic/ibex_ExprOperators.cpp",
],
copts = ["-w -std=c++11"],
# The linkopts= here are transcribed from the contents of the *.pc file.
linkopts = [
"-lbz2",
"-lm",
],
] + select({
"@drake//tools/cc_toolchain:linux": [
"-Wl,-soname,libdrake_ibex.so",
],
"@//conditions:default": [],
}),
# The deps= here are transcribed from the contents of the *.pc file.
deps = [
":filib",
":ibex_headers",
"@blas",
"@clp",
"@lapack",
"@zlib",
],
visibility = ["//visibility:public"],
linkstatic = True,
linkshared = True,
)

# This is the compile-time target for libdrake_ibex. See above for details.
cc_library(
name = "ibex",
srcs = ["libdrake_ibex.so"],
deps = [":ibex_headers"],
visibility = ["//visibility:public"],
)

install(
name = "install",
docs = ["LICENSE"],
targets = [":libdrake_ibex.so"],
hdrs = _IBEX_HEADERS + [":src/ibex.h"],
hdr_dest = "include/ibex",
hdr_strip_prefix = _IBEX_INCLUDES,
docs = [
"COPYING.LESSER",
"LICENSE",
],
visibility = ["//visibility:public"],
)