Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v91-bugfix' into v9-minor
Browse files Browse the repository at this point in the history
  • Loading branch information
scip-ci committed Oct 15, 2024
2 parents 5d215fb + 9c8cdf2 commit 968b003
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Build system

### Cmake

- attempted to fix detection of CPLEX library on macOS and Windows systems

### Makefile

Miscellaneous
Expand Down
30 changes: 30 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,9 @@ if(LPS STREQUAL "spx")
COMPONENTS soplex)
find_package(SOPLEX REQUIRED CONFIG HINTS _deps/local)
endif()
if(NOT SOPLEX_FOUND)
message(FATAL_ERROR "Requested LP solver SoPlex not found.")
endif()
if (DEFINED SOPLEX_WITH_PAPILO)
message(STATUS "SOPLEX links PAPILO")
if((NOT SCIP_WITH_PAPILO)) # TODO not sure how to handle AUTOBUILD
Expand All @@ -435,29 +438,56 @@ if(LPS STREQUAL "spx")
endif ()
if(LPSCHECK)
find_package(CPLEX REQUIRED)
if(NOT CPLEX_FOUND)
message(FATAL_ERROR "Requested LP check solver CPLEX not found.")
endif()
set(SCIP_WITH_LPSCHECK on)
endif()
elseif(LPS STREQUAL "cpx")
find_package(CPLEX REQUIRED)
if(NOT CPLEX_FOUND)
message(FATAL_ERROR "Requested LP solver CPLEX not found.")
endif()
elseif(LPS STREQUAL "glop")
if(NOT TPI STREQUAL "tny")
message(FATAL_ERROR "When using GLOP as an lp solver, TPI needs to be set to 'tny'.")
endif()
find_package(GLOP REQUIRED)
if(NOT GLOP_FOUND)
message(FATAL_ERROR "Requested LP solver Glop not found.")
endif()
elseif(LPS STREQUAL "grb")
find_package(GUROBI REQUIRED)
if(NOT GUROBI_FOUND)
message(FATAL_ERROR "Requested LP solver Gurobi not found.")
endif()
elseif(LPS STREQUAL "qso")
find_package(QSO REQUIRED)
if(NOT QSO_FOUND)
message(FATAL_ERROR "Requested LP solver Qsopt not found.")
endif()
set(BUILD_SHARED_LIBS off)
message(STATUS "Turning off shared libraries.")
elseif(LPS STREQUAL "clp")
find_package(CLP REQUIRED)
if(NOT CLP_FOUND)
message(FATAL_ERROR "Requested LP solver CLP not found.")
endif()
elseif(LPS STREQUAL "xprs")
find_package(XPRESS REQUIRED)
if(NOT XPRESS_FOUND)
message(FATAL_ERROR "Requested LP solver XPRESS not found.")
endif()
elseif(LPS STREQUAL "msk")
find_package(MOSEK REQUIRED)
if(NOT MOSEK_FOUND)
message(FATAL_ERROR "Requested LP solver MOSEK not found.")
endif()
elseif(LPS STREQUAL "highs")
find_package(HIGHS REQUIRED CONFIG)
if(NOT HIGHS_FOUND)
message(FATAL_ERROR "Requested LP solver HiGHS not found.")
endif()
find_package(Threads REQUIRED)
find_package(OpenMP)
if(OPENMP_FOUND)
Expand Down
64 changes: 55 additions & 9 deletions cmake/Modules/FindCPLEX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,60 @@ find_path(CPLEX_INCLUDE_DIRS
HINTS ${CPLEX_DIR} $ENV{CPLEX_DIR}
PATH_SUFFIXES include/ilcplex include)

# todo: enable recursive search
find_library(CPLEX_LIBRARY
NAMES cplex
HINTS ${CPLEX_DIR} $ENV{CPLEX_DIR}
PATH_SUFFIXES lib/x86-64_linux/static_pic lib)
if(MSVC)
string(REGEX REPLACE "/VC/bin/.*" "" VISUAL_STUDIO_PATH ${CMAKE_CXX_COMPILER})
string(REGEX MATCH "Studio/[0-9]+/" CPLEX_WIN_VS_VERSION ${VISUAL_STUDIO_PATH})
string(REGEX REPLACE "Studio/" "" CPLEX_WIN_VS_VERSION ${CPLEX_WIN_VS_VERSION})
string(REGEX REPLACE "/" "" CPLEX_WIN_VS_VERSION ${CPLEX_WIN_VS_VERSION})

if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
if(MT)
set(CPLEX_WIN_RUNTIME mtd)
else(MT)
set(CPLEX_WIN_RUNTIME mta)
endif(MT)
else()
if(MT)
set(CPLEX_WIN_RUNTIME mdd)
else(MT)
set(CPLEX_WIN_RUNTIME mda)
endif(MT)
endif()

find_library(CPLEX_LIBRARY
NAMES cplex2212 cplex2211 cplex2210 cplex2010 cplex
HINTS ${CPLEX_DIR} $ENV{CPLEX_DIR}
PATH_SUFFIXES lib/x64_windows_vs${CPLEX_WIN_VS_VERSION}/stat_${CPLEX_WIN_RUNTIME})

if(CPLEX_LIBRARY)
set(CPLEX_LIBRARIES ${CPLEX_LIBRARY})
endif()

else(MSVC)
if(CMAKE_OSX_ARCHITECTURES)
set(CPLEX_ARCH ${CMAKE_OSX_ARCHITECTURES})
else()
set(CPLEX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
endif()
if(CPLEX_ARCH STREQUAL "x86_64")
set(CPLEX_ARCH "x86-64")
endif()

find_library(CPLEX_LIBRARY
NAMES cplex
HINTS ${CPLEX_DIR} $ENV{CPLEX_DIR}
PATH_SUFFIXES lib/${CPLEX_ARCH}_linux/static_pic
lib/${CPLEX_ARCH}_osx/static_pic
lib)

if(CPLEX_LIBRARY)
# todo properly check when pthread and dl is necessary
set(CPLEX_LIBRARIES ${CPLEX_LIBRARY} pthread ${CMAKE_DL_LIBS})
endif()

# todo properly check when pthread is necessary
set(CPLEX_LIBRARIES ${CPLEX_LIBRARY} pthread ${CMAKE_DL_LIBS})
endif(MSVC)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CPLEX DEFAULT_MSG CPLEX_INCLUDE_DIRS CPLEX_LIBRARIES)
if(CPLEX_INCLUDE_DIRS AND CPLEX_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CPLEX DEFAULT_MSG CPLEX_INCLUDE_DIRS CPLEX_LIBRARIES)
endif()

0 comments on commit 968b003

Please sign in to comment.