@@ -477,8 +477,30 @@ endif()
477
477
478
478
set (BAZEL_CONFIG)
479
479
480
- option (WITH_GUROBI "Build with support for Gurobi" OFF )
480
+ # Defines common options for open-source solver dependencies.
481
+ # By default, these are all ON.
482
+ # Passes the corresponding options to Bazel.
483
+ function (open_solver_option SOLVER)
484
+ string (TOUPPER "WITH_${SOLVER} " OPTION_NAME)
485
+ string (TOLOWER "with_${SOLVER} " OPTION_BAZEL_ARG)
486
+ option ("${OPTION_NAME} " "Build with support for ${SOLVER} " ON )
487
+ if (${OPTION_NAME} )
488
+ string (APPEND BAZEL_CONFIG " --@drake//tools/flags:${OPTION_BAZEL_ARG} =True" )
489
+ else ()
490
+ string (APPEND BAZEL_CONFIG " --@drake//tools/flags:${OPTION_BAZEL_ARG} =False" )
491
+ endif ()
492
+ set (BAZEL_CONFIG ${BAZEL_CONFIG} PARENT_SCOPE)
493
+ endfunction ()
481
494
495
+ open_solver_option("Clarabel" )
496
+ open_solver_option("CLP" )
497
+ open_solver_option("CSDP" )
498
+ open_solver_option("Ipopt" )
499
+ open_solver_option("NLopt" )
500
+ open_solver_option("OSQP" )
501
+ open_solver_option("SCS" )
502
+
503
+ option (WITH_GUROBI "Build with support for Gurobi" OFF )
482
504
if (WITH_GUROBI)
483
505
find_package (Gurobi 10.0 EXACT MODULE REQUIRED)
484
506
@@ -491,13 +513,11 @@ if(WITH_GUROBI)
491
513
endif ()
492
514
493
515
option (WITH_MOSEK "Build with support for MOSEK" OFF )
494
-
495
516
if (WITH_MOSEK)
496
517
string (APPEND BAZEL_CONFIG " --config=mosek" )
497
518
endif ()
498
519
499
520
option (WITH_OPENMP "Build with support for OpenMP" OFF )
500
-
501
521
if (WITH_OPENMP)
502
522
string (APPEND BAZEL_CONFIG " --config=omp" )
503
523
endif ()
0 commit comments