-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[workspace] Build vendored clp_internal from source
Deprecate the clp external.
- Loading branch information
1 parent
d717790
commit fdde418
Showing
22 changed files
with
420 additions
and
75 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
coinor-libclp1 | ||
coinor-libcoinutils3v5 | ||
default-jre | ||
jupyter-notebook | ||
|
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,4 +1,3 @@ | ||
coinor-libclp1 | ||
coinor-libcoinutils3v5 | ||
default-jre | ||
jupyter-notebook | ||
|
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,5 +1,4 @@ | ||
clang-format-12 | ||
coinor-libclp-dev | ||
coinor-libcoinutils-dev | ||
default-jdk | ||
file | ||
|
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,5 +1,4 @@ | ||
clang-format-12 | ||
coinor-libclp-dev | ||
coinor-libcoinutils-dev | ||
default-jdk | ||
file | ||
|
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 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 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
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,12 @@ | ||
load("//tools/lint:lint.bzl", "add_lint_tests") | ||
|
||
filegroup( | ||
name = "patches", | ||
srcs = glob( | ||
["patches/**"], | ||
allow_empty = True, | ||
), | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
add_lint_tests() |
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,166 @@ | ||
# -*- bazel -*- | ||
|
||
load( | ||
"@drake//tools/install:install.bzl", | ||
"install", | ||
) | ||
load( | ||
"@drake//tools/workspace/coinutils_internal:defs.bzl", | ||
"coin_cc_library", | ||
) | ||
|
||
licenses(["reciprocal"]) # EPL-2.0 | ||
|
||
package(default_visibility = ["//visibility:private"]) | ||
|
||
exports_files([ | ||
# Always provide access to license texts. | ||
"LICENSE", | ||
]) | ||
|
||
_HDRS = glob( | ||
[ | ||
"Clp/src/*.h", | ||
"Clp/src/*.hpp", | ||
], | ||
exclude = [ | ||
"**/config*", | ||
"**/*Config.h", | ||
], | ||
allow_empty = False, | ||
) | ||
|
||
_SRCS = glob( | ||
[ | ||
"Clp/src/*.cpp", | ||
], | ||
exclude = [ | ||
"**/ClpMain*", | ||
# We treat COIN_HAS_ABC as OFF. | ||
"**/Abc*", | ||
"**/CoinAbc*", | ||
# We treat COIN_HAS_AMD, COIN_HAS_CHOLMOD, and COIN_HAS_GLPK as OFF. | ||
"**/ClpCholeskyUfl*", | ||
# We treat COIN_HAS_MUMPS as OFF. | ||
# TODO(jwnimmer-tri) We can probably enable this. I've left it off for | ||
# now only out of inertia -- Ubuntu builds CLP without MUMPS. | ||
"**/ClpCholeskyMumps*", | ||
# We treat COIN_HAS_WSMP as OFF. | ||
"**/ClpCholeskyWssmp*", | ||
], | ||
allow_empty = False, | ||
) | ||
|
||
_AUTOCONF_DEFINES = [ | ||
"CLP_VERSION=\"drake_vendor\"", | ||
"PACKAGE_VERSION=\"drake_vendor\"", | ||
"VERSION=\"drake_vendor\"", | ||
# Features of the standard library and/or host system. | ||
"HAVE_CFLOAT=1", | ||
"HAVE_CMATH=1", | ||
"HAVE_FLOAT_H=1", | ||
"HAVE_INTTYPES_H=1", | ||
"HAVE_MATH_H=1", | ||
"HAVE_STDINT_H=1", | ||
"HAVE_STDLIB_H=1", | ||
"HAVE_STRINGS_H=1", | ||
"HAVE_STRING_H=1", | ||
"HAVE_SYS_STAT_H=1", | ||
"HAVE_SYS_TYPES_H=1", | ||
"HAVE_UNISTD_H=1", | ||
"STDC_HEADERS=1", | ||
# Optional dependencies that we do actually want to use. | ||
"COIN_HAS_BLAS=1", | ||
"COIN_HAS_COINUTILS=1", | ||
# No debug self-checks (the default). | ||
"COIN_CLP_CHECKLEVEL=0", | ||
"COIN_CLP_VERBOSITY=0", | ||
# These are no-ops, but they can't be omitted. | ||
"CLP_VERSION_MAJOR", | ||
"CLP_VERSION_MINOR", | ||
"CLP_VERSION_RELEASE", | ||
] | ||
|
||
_AUTOCONF_UNDEFINES = [ | ||
# Don't use these features of the standard library and/or host system. | ||
"F77_DUMMY_MAIN", | ||
"F77_FUNC_", | ||
"FC_DUMMY_MAIN_EQ_F77", | ||
"HAVE_CIEEEFP", | ||
"HAVE_DLFCN_H", | ||
"HAVE_IEEEFP_H", | ||
"HAVE_MEMORY_H", | ||
# TODO(jwnimmer-tri) We can probably enable this. I've left it off for now | ||
# only out of inertia -- Ubuntu builds CLP without MUMPS. | ||
"COIN_HAS_MUMPS", | ||
# Optional dependencies that we don't use. | ||
"CLP_HAS_ABC", | ||
"COIN_HAS_AMD", | ||
"COIN_HAS_ASL", | ||
"COIN_HAS_CHOLMOD", | ||
"COIN_HAS_GLPK", | ||
"COIN_HAS_NETLIB", | ||
"COIN_HAS_OSI", | ||
"COIN_HAS_OSITESTS", | ||
"COIN_HAS_READLINE", | ||
"COIN_HAS_SAMPLE", | ||
"COIN_HAS_WSMP", | ||
"HAVE_READLINE_READLINE_H", | ||
# Chaff. | ||
"CLP_SVN_REV", | ||
"PACKAGE", | ||
"PACKAGE_BUGREPORT", | ||
"PACKAGE_NAME", | ||
"PACKAGE_STRING", | ||
"PACKAGE_TARNAME", | ||
# This is actually used by the C++ code, but autoconf_configure_file can't | ||
# handle it. We'll use _CONFIG_PRIVATE_DEFINES for this instead, below. | ||
"F77_FUNC", | ||
] | ||
|
||
_CONFIG_PRIVATE_DEFINES = [ | ||
"F77_FUNC(name,NAME)=name##_", | ||
# This is consistent with a bespoke definition in the upstream Makefile.am. | ||
# This definition is somehow not provided by autoconf. | ||
"COIN_HAS_CLP=1", | ||
] | ||
|
||
_INCLUDES = [ | ||
"Clp/src/", | ||
] | ||
|
||
coin_cc_library( | ||
name = "clp", | ||
config_h = "ClpConfig.h", | ||
config_h_public = "Clp/src/config_clp_default.h", | ||
config_h_private = "Clp/src/config.h.in", | ||
autoconf_defines = _AUTOCONF_DEFINES, | ||
autoconf_undefines = _AUTOCONF_UNDEFINES, | ||
config_private_defines = _CONFIG_PRIVATE_DEFINES, | ||
hdrs_public = _HDRS, | ||
includes_public = _INCLUDES, | ||
hdrs_private = _HDRS, | ||
includes_private = _INCLUDES, | ||
srcs = _SRCS, | ||
vendor_tool_args = ["--no-inline-namespace"], | ||
output_vendoring_patch = "drake_clp.patch", | ||
deps = [ | ||
"@coinutils_internal//:coinutils", | ||
], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
install( | ||
name = "install", | ||
docs = [ | ||
"LICENSE", | ||
# We must redistribute our code changes, per Clp EPL-2.0 license. | ||
":drake_clp.patch", | ||
"@drake//tools/workspace/clp_internal:patches", | ||
], | ||
allowed_externals = [ | ||
"@drake//tools/workspace/clp_internal:patches", | ||
], | ||
doc_strip_prefix = ["patches"], | ||
visibility = ["//visibility:public"], | ||
) |
12 changes: 12 additions & 0 deletions
12
tools/workspace/clp_internal/patches/missing_include.patch
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,12 @@ | ||
[clp] Add missing include for COIN_DBL_MAX | ||
|
||
--- Clp/src/CbcOrClpParam.cpp | ||
+++ Clp/src/CbcOrClpParam.cpp | ||
@@ -3,6 +3,7 @@ | ||
// Corporation and others. All Rights Reserved. | ||
// This code is licensed under the terms of the Eclipse Public License (EPL). | ||
|
||
+#include "CoinFinite.hpp" | ||
#include "CoinPragma.hpp" | ||
#include "CoinTime.hpp" | ||
#include "CbcOrClpParam.hpp" |
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,19 @@ | ||
load( | ||
"@drake//tools/workspace:github.bzl", | ||
"github_archive", | ||
) | ||
|
||
def clp_internal_repository( | ||
name, | ||
mirrors = None): | ||
github_archive( | ||
name = name, | ||
repository = "coin-or/Clp", | ||
commit = "releases/1.17.8", | ||
sha256 = "f9931b5ba44f0daf445c6b48fc2c250dc12e667e59ace8ea7b025f158fe31556", # noqa | ||
build_file = ":package.BUILD.bazel", | ||
patches = [ | ||
":patches/missing_include.patch", | ||
], | ||
mirrors = mirrors, | ||
) |
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,7 +1,12 @@ | ||
load("//tools/lint:lint.bzl", "add_lint_tests") | ||
|
||
add_lint_tests() | ||
filegroup( | ||
name = "patches", | ||
srcs = glob( | ||
["patches/**"], | ||
allow_empty = True, | ||
), | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
# TODO(jwnimmer-tri) In the future, we anticipate adding coinutils as an actual | ||
# workspace dependency. For now, this is just a convenient place to store some | ||
# COIN-OR related Bazel macros. | ||
add_lint_tests() |
Oops, something went wrong.