cmake: migrate to scip 10.0.0 and soplex 8.0.0

This commit is contained in:
Corentin Le Molgat
2025-12-01 14:56:45 +01:00
parent 91e63a7d41
commit 6555f4d2e4
4 changed files with 81 additions and 123 deletions

View File

@@ -10,7 +10,8 @@ Cgl=0.60.9
Cbc=2.10.12
GLPK=5.0
HiGHS=v1.12.0
Scip=v924
Scip=v10.0.0
Soplex=v8.0.0
# Python
pybind11=v2.13.6
pybind11_abseil=v202402.0

View File

@@ -353,11 +353,11 @@ if(BUILD_soplex)
FetchContent_Declare(
soplex
GIT_REPOSITORY "https://github.com/scipopt/soplex.git"
GIT_TAG "release-716"
GIT_TAG "v8.0.0"
GIT_SHALLOW TRUE
UPDATE_COMMAND git reset --hard
PATCH_COMMAND git apply --ignore-whitespace
"${CMAKE_CURRENT_LIST_DIR}/../../patches/soplex-v7.1.6.patch"
"${CMAKE_CURRENT_LIST_DIR}/../../patches/soplex-v8.0.0.patch"
)
set(SHARED ON CACHE BOOL "Soplex param" FORCE)
set(ZLIB ON CACHE BOOL "Soplex param" FORCE)
@@ -383,11 +383,11 @@ if(BUILD_SCIP)
FetchContent_Declare(
scip
GIT_REPOSITORY "https://github.com/scipopt/scip.git"
GIT_TAG "v924"
GIT_TAG "v10.0.0"
GIT_SHALLOW TRUE
UPDATE_COMMAND git reset --hard
PATCH_COMMAND git apply --ignore-whitespace
"${CMAKE_CURRENT_LIST_DIR}/../../patches/scip-v924.patch"
"${CMAKE_CURRENT_LIST_DIR}/../../patches/scip-v10.0.0.patch"
)
set(SHARED ON CACHE BOOL "Scip param" FORCE)
set(ZLIB ON CACHE BOOL "Scip param" FORCE)

View File

