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

[build] CMake options for solver opt-out #22626

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
38 changes: 35 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,42 @@ endif()

set(BAZEL_CONFIG)

option(WITH_GUROBI "Build with support for Gurobi" OFF)
option(WITH_CLARABEL "Build with support for Clarabel" ON)
if(NOT WITH_CLARABEL)
string(APPEND BAZEL_CONFIG " --@drake//tools/flags:with_clarabel=False")
endif()

option(WITH_CLP "Build with support for CLP" ON)
if(NOT WITH_CLP)
string(APPEND BAZEL_CONFIG " --@drake//tools/flags:with_clp=False")
endif()

option(WITH_CSDP "Build with support for CSDP" ON)
if(NOT WITH_CSDP)
string(APPEND BAZEL_CONFIG " --@drake//tools/flags:with_csdp=False")
endif()

option(WITH_IPOPT "Build with support for Ipopt" ON)
if(NOT WITH_IPOPT)
string(APPEND BAZEL_CONFIG " --@drake//tools/flags:with_ipopt=False")
endif()

option(WITH_NLOPT "Build with support for NLopt" ON)
if(NOT WITH_NLOPT)
string(APPEND BAZEL_CONFIG " --@drake//tools/flags:with_nlopt=False")
endif()

option(WITH_OSQP "Build with support for OSQP" ON)
if(NOT WITH_OSQP)
string(APPEND BAZEL_CONFIG " --@drake//tools/flags:with_osqp=False")
endif()

option(WITH_SCS "Build with support for SCS" ON)
if(NOT WITH_SCS)
string(APPEND BAZEL_CONFIG " --@drake//tools/flags:with_scs=False")
endif()

option(WITH_GUROBI "Build with support for Gurobi" OFF)
if(WITH_GUROBI)
find_package(Gurobi 10.0 EXACT MODULE REQUIRED)

Expand All @@ -491,13 +525,11 @@ if(WITH_GUROBI)
endif()

option(WITH_MOSEK "Build with support for MOSEK" OFF)

if(WITH_MOSEK)
string(APPEND BAZEL_CONFIG " --config=mosek")
endif()

option(WITH_OPENMP "Build with support for OpenMP" OFF)

if(WITH_OPENMP)
string(APPEND BAZEL_CONFIG " --config=omp")
endif()
Expand Down
2 changes: 1 addition & 1 deletion bindings/pydrake/solvers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ drake_py_unittest(
name = "csdp_solver_test",
args = select({
"//tools/workspace/csdp_internal:enabled": [],
"//conditions:default": ["TestCsdptSolver.unavailable"],
"//conditions:default": ["TestCsdpSolver.unavailable"],
}),
deps = [
":solvers",
Expand Down
8 changes: 8 additions & 0 deletions doc/_pages/from_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ Adjusting open-source dependencies:
* WITH_USER_ZLIB (default ON). When ON, uses `find_package(ZLIB)` to locate a
user-provided `ZLIB::ZLIB` library instead of building from source. Caveat:
On macOS, for now this hardcodes `-lz` instead of calling `find_package`.
* WITH_CLARABEL (default ON). When ON, enables the `ClarabelSolver`
in the build.
* WITH_CLP (default ON). When ON, enables the `ClpSolver` in the build.
* WITH_CSDP (default ON). When ON, enables the `CsdpSolver` in the build.
* WITH_IPOPT (default ON). When ON, enables the `IpoptSolver` in the build.
* WITH_NLOPT (default ON). When ON, enables the `NloptSolver` in the build.
* WITH_OSQP (default ON). When ON, enables the `OsqpSolver` in the build.
* WITH_SCS (default ON). When ON, enables the `ScsSolver` in the build.

Adjusting closed-source (commercial) software dependencies:

Expand Down