cmake: Make BOP and GLOP regular optional solver
* Add USE_BOP option for consistency * Add USE_GLOP option for consistency note: OFF is not supported, i.e. GLOP is currently mandatory
This commit is contained in:
committed by
Corentin Le Molgat
parent
0991aaf8fb
commit
5407bd7f58
@@ -92,10 +92,16 @@ endif()
|
||||
set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1)
|
||||
include(CTest)
|
||||
|
||||
# By default only build the C++ library.
|
||||
# By default only build the C++ library which agregate all components.
|
||||
option(BUILD_CXX "Build C++ library" ON)
|
||||
message(STATUS "Build C++ library: ${BUILD_CXX}")
|
||||
|
||||
# If we don't build ortools we could build the GLOP standalone project
|
||||
if(NOT BUILD_CXX)
|
||||
OPTION(BUILD_GLOP "Build GLOP standalone" ON)
|
||||
message(STATUS "Build standalone Glop: ${BUILD_GLOP}")
|
||||
endif()
|
||||
|
||||
option(BUILD_PYTHON "Build Python Library" OFF)
|
||||
message(STATUS "Build Python: ${BUILD_PYTHON}")
|
||||
option(BUILD_JAVA "Build Java Library" OFF)
|
||||
@@ -123,9 +129,6 @@ message(STATUS "Build LP Parser: ${BUILD_LP_PARSER}")
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_MATH_OPT "Build the MATH_OPT" ON "BUILD_CXX" OFF)
|
||||
message(STATUS "Build MathOpt: ${BUILD_MATH_OPT}")
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_GLOP "Build GLOP standalone" ON "NOT BUILD_CXX" OFF)
|
||||
message(STATUS "Build standalone Glop: ${BUILD_GLOP}")
|
||||
|
||||
## Samples
|
||||
option(BUILD_SAMPLES "Build samples" ON)
|
||||
message(STATUS "Build samples: ${BUILD_SAMPLES}")
|
||||
@@ -198,6 +201,11 @@ else()
|
||||
endif()
|
||||
|
||||
# Optional third party solvers (enabled by default)
|
||||
## BOP
|
||||
# note OFF is currently not supported.
|
||||
CMAKE_DEPENDENT_OPTION(USE_BOP "Use the BOP solver" ON "BUILD_CXX" OFF)
|
||||
message(STATUS "BOP support: ${USE_BOP}")
|
||||
|
||||
## COIN-OR Solvers (Cbc, Clp)
|
||||
CMAKE_DEPENDENT_OPTION(USE_COINOR "Use the COIN-OR solver" ON "BUILD_CXX" OFF)
|
||||
message(STATUS "COIN-OR support: ${USE_COINOR}")
|
||||
@@ -223,6 +231,11 @@ if(USE_COINOR)
|
||||
message(STATUS "Build Cbc: ${BUILD_Cbc}")
|
||||
endif()
|
||||
|
||||
## GLOP
|
||||
# note OFF is currently not supported.
|
||||
CMAKE_DEPENDENT_OPTION(USE_GLOP "Use the GLOP solver" ON "BUILD_CXX" OFF)
|
||||
message(STATUS "GLOP support: ${USE_GLOP}")
|
||||
|
||||
## GLPK
|
||||
# Disable by default since it is GPLv3, user could enable it and release under GPLv3
|
||||
# see: https://www.apache.org/licenses/GPL-compatibility.html
|
||||
|
||||
@@ -25,11 +25,6 @@ set(OR_TOOLS_LINK_OPTIONS)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "OR_TOOLS_AS_DYNAMIC_LIB")
|
||||
endif()
|
||||
# Mandatory built-in components
|
||||
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS
|
||||
"USE_BOP" # enable BOP support
|
||||
"USE_GLOP" # enable GLOP support
|
||||
)
|
||||
# Optional built-in components
|
||||
if(BUILD_LP_PARSER)
|
||||
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "USE_LP_PARSER")
|
||||
@@ -39,12 +34,18 @@ if(BUILD_MATH_OPT)
|
||||
set(MATH_OPT_DIR math_opt)
|
||||
endif()
|
||||
# Optional solvers
|
||||
if(USE_BOP)
|
||||
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "USE_BOP")
|
||||
endif()
|
||||
if(USE_COINOR)
|
||||
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS
|
||||
"USE_CBC" # enable COIN-OR CBC support
|
||||
"USE_CLP" # enable COIN-OR CLP support
|
||||
)
|
||||
endif()
|
||||
if(USE_GLOP)
|
||||
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "USE_GLOP")
|
||||
endif()
|
||||
if(USE_GLPK)
|
||||
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "USE_GLPK")
|
||||
set(GLPK_DIR glpk)
|
||||
|
||||
Reference in New Issue
Block a user