@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38917b8e..a8dff6e9 100644
index b3c57799..eeeca4c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,9 +38,11 @@ set(CPACK_PACKAGE_VENDOR "Zuse Institute Berlin")
@@ -52,9 +52,11 @@ set(CPACK_PACKAGE_VENDOR "Zuse Institute Berlin")
set(CPACK_PACKAGE_CONTACT "http://scipopt.org")
include(CPack)
@@ -17,34 +17,12 @@ index 38917b8e..a8dff6e9 100644
if(SCIPOptSuite_BINARY_DIR)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SCIPOptSuite_BINARY_DIR}/bin)
@@ -239,7 +241,7 @@ if(DEBUGSOL)
endif()
#set the correct rpath for OS X
-set(CMAKE_MACOSX_RPATH ON)
+set(CMAKE_MACOSX_RPATH TRUE)
#set defines for Windows
if(WIN32)
@@ -412,22 +414,11 @@ endif()
#search the selected LP solver library
@@ -517,10 +519,10 @@ endif()
message(STATUS "Finding Solver \"${LPS}\"")
if(LPS STREQUAL "spx")
- message(STATUS "Finding Soplex")
- find_package(SOPLEX CONFIG HINTS ${SOPLEX_DIR})
message(STATUS "Finding Soplex")
- find_package(SOPLEX REQUIRED 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()
@@ -52,63 +30,26 @@ index 38917b8e..a8dff6e9 100644
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)
@@ -593,11 +595,11 @@ 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_PIC_LIBRARIES ${SOPLEX_PIC_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()
+ set(LPS_PIC_LIBRARIES libsoplex-pic)
set(lpi lpi/lpi_spx.cpp)
else()
- message(STATUS "Support SOPLEX: OFF")
+ message(FATAL_ERROR "SOPLEX not found !")
endif()
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 be3760c4..b764f0b4 100644
index c6ce7283..6b6b1fc8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1115,6 +1115,13 @@ target_link_libraries(scip
@@ -1213,6 +1213,13 @@ target_link_libraries(scip
add_dependencies(libscip scip_update_githash)
add_dependencies(scip scip_update_githash)
@@ -120,10 +61,10 @@ index be3760c4..b764f0b4 100644
+ INSTALL_RPATH "$ORIGIN")
+endif()
set_target_properties(libscip PROPERTIES
VERSION ${SCIP_VERSION_MAJOR}.${SCIP_VERSION_MINOR}.${SCIP_VERSION_PATCH}.${SCIP_VERSION_SUB}
VERSION ${SCIP_VERSION_MAJOR}.${SCIP_VERSION_MINOR}.${SCIP_VERSION_PATCH}
SOVERSION ${SCIP_VERSION_MAJOR}.${SCIP_VERSION_MINOR}
@@ -1153,17 +1160,8 @@ install(TARGETS scip libscip EXPORT scip-targets
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
@@ -1265,17 +1272,8 @@ install(FILES ${PROJECT_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}
install(FILES ${PROJECT_SOURCE_DIR}/src/tclique/LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/licenses/scip/tclique)
# Add all targets to the build-tree export set
-export(TARGETS scip libscip
@@ -140,11 +81,11 @@ index be3760c4..b764f0b4 100644
+#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}")
@@ -1179,18 +1177,16 @@ ${PROJECT_BINARY_DIR}/scip-config-version.cmake
#configure the config file for the install
# Configure scip-config.cmake for the build-tree:
# We add the CMake module path from the sources.
@@ -1295,18 +1293,16 @@ ${PROJECT_BINARY_DIR}/scip-config-version.cmake
# We add the current directory of the installed scip-config.cmake as a CMake module path.
set(EXTRA_CMAKE_MODULE_PATH "\${CMAKE_CURRENT_LIST_DIR}")
set(CONF_INCLUDE_DIRS "\${CMAKE_CURRENT_LIST_DIR}/../../../include")
-if(SOPLEX_NEEDED)
- set(CONF_SOPLEX_DIR "\${CMAKE_CURRENT_LIST_DIR}/../soplex")

View File

@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 96aefab..760b0f8 100644
index 9511442..58a8a58 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,6 +27,10 @@ set(CPACK_PACKAGE_VERSION_PATCH "${SOPLEX_VERSION_PATCH}")
@@ -31,6 +31,10 @@ set(CPACK_PACKAGE_VERSION_PATCH "${SOPLEX_VERSION_PATCH}")
set(CPACK_PACKAGE_VENDOR "Zuse Institute Berlin")
include(CPack)
@@ -13,7 +13,7 @@ index 96aefab..760b0f8 100644
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
@@ -44,11 +48,17 @@ option(SANITIZE "should sanitizers be enabled if available" OFF)
option(COVERAGE "enable coverage support" OFF)
option(PAPILO "should papilo library be linked" ON)
@@ -34,12 +34,7 @@ index 96aefab..760b0f8 100644
# for colorized output
if(NOT WIN32)
@@ -65,10 +75,12 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
# set the correct rpath for OS X
-set(CMAKE_MACOSX_RPATH ON)
+set(CMAKE_MACOSX_RPATH TRUE)
@@ -70,6 +80,8 @@ set(CMAKE_MACOSX_RPATH ON)
# use C++14 standard
set(CMAKE_CXX_STANDARD 14)
@@ -48,7 +43,7 @@ index 96aefab..760b0f8 100644
# set function visibility default to hidden
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
@@ -123,12 +135,11 @@ if(COVERAGE)
@@ -124,12 +136,11 @@ if(COVERAGE)
endif()
if(ZLIB)
@@ -66,7 +61,7 @@ index 96aefab..760b0f8 100644
endif()
if(GMP)
@@ -170,39 +181,24 @@ else()
@@ -171,42 +182,24 @@ else()
set(SOPLEX_WITH_PAPILO off)
endif()
@@ -76,7 +71,6 @@ index 96aefab..760b0f8 100644
- 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()
@@ -89,11 +83,15 @@ index 96aefab..760b0f8 100644
- Found Boost version is ${Boost_VERSION_STRING}.")
- endif()
- endif()
- if(Boost_DIR)
- message(STATUS "Found Boost: ${Boost_DIR}")
- endif()
- set(libs ${libs} Boost::boost)
- 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")
- message(STATUS "SoPlex with Boost MPFR ${MPFR_VERSION} libraries")
- set(SOPLEX_WITH_MPFR on)
- include_directories(${MPFR_INCLUDE_DIRS})
- set(libs ${libs} ${MPFR_LIBRARIES})
@@ -123,7 +121,7 @@ index 96aefab..760b0f8 100644
endif()
# disable fused floating point contraction to enhance reproducibility across compilers and architectures
@@ -244,7 +240,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/soplex/config.h.in ${PROJECT_BINA
@@ -251,7 +244,7 @@ set(EXTRA_CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
configure_file(${PROJECT_SOURCE_DIR}/soplex-config.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/soplex-config.cmake" @ONLY)
add_subdirectory(src)
@@ -136,18 +134,18 @@ index 96aefab..760b0f8 100644
+ add_subdirectory(check)
+endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 16ffb17..b5a0b56 100644
index d57c5fe..11f914a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -193,25 +193,27 @@ target_link_libraries(libsoplexshared libsoplex ${libs})
@@ -193,28 +193,32 @@ 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})
-target_link_libraries(soplex LINK_PUBLIC libsoplex)
+if(SOPLEX_SOPLEX)
+ add_executable(soplex EXCLUDE_FROM_ALL soplexmain.cpp)
+ target_link_libraries(soplex PRIVATE libsoplex ${Boost_LIBRARIES})
+ add_executable(soplex soplexmain.cpp)
+ target_link_libraries(soplex LINK_PUBLIC libsoplex)
-if(EMSCRIPTEN AND EMSCRIPTEN_HTML)
+ if(EMSCRIPTEN AND EMSCRIPTEN_HTML)
@@ -159,40 +157,58 @@ index 16ffb17..b5a0b56 100644
+ # set the install rpath to the installed destination
+ set_target_properties(soplex PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
-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)
-if(SANITIZE)
+ if(SANITIZE)
find_package(Sanitizers)
add_sanitizers(libsoplex)
add_sanitizers(libsoplex-pic)
add_sanitizers(libsoplexshared)
add_sanitizers(soplex)
get_target_property(CONF_SANITIZE_FLAGS libsoplex SANITIZE_FLAGS)
-endif(SANITIZE)
-
-add_executable(example EXCLUDE_FROM_ALL example.cpp)
-target_link_libraries(example libsoplex)
+ endif(SANITIZE)
+endif()
-# 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 EXCLUDE_FROM_ALL 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)
install(FILES soplex.h soplex.hpp soplex_interface.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
@@ -237,15 +239,23 @@ install(FILES
DESTINATION include/soplex/external/zstr)
@@ -243,14 +247,23 @@ install(FILES
install(FILES ${PROJECT_SOURCE_DIR}/src/soplex/external/zstr/License.txt DESTINATION ${CMAKE_INSTALL_DATADIR}/licenses/soplex/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
+ install(TARGETS soplex EXPORT soplex-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+ if(MSVC)
+ install(FILES $<TARGET_PDB_FILE:soplex> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
+ endif()
+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})
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(MSVC)
- install(FILES $<TARGET_PDB_FILE:libsoplexshared> $<TARGET_PDB_FILE:soplex> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
+ install(FILES $<TARGET_PDB_FILE:libsoplexshared> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
endif()
# install license files of soplex and fmt
@@ -258,8 +271,10 @@ install(FILES ${PROJECT_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}
install(FILES ${PROJECT_SOURCE_DIR}/src/soplex/external/fmt/LICENSE.rst DESTINATION ${CMAKE_INSTALL_DATADIR}/licenses/soplex/fmt)
# Add library targets to the build-tree export set
-export(TARGETS libsoplex libsoplex-pic libsoplexshared