diff --git a/CMakeLists.txt b/CMakeLists.txt index 55adcb6e6d..6fc7f910ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -296,11 +296,19 @@ message(STATUS "Build PDLP: ${BUILD_PDLP}") CMAKE_DEPENDENT_OPTION(USE_SCIP "Use the Scip solver" ON "BUILD_CXX" OFF) message(STATUS "SCIP support: ${USE_SCIP}") if(USE_SCIP) + CMAKE_DEPENDENT_OPTION(BUILD_Boost "Build the Boost dependency Library" OFF + "NOT BUILD_DEPS" ON) + CMAKE_DEPENDENT_OPTION(BUILD_soplex "Build the Soplex dependency Library" OFF + "NOT BUILD_DEPS" ON) CMAKE_DEPENDENT_OPTION(BUILD_SCIP "Build the SCIP dependency Library" OFF "NOT BUILD_DEPS" ON) else() + set(BUILD_Boost OFF) + set(BUILD_soplex OFF) set(BUILD_SCIP OFF) endif() +message(STATUS "Build Boost (Soplex requirement): ${BUILD_Boost}") +message(STATUS "Build Soplex (SCIP requirement): ${BUILD_soplex}") message(STATUS "Build SCIP: ${BUILD_SCIP}") # Optional third party solvers (disabled by default) diff --git a/Dependencies.txt b/Dependencies.txt index f39cc1cc25..6b15bab1c1 100644 --- a/Dependencies.txt +++ b/Dependencies.txt @@ -10,7 +10,7 @@ Cgl=0.60.9 Cbc=2.10.12 GLPK=5.0 HiGHS=v1.9.0 -Scip=v920 +Scip=v921 # Python pybind11=v2.13.6 pybind11_abseil=v202402.0 diff --git a/MODULE.bazel b/MODULE.bazel index aa204357aa..03542b8dd0 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -37,7 +37,7 @@ bazel_dep(name = "rules_jvm_external", version = "6.6") bazel_dep(name = "rules_license", version = "1.0.0") bazel_dep(name = "rules_proto", version = "7.1.0") bazel_dep(name = "rules_python", version = "1.0.0") -bazel_dep(name = "scip", version = "9.2.0.bcr.3") +bazel_dep(name = "scip", version = "9.2.1") bazel_dep(name = "swig", version = "4.3.0") bazel_dep(name = "zlib", version = "1.3.1.bcr.4") diff --git a/cmake/check_deps.cmake b/cmake/check_deps.cmake index 0cb1ee63c0..3b927b7126 100644 --- a/cmake/check_deps.cmake +++ b/cmake/check_deps.cmake @@ -105,10 +105,10 @@ if(USE_PDLP AND BUILD_PDLP) endif() if(USE_SCIP) - if(NOT TARGET libscip) - message(FATAL_ERROR "Target libscip not available.") + if(NOT TARGET SCIP::libscip) + message(FATAL_ERROR "Target SCIP::libscip not available.") endif() - set(SCIP_DEPS libscip) + set(SCIP_DEPS SCIP::libscip) endif() # Check optional Dependencies diff --git a/cmake/dependencies/CMakeLists.txt b/cmake/dependencies/CMakeLists.txt index 69965037f8..0f8e55cf23 100644 --- a/cmake/dependencies/CMakeLists.txt +++ b/cmake/dependencies/CMakeLists.txt @@ -259,33 +259,86 @@ if(BUILD_HIGHS) message(CHECK_PASS "fetched") endif() +# ############################################################################## +# BOOST +# ############################################################################## +if(BUILD_Boost) + message(CHECK_START "Fetching Boost") + list(APPEND CMAKE_MESSAGE_INDENT " ") + FetchContent_Declare( + Boost + URL + https://github.com/boostorg/boost/releases/download/boost-1.87.0/boost-1.87.0-cmake.tar.gz + USES_TERMINAL_DOWNLOAD TRUE + DOWNLOAD_NO_EXTRACT FALSE + PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/boost-1.87.0.patch" + ) + set(BOOST_INCLUDE_LIBRARIES multiprecision serialization) + option(BOOST_SKIP_INSTALL_RULES NO) + set(BOOST_ENABLE_CMAKE ON) + set(BUILD_SHARED_LIBS OFF) + FetchContent_MakeAvailable(Boost) + set(BUILD_SHARED_LIBS ON) + list(POP_BACK CMAKE_MESSAGE_INDENT) + message(CHECK_PASS "fetched") +endif() + +# ############################################################################## +# SOPLEX +# ############################################################################## +if(BUILD_soplex) + message(CHECK_START "Fetching SOPLEX") + list(APPEND CMAKE_MESSAGE_INDENT " ") + FetchContent_Declare( + soplex + GIT_REPOSITORY "https://github.com/scipopt/soplex.git" + GIT_TAG "release-713" + GIT_SHALLOW TRUE + PATCH_COMMAND git apply --ignore-whitespace + "${CMAKE_CURRENT_LIST_DIR}/../../patches/soplex-v7.1.3.patch" + ) + set(SHARED ON CACHE BOOL "Soplex param" FORCE) + set(ZLIB ON CACHE BOOL "Soplex param" FORCE) + set(GMP OFF CACHE BOOL "Soplex param" FORCE) + set(BOOST ON CACHE BOOL "Soplex param" FORCE) + set(QUADMATH OFF CACHE BOOL "Soplex param" FORCE) + set(MPFR OFF CACHE BOOL "Soplex param" FORCE) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON CACHE BOOL "Soplex param" FORCE) + set(MT OFF CACHE BOOL "Soplex param" FORCE) + set(PAPILO OFF CACHE BOOL "Soplex param" FORCE) + #set(Boost_INCLUDE_DIR "../boost-src/libs/config/include" CACHE PATH "Soplex param" FORCE) + FetchContent_MakeAvailable(soplex) + list(POP_BACK CMAKE_MESSAGE_INDENT) + message(CHECK_PASS "fetched") +endif() + # ############################################################################## # SCIP # ############################################################################## if(BUILD_SCIP) message(CHECK_START "Fetching SCIP") list(APPEND CMAKE_MESSAGE_INDENT " ") - set(SHARED OFF) - set(READLINE OFF) - set(GMP OFF) - set(PAPILO OFF) - set(ZIMPL OFF) - set(IPOPT OFF) - set(AMPL OFF) - - set(TPI "tny" CACHE STRING "Scip param") - set(EXPRINT "none" CACHE STRING "Scip param") - set(LPS "none" CACHE STRING "Scip param") - set(SYM "none" CACHE STRING "Scip param") FetchContent_Declare( scip GIT_REPOSITORY "https://github.com/scipopt/scip.git" GIT_TAG "v921" GIT_SHALLOW TRUE - PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/scip-v921.patch" + PATCH_COMMAND git apply --ignore-whitespace + "${CMAKE_CURRENT_LIST_DIR}/../../patches/scip-v921.patch" ) + set(SHARED ON CACHE BOOL "Scip param" FORCE) + set(ZLIB ON CACHE BOOL "Scip param" FORCE) + set(READLINE OFF CACHE BOOL "Scip param" FORCE) + set(GMP OFF CACHE BOOL "Scip param" FORCE) + set(PAPILO OFF CACHE BOOL "Scip param" FORCE) + set(ZIMPL OFF CACHE BOOL "Scip param" FORCE) + set(AMPL OFF CACHE BOOL "Scip param" FORCE) + set(IPOPT OFF CACHE BOOL "Scip param" FORCE) + set(TPI "tny" CACHE STRING "Scip param" FORCE) + set(EXPRINT "none" CACHE STRING "Scip param" FORCE) + set(LPS "spx" CACHE STRING "Scip param" FORCE) + set(SYM "none" CACHE STRING "Scip param" FORCE) FetchContent_MakeAvailable(scip) - set(LPI_GLOP_SRC ${scip_SOURCE_DIR}/src/lpi/lpi_glop.cpp PARENT_SCOPE) list(POP_BACK CMAKE_MESSAGE_INDENT) message(CHECK_PASS "fetched") endif() diff --git a/cmake/docs/cmake.dot b/cmake/docs/cmake.dot index a5bb649628..f16a364e8c 100644 --- a/cmake/docs/cmake.dot +++ b/cmake/docs/cmake.dot @@ -41,6 +41,14 @@ digraph CMake { label = "abseil/abseil-cpp.git"; } + subgraph clusterRe2 { + Re2 [label="re2::re2"]; + + color=royalblue; + label = "google/re2.git"; + } + Absl -> Re2; + subgraph clusterProtobuf { Protobuf [label="protobuf::libprotobuf", color=royalblue]; @@ -49,6 +57,7 @@ digraph CMake { } ZLIB -> Protobuf; Absl -> Protobuf; + Re2 -> Protobuf; subgraph clusterCoinOR { subgraph clusterCoinUtils { @@ -139,15 +148,27 @@ digraph CMake { } subgraph clusterSCIPSolver { + subgraph clusterSoplex { + SPX [label="libsoplex-pic"]; + + color=royalblue; + label = "scipopt/soplex.git"; + } + subgraph clusterSCIP { - SCIP [label="scip::scip"]; + SCIP [label="SCIP::libscip"]; color=royalblue; label = "scipopt/scip.git"; } + + SPX -> SCIP; + color=royalblue; label = "SCIP Solver\n(-DUSE_SCIP=ON)"; } + ZLIB -> SPX; + ZLIB -> SCIP; SWIG_WIN [label="swigwin\n(Windows)", color=chocolate]; @@ -176,6 +197,7 @@ digraph CMake { ZLIB -> OR_SRC; Absl -> OR_SRC; Protobuf -> OR_SRC; + Re2 -> OR_SRC; ClpSolver -> OR_SRC; CbcSolver -> OR_SRC; GLPK -> OR_SRC; @@ -228,7 +250,7 @@ digraph CMake { OR_SRC -> OR_WJAVA [label="swig", color=chocolate]; OR_SRC -> OR_JAVA [label="swig", color=chocolate]; OR_WJAVA -> OR_JAVA; - OR_JAVA -> PKG_JAVA [label="maven (WIP)", style="dotted", color=crimson]; + OR_JAVA -> PKG_JAVA [label="maven", color=crimson]; color=crimson; label = "Java\n(-DBUILD_JAVA=ON)"; diff --git a/cmake/docs/deps.dot b/cmake/docs/deps.dot index 7ad3fc8bb9..1761e3ea7c 100644 --- a/cmake/docs/deps.dot +++ b/cmake/docs/deps.dot @@ -135,12 +135,20 @@ digraph CMakeDeps { } subgraph clusterSCIPSolver { + subgraph clusterSoplex { + SPX [label="libsoplex"]; + + color=royalblue; + label = "scipopt/soplex.git"; + } subgraph clusterSCIP { - SCIP [label="scip::scip"]; + SCIP [label="SCIP::libscip"]; color=royalblue; label = "scipopt/scip.git"; } + SPX -> SCIP; + color=royalblue; label = "-DUSE_SCIP=ON AND -DBUILD_SCIP=ON"; } @@ -148,7 +156,11 @@ digraph CMakeDeps { // inter deps ZLIB -> Protobuf; ZLIB -> Cbc; + ZLIB -> SPX; + ZLIB -> SCIP; + Absl -> Re2; Absl -> Protobuf; + Re2 -> Protobuf; } @enddot # vim tw:0 diff --git a/cmake/dotnet.cmake b/cmake/dotnet.cmake index e5a0d8b64e..83e00ba151 100644 --- a/cmake/dotnet.cmake +++ b/cmake/dotnet.cmake @@ -395,6 +395,9 @@ set(need_cbc_lib "$>") set(need_unix_highs_lib "$>") set(need_windows_highs_lib "$>") +set(need_unix_scip_lib "$>") +set(need_windows_scip_lib "$>") + set(is_ortools_shared "$,SHARED_LIBRARY>") set(need_unix_ortools_lib "$") set(need_windows_ortools_lib "$") diff --git a/cmake/java.cmake b/cmake/java.cmake index 687a25340d..50235446e1 100644 --- a/cmake/java.cmake +++ b/cmake/java.cmake @@ -298,6 +298,9 @@ set(need_unix_cbc_lib "$>") set(need_unix_highs_lib "$>") set(need_windows_highs_lib "$>") +set(need_unix_scip_lib "$>") +set(need_windows_scip_lib "$>") + set(is_ortools_shared "$,SHARED_LIBRARY>") set(need_unix_ortools_lib "$") set(need_windows_ortools_lib "$") @@ -441,8 +444,14 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E $,copy,true> - $<${need_unix_highs_lib}:$> - $<${need_windows_highs_lib}:$> + $<${need_unix_highs_lib}:$> + $<${need_windows_highs_lib}:$> + ${JAVA_RESSOURCES_PATH}/${JAVA_NATIVE_PROJECT}/ + + COMMAND ${CMAKE_COMMAND} -E + $,copy,true> + $<${need_unix_scip_lib}:$> + $<${need_windows_scip_lib}:$> ${JAVA_RESSOURCES_PATH}/${JAVA_NATIVE_PROJECT}/ COMMAND ${CMAKE_COMMAND} -E diff --git a/cmake/ortoolsConfig.cmake.in b/cmake/ortoolsConfig.cmake.in index 9372ce9ab9..9ee8e216c9 100644 --- a/cmake/ortoolsConfig.cmake.in +++ b/cmake/ortoolsConfig.cmake.in @@ -66,7 +66,7 @@ if(@USE_PDLP@) endif() if(@USE_SCIP@) - if(NOT TARGET libscip) + if(NOT TARGET SCIP::libscip) find_dependency(SCIP REQUIRED) endif() endif() diff --git a/cmake/python.cmake b/cmake/python.cmake index 2d18f821df..b008d3dd95 100644 --- a/cmake/python.cmake +++ b/cmake/python.cmake @@ -454,6 +454,9 @@ set(need_unix_cbc_lib "$>") set(need_unix_highs_lib "$>") set(need_windows_highs_lib "$>") +set(need_unix_scip_lib "$>") +set(need_windows_scip_lib "$>") + set(is_ortools_shared "$,SHARED_LIBRARY>") set(need_unix_ortools_lib "$") set(need_windows_ortools_lib "$") @@ -597,8 +600,14 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E $,copy,true> - $<${need_unix_highs_lib}:$> - $<${need_windows_highs_lib}:$> + $<${need_unix_highs_lib}:$> + $<${need_windows_highs_lib}:$> + ${PYTHON_PROJECT}/.libs + + COMMAND ${CMAKE_COMMAND} -E + $,copy,true> + $<${need_unix_scip_lib}:$> + $<${need_windows_scip_lib}:$> ${PYTHON_PROJECT}/.libs COMMAND ${CMAKE_COMMAND} -E diff --git a/ortools/dotnet/Google.OrTools.runtime.csproj.in b/ortools/dotnet/Google.OrTools.runtime.csproj.in index 82f1dd13f7..f7dfe0833d 100644 --- a/ortools/dotnet/Google.OrTools.runtime.csproj.in +++ b/ortools/dotnet/Google.OrTools.runtime.csproj.in @@ -129,8 +129,11 @@ $<@need_cgl_lib@:;$> $<@need_cbc_lib@:;$;$;$> - $<@need_unix_highs_lib@:;$> - $<@need_windows_highs_lib@:;$> + $<@need_unix_highs_lib@:;$> + $<@need_windows_highs_lib@:;$> + + $<@need_unix_scip_lib@:;$> + $<@need_windows_scip_lib@:;$> $<@need_unix_ortools_lib@:;$> $<@need_windows_ortools_lib@:;$> diff --git a/ortools/gscip/CMakeLists.txt b/ortools/gscip/CMakeLists.txt index 2eafbb1844..eb4160b5ff 100644 --- a/ortools/gscip/CMakeLists.txt +++ b/ortools/gscip/CMakeLists.txt @@ -33,6 +33,6 @@ target_link_libraries(${NAME} PRIVATE absl::strings absl::str_format protobuf::libprotobuf - $<$:libscip> + SCIP::libscip ${PROJECT_NAMESPACE}::ortools_proto) #add_library(${PROJECT_NAMESPACE}::gscip ALIAS ${NAME}) diff --git a/ortools/java/com/google/ortools/Loader.java b/ortools/java/com/google/ortools/Loader.java index 68c7606e4f..457ab82d53 100644 --- a/ortools/java/com/google/ortools/Loader.java +++ b/ortools/java/com/google/ortools/Loader.java @@ -143,7 +143,7 @@ public class Loader { Path tempPath = unpackNativeResources(resourceURI); // libraries order does matter ! List dlls = Arrays.asList("zlib1", "abseil_dll", "re2", "utf8_validity", - "libprotobuf", "highs", "ortools", "jniortools"); + "libprotobuf", "highs", "libscip", "ortools", "jniortools"); for (String dll : dlls) { try { // System.out.println("System.load(" + dll + ")"); diff --git a/ortools/linear_solver/CMakeLists.txt b/ortools/linear_solver/CMakeLists.txt index 9902bd9239..3263a8d0c2 100644 --- a/ortools/linear_solver/CMakeLists.txt +++ b/ortools/linear_solver/CMakeLists.txt @@ -48,7 +48,7 @@ target_link_libraries(${NAME} PRIVATE $<$:GLPK::GLPK> $<$:highs::highs> $<$:Eigen3::Eigen> - $<$:libscip> + $<$:SCIP::libscip> ${PROJECT_NAMESPACE}::ortools_proto) #add_library(${PROJECT_NAMESPACE}::linear_solver ALIAS ${NAME}) diff --git a/ortools/linear_solver/proto_solver/CMakeLists.txt b/ortools/linear_solver/proto_solver/CMakeLists.txt index 7a4686a06e..76b184e260 100644 --- a/ortools/linear_solver/proto_solver/CMakeLists.txt +++ b/ortools/linear_solver/proto_solver/CMakeLists.txt @@ -46,7 +46,7 @@ target_link_libraries(${NAME} PRIVATE absl::status absl::str_format $<$:Eigen3::Eigen> - $<$:libscip> + $<$:SCIP::libscip> $<$:highs::highs> ${PROJECT_NAMESPACE}::ortools_proto) #add_library(${PROJECT_NAMESPACE}::linear_solver_proto_solver ALIAS ${NAME}) diff --git a/ortools/linear_solver/wrappers/CMakeLists.txt b/ortools/linear_solver/wrappers/CMakeLists.txt index fcdca59bdd..97d8136fa0 100644 --- a/ortools/linear_solver/wrappers/CMakeLists.txt +++ b/ortools/linear_solver/wrappers/CMakeLists.txt @@ -25,6 +25,6 @@ target_include_directories(${NAME} PRIVATE ${PROJECT_BINARY_DIR}) target_link_libraries(${NAME} PRIVATE absl::status - $<$:libscip> + $<$:SCIP::libscip> ${PROJECT_NAMESPACE}::ortools_proto) #add_library(${PROJECT_NAMESPACE}::linear_solver_wrappers ALIAS ${NAME}) diff --git a/ortools/math_opt/io/CMakeLists.txt b/ortools/math_opt/io/CMakeLists.txt index 1b205e2975..c0c3e2033e 100644 --- a/ortools/math_opt/io/CMakeLists.txt +++ b/ortools/math_opt/io/CMakeLists.txt @@ -30,5 +30,5 @@ target_include_directories(${NAME} PUBLIC target_link_libraries(${NAME} PRIVATE ${PROJECT_NAMESPACE}::math_opt_proto absl::strings - $<$:libscip> + $<$:SCIP::libscip> ) diff --git a/ortools/python/__init__.py.in b/ortools/python/__init__.py.in index fb4d7d6488..a2544edc1a 100644 --- a/ortools/python/__init__.py.in +++ b/ortools/python/__init__.py.in @@ -55,7 +55,10 @@ def _load_ortools_libs(): except: pass else: - for dll in ["zlib1.dll", "abseil_dll.dll", "utf8_validity.dll", "re2.dll", "libprotobuf.dll", "highs.dll", "ortools.dll"]: + for dll in ["zlib1.dll", + "abseil_dll.dll", "utf8_validity.dll", "re2.dll", "libprotobuf.dll", + "highs.dll", "libscip.dll", + "ortools.dll"]: dll_path = os.path.join(basedir, ".libs", dll) if os.path.exists(dll_path): print(f"load {dll_path}...") diff --git a/patches/BUILD.bazel b/patches/BUILD.bazel index c9749b6ce9..b78c6d1ab5 100644 --- a/patches/BUILD.bazel +++ b/patches/BUILD.bazel @@ -18,5 +18,5 @@ exports_files([ "pybind11_abseil.patch", "pybind11_protobuf.patch", "pybind11.patch", - "scip-v920.patch", + "scip-v921.patch", ]) diff --git a/patches/boost-1.87.0.patch b/patches/boost-1.87.0.patch new file mode 100644 index 0000000000..5360055650 --- /dev/null +++ b/patches/boost-1.87.0.patch @@ -0,0 +1,12 @@ +diff -ru a/tools/cmake/include/BoostInstall.cmake b/tools/cmake/include/BoostInstall.cmake +--- a/tools/cmake/include/BoostInstall.cmake 2024-12-12 00:43:08.000000000 +0100 ++++ b/tools/cmake/include/BoostInstall.cmake 2025-03-03 13:11:00.310140710 +0100 +@@ -306,7 +306,7 @@ + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + +- export(TARGETS ${LIB} NAMESPACE Boost:: FILE export/${LIB}-targets.cmake) ++ #export(TARGETS ${LIB} NAMESPACE Boost:: FILE export/${LIB}-targets.cmake) + + if(MSVC) + if(TYPE STREQUAL "SHARED_LIBRARY") diff --git a/patches/scip-v921.patch b/patches/scip-v921.patch index 22c2d14c1e..7a92254118 100644 --- a/patches/scip-v921.patch +++ b/patches/scip-v921.patch @@ -1,45 +1,145 @@ -diff --git a/src/lpi/lpi_glop.cpp b/src/lpi/lpi_glop.cpp -index a90120188a..2c068e5e30 100644 ---- a/src/lpi/lpi_glop.cpp -+++ b/src/lpi/lpi_glop.cpp -@@ -51,7 +51,6 @@ - #include "ortools/util/time_limit.h" +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8492dc75..4c12a9bf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -38,9 +38,11 @@ set(CPACK_PACKAGE_VENDOR "Zuse Institute Berlin") + set(CPACK_PACKAGE_CONTACT "http://scipopt.org") + include(CPack) - #include "ortools/base/logging.h" --#include "ortools/base/vlog_is_on.h" +-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) +-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) ++if(CMAKE_PROJECT_NAME EQUAL "SCIP") ++ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) ++ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) ++ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) ++endif() - #include "lpi/lpi.h" - #include "scip/pub_message.h" -@@ -2942,12 +2941,12 @@ SCIP_RETCODE SCIPlpiSetIntpar( - SCIPdebugMessage("SCIPlpiSetIntpar: SCIP_LPPAR_LPINFO -> %d.\n", ival); - if ( ival == 0 ) - { -- (void) google::SetVLOGLevel("*", google::GLOG_INFO); -+ absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); - lpi->lp_info = false; - } - else - { -- (void) google::SetVLOGLevel("*", google::GLOG_ERROR); -+ absl::SetStderrThreshold(absl::LogSeverityAtLeast::kError); - lpi->lp_info = true; - } - break; -@@ -3190,7 +3189,7 @@ SCIP_RETCODE SCIPlpiReadLP( + if(SCIPOptSuite_BINARY_DIR) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SCIPOptSuite_BINARY_DIR}/bin) +@@ -412,22 +414,11 @@ endif() + #search the selected LP solver library + message(STATUS "Finding Solver \"${LPS}\"") + if(LPS STREQUAL "spx") +- message(STATUS "Finding Soplex") +- find_package(SOPLEX CONFIG HINTS ${SOPLEX_DIR}) +- if(NOT SOPLEX_FOUND) +- # Utilities to automatically download missing dependencies +- include(cmake/Dependencies.cmake) +- find_or_download_package( +- NAME SOPLEX +- VERSION 7.0.1 +- URL https://github.com/scipopt/soplex/archive/refs/tags/release-701.tar.gz +- URL_HASH SHA256=80cce994dcbe45fd52b60e31a3aeb5d2c60a7ddbaae495e0ce6bf58481675696 +- COMPONENTS soplex) +- find_package(SOPLEX REQUIRED CONFIG HINTS _deps/local) +- endif() +- if(NOT SOPLEX_FOUND) ++ message(STATUS "Finding Soplex...") ++ if(NOT TARGET libsoplex-pic OR NOT TARGET libsoplex) + message(FATAL_ERROR "Requested LP solver SoPlex not found.") + endif() ++ set(SOPLEX_FOUND TRUE) + if (DEFINED SOPLEX_WITH_PAPILO) + message(STATUS "SOPLEX links PAPILO") + if((NOT SCIP_WITH_PAPILO)) # TODO not sure how to handle AUTOBUILD +@@ -502,9 +493,9 @@ if(SOPLEX_FOUND) + message(STATUS "Finding SOPLEX - found") + # SoPlex headers can be directly included + include_directories(${SOPLEX_INCLUDE_DIRS}) +- set(LPS_LIBRARIES ${SOPLEX_LIBRARIES}) ++ set(LPS_LIBRARIES libsoplex) + if(SHARED) +- set(LPS_PIC_LIBRARIES ${SOPLEX_PIC_LIBRARIES}) ++ set(LPS_PIC_LIBRARIES libsoplex-pic) + else() + set(LPS_PIC_LIBRARIES ${LPS_LIBRARIES}) + endif() +@@ -514,7 +505,7 @@ if(SOPLEX_FOUND) + set(lpi lpi/lpi_spx2.cpp) + endif() + else() +- message(STATUS "Support SOPLEX: OFF") ++ message(FATAL_ERROR "SOPLEX not found !") + endif() - const std::string filespec(fname); - MPModelProto proto; -- if ( ! ReadFileToProto(filespec, &proto) ) -+ if ( ! ReadFileToProto(filespec, &proto).ok() ) - { - SCIPerrorMessage("Could not read <%s>\n", fname); - return SCIP_READERROR; -@@ -3214,7 +3213,7 @@ SCIP_RETCODE SCIPlpiWriteLP( - MPModelProto proto; - LinearProgramToMPModelProto(*lpi->linear_program, &proto); - const std::string filespec(fname); -- if ( ! WriteProtoToFile(filespec, proto, operations_research::ProtoWriteFormat::kProtoText, true) ) -+ if ( ! WriteProtoToFile(filespec, proto, operations_research::ProtoWriteFormat::kProtoText, true).ok() ) - { - SCIPerrorMessage("Could not write <%s>\n", fname); - return SCIP_READERROR; + if(CLP_FOUND) +diff --git a/scip-config.cmake.in b/scip-config.cmake.in +index 559552f9..682ac40a 100644 +--- a/scip-config.cmake.in ++++ b/scip-config.cmake.in +@@ -1,17 +1,16 @@ + if(NOT TARGET libscip) +- include("${CMAKE_CURRENT_LIST_DIR}/scip-targets.cmake") +-endif() ++ include(CMakeFindDependencyMacro) ++ if(@ZIMPL_NEEDED@) ++ find_dependency(ZIMPL REQUIRED NO_MODULE) ++ endif() ++ if(@SOPLEX_NEEDED@) ++ find_dependency(SOPLEX REQUIRED NO_MODULE) ++ endif() + +-if(@ZIMPL_NEEDED@) +- set(ZIMPL_DIR "@CONF_ZIMPL_DIR@") +- find_package(ZIMPL QUIET CONFIG) +-endif() +- +-if(@SOPLEX_NEEDED@) +- set(SOPLEX_DIR "@CONF_SOPLEX_DIR@") +- find_package(SOPLEX QUIET CONFIG) ++ include("${CMAKE_CURRENT_LIST_DIR}/scip-targets.cmake") + endif() + ++# Legacy + set(SCIP_LIBRARIES libscip) + set(SCIP_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@") + set(SCIP_FOUND TRUE) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index e6fda2d5..2d04b845 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -1149,17 +1149,8 @@ install(TARGETS scip libscip EXPORT scip-targets + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + # Add all targets to the build-tree export set +-export(TARGETS scip libscip +- FILE "${PROJECT_BINARY_DIR}/scip-targets.cmake") +- +-# make soplex and zimpl dir absolute for the config file +-if(SOPLEX_NEEDED) +- get_filename_component(CONF_SOPLEX_DIR ${SOPLEX_DIR} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}) +-endif() +- +-if(ZIMPL_NEEDED) +- get_filename_component(CONF_ZIMPL_DIR ${ZIMPL_DIR} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}) +-endif() ++#export(TARGETS scip libscip ++# FILE "${PROJECT_BINARY_DIR}/scip-targets.cmake") + + # configure the config file for the build tree + set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}") +@@ -1175,18 +1166,16 @@ ${PROJECT_BINARY_DIR}/scip-config-version.cmake + + #configure the config file for the install + set(CONF_INCLUDE_DIRS "\${CMAKE_CURRENT_LIST_DIR}/../../../include") +-if(SOPLEX_NEEDED) +- set(CONF_SOPLEX_DIR "\${CMAKE_CURRENT_LIST_DIR}/../soplex") +-endif() +-if(ZIMPL_NEEDED) +- set(CONF_ZIMPL_DIR "\${CMAKE_CURRENT_LIST_DIR}/../zimpl") +-endif() + configure_file(${PROJECT_SOURCE_DIR}/scip-config.cmake.in + "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/scip-config.cmake" @ONLY) + + # install the targets of the scip export group and the config file so that other projects + # can link easily against scip +-install(EXPORT scip-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scip) ++install(EXPORT scip-targets ++ NAMESPACE SCIP:: ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scip ++ COMPONENT Devel ++) + install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/scip-config.cmake" + ${PROJECT_BINARY_DIR}/scip-config-version.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scip) diff --git a/patches/soplex-v7.1.3.patch b/patches/soplex-v7.1.3.patch new file mode 100644 index 0000000000..06b629ec98 --- /dev/null +++ b/patches/soplex-v7.1.3.patch @@ -0,0 +1,225 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0b21f5a..ddf1536 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -27,6 +27,10 @@ set(CPACK_PACKAGE_VERSION_PATCH "${SOPLEX_VERSION_PATCH}") + set(CPACK_PACKAGE_VENDOR "Zuse Institute Berlin") + include(CPack) + ++# Disable CTest targets ++set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) ++include(CTest) ++ + option(ZLIB "Use ZLIB" ON) + option(GMP "Use GMP" ON) + option(EMSCRIPTEN_HTML "Emscripten HTML output" OFF) +@@ -43,11 +47,17 @@ option(SANITIZE_THREAD "should the thread sanitizer be enabled in debug mode if + option(COVERAGE "enable coverage support" OFF) + option(PAPILO "should papilo library be linked" ON) + ++option(SOPLEX_EXAMPLE "Build example" OFF) ++option(SOPLEX_SOPLEX "Build soplex program" OFF) ++option(SOPLEX_EXPORT "Enable to use soplex from the current project's build tree, without installation." OFF) ++ + SET(COVERAGE_CTEST_ARGS "" CACHE STRING "additional ctest arguments for coverage") + +-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) ++if(CMAKE_PROJECT_NAME EQUAL "SOPLEX") ++ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ++ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) ++ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) ++endif() + + # for colorized output + if(NOT WIN32) +@@ -69,6 +79,8 @@ set(CMAKE_MACOSX_RPATH ON) + + # use C++14 standard + set(CMAKE_CXX_STANDARD 14) ++set(CMAKE_CXX_STANDARD_REQUIRED ON) ++set(CMAKE_CXX_EXTENSIONS OFF) + + # set function visibility default to hidden + set(CMAKE_CXX_VISIBILITY_PRESET hidden) +@@ -123,12 +135,11 @@ if(COVERAGE) + endif() + + if(ZLIB) +- find_package(ZLIB) +-endif() +-if(ZLIB_FOUND) +- set(SOPLEX_WITH_ZLIB on) +- set(libs ${libs} ${ZLIB_LIBRARIES}) +- include_directories(${ZLIB_INCLUDE_DIRS}) ++ if(NOT TARGET ZLIB::ZLIB) ++ find_package(ZLIB REQUIRED) ++ endif() ++ set(SOPLEX_WITH_ZLIB on) ++ set(libs ${libs} ZLIB::ZLIB) + endif() + + if(GMP) +@@ -170,39 +181,24 @@ else() + set(SOPLEX_WITH_PAPILO off) + endif() + +-set(BOOST_MINIMUM_VERSION 1.65.0) ++set(BOOST_MINIMUM_VERSION 1.65.0) # PaPILO requires at least Boost 1.65 (on mac 1.72) + if(BOOST) +- find_package(Boost ${BOOST_MINIMUM_VERSION}) # PaPILO requires at least Boost 1.65 (on mac 1.72) +- if(Boost_FOUND) +- set(SOPLEX_WITH_BOOST on) +- include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) +- if(NOT Boost_VERSION_MACRO) +- set(Boost_VERSION_MACRO ${Boost_VERSION}) +- endif() +- if(${Boost_VERSION_MACRO} LESS "107000") +- if(NOT SOPLEX_WITH_GMP) +- message(SEND_ERROR "If no GMP is linked, then the minimal Boost verion is 1.70. \ +- Found Boost version is ${Boost_VERSION_STRING}. Either provide newer Boost, link GMP, or disable Boost by setting BOOST=off.") +- else() +- message(WARNING "The multiprecision and quadprecision features are disabled with Boost versions older than 1.70. \ +- Found Boost version is ${Boost_VERSION_STRING}.") +- endif() +- endif() +- if(MPFR) # MPFR is used within boost multiprecision, so using it without Boost does not make sense +- find_package(MPFR) +- endif() +- if(MPFR_FOUND) +- message(STATUS "SoPlex with Boost MPFR libraries") +- set(SOPLEX_WITH_MPFR on) +- include_directories(${MPFR_INCLUDE_DIRS}) +- set(libs ${libs} ${MPFR_LIBRARIES}) +- else() +- message(STATUS "SoPlex with Boost CPP multiprecision libraries") +- set(SOPLEX_WITH_CPPMPF on) +- endif() +- else() +- set(BOOST off) +- endif() ++ if(NOT TARGET Boost::multiprecision OR NOT TARGET Boost::serialization) ++ message(FATAL_ERROR "Boost::multiprecision or Boost::serialization not available!!!") ++ find_package(Boost ${BOOST_MINIMUM_VERSION} REQUIRED) ++ endif() ++ set(SOPLEX_WITH_BOOST on) ++ set(libs ${libs} Boost::multiprecision Boost::serialization) ++ if(MPFR) # MPFR is used within boost multiprecision, so using it without Boost does not make sense ++ find_package(MPFR REQUIRED) ++ message(STATUS "SoPlex with Boost MPFR libraries") ++ set(SOPLEX_WITH_MPFR on) ++ include_directories(${MPFR_INCLUDE_DIRS}) ++ set(libs ${libs} ${MPFR_LIBRARIES}) ++ else() ++ message(STATUS "SoPlex with Boost CPP multiprecision libraries") ++ set(SOPLEX_WITH_CPPMPF on) ++ endif() + endif() + + # disable fused floating point contraction to enhance reproducibility across compilers and architectures +@@ -247,7 +243,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/soplex/config.h.in ${PROJECT_BINA + configure_file(${PROJECT_SOURCE_DIR}/soplex-config.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/soplex-config.cmake" @ONLY) + + add_subdirectory(src) +-add_subdirectory(tests/c_interface) +-add_subdirectory(check) +- +-enable_testing() ++if(BUILD_TESTING) ++ add_subdirectory(tests/c_interface) ++ add_subdirectory(check) ++endif() +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 84ec5a5..6f5d4ef 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -193,24 +193,28 @@ target_link_libraries(libsoplexshared libsoplex ${libs}) + set_target_properties(libsoplexshared PROPERTIES CXX_VISIBILITY_PRESET default) + + # create soplex binary using library without pic +-add_executable(soplex soplexmain.cpp) +-target_link_libraries(soplex LINK_PUBLIC libsoplex ${Boost_LIBRARIES}) ++if(SOPLEX_SOPLEX) ++ add_executable(soplex EXCLUDE_FROM_ALL soplexmain.cpp) ++ target_link_libraries(soplex PRIVATE libsoplex ${Boost_LIBRARIES}) + +-if(EMSCRIPTEN AND EMSCRIPTEN_HTML) ++ # set the install rpath to the installed destination ++ set_target_properties(soplex PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") ++ ++ if(EMSCRIPTEN AND EMSCRIPTEN_HTML) + set_target_properties(soplex PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/soplex_webdemo_shell.html) + set(CMAKE_EXECUTABLE_SUFFIX ".html") +-endif() ++ endif() + +-if(CMAKE_BUILD_TYPE EQUAL "Debug") +- find_package(Sanitizers) +- add_sanitizers(soplex) ++ if(CMAKE_BUILD_TYPE EQUAL "Debug") ++ find_package(Sanitizers) ++ add_sanitizers(soplex) ++ endif() + endif() + +-add_executable(example EXCLUDE_FROM_ALL example.cpp) +-target_link_libraries(example libsoplex) +- +-# set the install rpath to the installed destination +-set_target_properties(soplex PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") ++if(SOPLEX_EXAMPLE) ++ add_executable(example example.cpp) ++ target_link_libraries(example libsoplex) ++endif() + + # install the header files of soplex + install(FILES ${headers} ${PROJECT_BINARY_DIR}/soplex/config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/soplex) +@@ -237,15 +241,28 @@ install(FILES + DESTINATION include/soplex/external/zstr) + + # install the binary and the library to appropriate lcoations and add them to an export group +-install(TARGETS soplex libsoplex libsoplex-pic libsoplexshared EXPORT soplex-targets ++if(SOPLEX_SOPLEX) ++ install(TARGETS soplex ++ EXPORT soplex-targets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) ++endif() ++ ++install(TARGETS libsoplex libsoplex-pic libsoplexshared ++ EXPORT soplex-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + ++install(EXPORT soplex-targets ++ FILE soplex-targets.cmake ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/soplex) ++ + # Add library targets to the build-tree export set +-export(TARGETS libsoplex libsoplex-pic libsoplexshared +- FILE "${CMAKE_BINARY_DIR}/soplex-targets.cmake") ++if(SOPLEX_EXPORT) ++ export(TARGETS libsoplex libsoplex-pic libsoplexshared ++ FILE "${CMAKE_BINARY_DIR}/soplex-targets.cmake") ++endif() + + #configure the config file for the build tree + set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}") +@@ -259,7 +276,6 @@ ${CMAKE_BINARY_DIR}/soplex-config-version.cmake + COMPATIBILITY SameMajorVersion + ) + +- + #configure the config file for the install + set(CONF_INCLUDE_DIRS "\${CMAKE_CURRENT_LIST_DIR}/../../../include") + configure_file(${PROJECT_SOURCE_DIR}/soplex-config.cmake.in +@@ -267,7 +283,6 @@ configure_file(${PROJECT_SOURCE_DIR}/soplex-config.cmake.in + + # install the targets of the soplex export group and the config file so that other projects + # can link easily against soplex +-install(EXPORT soplex-targets FILE soplex-targets.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/soplex) + install(FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/soplex-config.cmake" + ${CMAKE_BINARY_DIR}/soplex-config-version.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/soplex)