1- # Copyright 2010-2022 Google LLC
1+ # Copyright 2010-2024 Google LLC
22# Licensed under the Apache License, Version 2.0 (the "License");
33# you may not use this file except in compliance with the License.
44# You may obtain a copy of the License at
@@ -84,23 +84,24 @@ else()
8484 endforeach ()
8585endif ()
8686
87- if (MSVC )
88- if (NOT BUILD_SHARED_LIBS )
89- # With CMake 3.27+ ZERO_CHECK target will create a cyclic dependencies error.
90- set (CMAKE_SUPPRESS_REGENERATION TRUE )
91- else ()
92- set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON )
93- endif ()
87+ if (MSVC AND BUILD_SHARED_LIBS )
88+ set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON )
9489endif ()
9590
9691# Disable CTest targets
9792set_property (GLOBAL PROPERTY CTEST_TARGETS_ADDED 1 )
9893include (CTest )
9994
100- # By default only build the C++ library.
95+ # By default only build the C++ library which agregate all components .
10196option (BUILD_CXX "Build C++ library" ON )
10297message (STATUS "Build C++ library: ${BUILD_CXX} " )
10398
99+ # If we don't build ortools we could build the GLOP standalone project
100+ if (NOT BUILD_CXX)
101+ OPTION (BUILD_GLOP "Build GLOP standalone" ON )
102+ message (STATUS "Build standalone Glop: ${BUILD_GLOP} " )
103+ endif ()
104+
104105option (BUILD_PYTHON "Build Python Library" OFF )
105106message (STATUS "Build Python: ${BUILD_PYTHON} " )
106107option (BUILD_JAVA "Build Java Library" OFF )
@@ -128,9 +129,6 @@ message(STATUS "Build LP Parser: ${BUILD_LP_PARSER}")
128129CMAKE_DEPENDENT_OPTION (BUILD_MATH_OPT "Build the MATH_OPT" ON "BUILD_CXX" OFF )
129130message (STATUS "Build MathOpt: ${BUILD_MATH_OPT} " )
130131
131- CMAKE_DEPENDENT_OPTION (BUILD_GLOP "Build GLOP standalone" ON "NOT BUILD_CXX" OFF )
132- message (STATUS "Build standalone Glop: ${BUILD_GLOP} " )
133-
134132## Samples
135133option (BUILD_SAMPLES "Build samples" ON )
136134message (STATUS "Build samples: ${BUILD_SAMPLES} " )
@@ -184,7 +182,11 @@ CMAKE_DEPENDENT_OPTION(BUILD_Protobuf "Build the Protobuf dependency Library" OF
184182 "NOT BUILD_DEPS" ON )
185183message (STATUS "Build protobuf: ${BUILD_Protobuf} " )
186184
187- if (BUILD_LP_PARSER)
185+ CMAKE_DEPENDENT_OPTION (BUILD_Eigen3 "Build the eigen3 dependency Library" OFF
186+ "NOT BUILD_DEPS" ON )
187+ message (STATUS "Build eigen3: ${BUILD_Eigen3} " )
188+
189+ if (BUILD_LP_PARSER OR BUILD_TESTING)
188190 CMAKE_DEPENDENT_OPTION (BUILD_re2 "Build the re2 dependency Library" OFF
189191 "NOT BUILD_DEPS" ON )
190192 message (STATUS "Build re2: ${BUILD_re2} " )
@@ -199,6 +201,11 @@ else()
199201endif ()
200202
201203# Optional third party solvers (enabled by default)
204+ ## BOP
205+ # note OFF is currently not supported.
206+ CMAKE_DEPENDENT_OPTION (USE_BOP "Use the BOP solver" ON "BUILD_CXX" OFF )
207+ message (STATUS "BOP support: ${USE_BOP} " )
208+
202209## COIN-OR Solvers (Cbc, Clp)
203210CMAKE_DEPENDENT_OPTION (USE_COINOR "Use the COIN-OR solver" ON "BUILD_CXX" OFF )
204211message (STATUS "COIN-OR support: ${USE_COINOR} " )
@@ -224,8 +231,13 @@ if(USE_COINOR)
224231 message (STATUS "Build Cbc: ${BUILD_Cbc} " )
225232endif ()
226233
234+ ## GLOP
235+ # note OFF is currently not supported.
236+ CMAKE_DEPENDENT_OPTION (USE_GLOP "Use the GLOP solver" ON "BUILD_CXX" OFF )
237+ message (STATUS "GLOP support: ${USE_GLOP} " )
238+
227239## GLPK
228- # Disable by default since it is GLPv3 , user could enable it and release under GLPv3
240+ # Disable by default since it is GPLv3 , user could enable it and release under GPLv3
229241# see: https://www.apache.org/licenses/GPL-compatibility.html
230242CMAKE_DEPENDENT_OPTION (USE_GLPK "Use the GLPK solver" OFF "BUILD_CXX" OFF )
231243message (STATUS "GLPK support: ${USE_GLPK} " )
@@ -238,6 +250,7 @@ endif()
238250## GUROBI
239251# Since it is dynamicaly loaded upon use, OFF is currently not supported.
240252CMAKE_DEPENDENT_OPTION (USE_GUROBI "Use the Gurobi solver" ON "BUILD_CXX" OFF )
253+ message (STATUS "Gurobi support: ${USE_GUROBI} " )
241254
242255## HiGHS
243256# see: https://github.com/ERGO-Code/HiGHS
@@ -256,11 +269,6 @@ if(USE_PDLP)
256269 CMAKE_DEPENDENT_OPTION (BUILD_PDLP "Build the PDLP dependency Library" ON
257270 "NOT BUILD_DEPS" ON )
258271 message (STATUS "Build PDLP: ${BUILD_PDLP} " )
259- if (BUILD_PDLP)
260- CMAKE_DEPENDENT_OPTION (BUILD_Eigen3 "Build the eigen3 dependency Library" OFF
261- "NOT BUILD_DEPS" ON )
262- message (STATUS "Build eigen3: ${BUILD_Eigen3} " )
263- endif ()
264272endif ()
265273
266274## SCIP
@@ -279,8 +287,9 @@ option(USE_CPLEX "Use the CPLEX solver" OFF)
279287message (STATUS "CPLEX support: ${USE_CPLEX} " )
280288
281289## XPRESS
282- option (USE_XPRESS "Use the XPRESS solver" OFF )
283- message (STATUS "XPRESS support: ${USE_XPRESS} " )
290+ # Since it is dynamicaly loaded upon use, OFF is currently not supported.
291+ CMAKE_DEPENDENT_OPTION (USE_XPRESS "Use the Xpress solver" ON "BUILD_CXX" OFF )
292+ message (STATUS "Xpress support: ${USE_XPRESS} " )
284293
285294# Language specific options
286295if (BUILD_CXX)
@@ -362,6 +371,10 @@ if(BUILD_PYTHON)
362371 "NOT BUILD_DEPS" ON )
363372 message (STATUS "Python: Build pybind11_protobuf: ${BUILD_pybind11_protobuf} " )
364373
374+ CMAKE_DEPENDENT_OPTION (BUILD_pybind11_abseil "Build the pybind11_abseil dependency Library" OFF
375+ "NOT BUILD_DEPS" ON )
376+ message (STATUS "Python: Build pybind11_abseil: ${BUILD_pybind11_abseil} " )
377+
365378 option (GENERATE_PYTHON_STUB "Generate Python stub file (.pyi)" ON )
366379 message (STATUS "Python: Generate stub file: ${GENERATE_PYTHON_STUB} " )
367380
0 commit comments