Add cmake config to find SoPlex (#460)
authorAlpar Juttner <alpar@cs.elte.hu>
Thu, 28 Mar 2013 14:52:43 +0100
changeset 12644000b7ef4e01
parent 1262 dd1443e4a34c
child 1269 9eac00ea588f
Add cmake config to find SoPlex (#460)

Based on the patch sent by ax487
CMakeLists.txt
cmake/FindSOPLEX.cmake
lemon/CMakeLists.txt
lemon/config.h.in
test/CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Wed Aug 07 07:08:38 2013 +0200
     1.2 +++ b/CMakeLists.txt	Thu Mar 28 14:52:43 2013 +0100
     1.3 @@ -65,6 +65,7 @@
     1.4  SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
     1.5  SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.")
     1.6  SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.")
     1.7 +SET(LEMON_ENABLE_SOPLEX YES CACHE STRING "Enable SoPlex solver backend.")
     1.8  
     1.9  IF(LEMON_ENABLE_GLPK) 
    1.10    FIND_PACKAGE(GLPK 4.33)
    1.11 @@ -75,6 +76,9 @@
    1.12  IF(LEMON_ENABLE_COIN)
    1.13    FIND_PACKAGE(COIN)
    1.14  ENDIF(LEMON_ENABLE_COIN)
    1.15 +IF(LEMON_ENABLE_SOPLEX)
    1.16 +  FIND_PACKAGE(SOPLEX)
    1.17 +ENDIF(LEMON_ENABLE_SOPLEX)
    1.18  
    1.19  IF(GLPK_FOUND)
    1.20    SET(LEMON_HAVE_LP TRUE)
    1.21 @@ -92,6 +96,10 @@
    1.22    SET(LEMON_HAVE_CLP TRUE)
    1.23    SET(LEMON_HAVE_CBC TRUE)
    1.24  ENDIF(COIN_FOUND)
    1.25 +IF(SOPLEX_FOUND)
    1.26 +  SET(LEMON_HAVE_LP TRUE)
    1.27 +  SET(LEMON_HAVE_SOPLEX TRUE)
    1.28 +ENDIF(SOPLEX_FOUND)
    1.29  
    1.30  IF(ILOG_FOUND)
    1.31    SET(DEFAULT_LP "CPLEX")
    1.32 @@ -102,14 +110,17 @@
    1.33  ELSEIF(GLPK_FOUND)
    1.34    SET(DEFAULT_LP "GLPK")
    1.35    SET(DEFAULT_MIP "GLPK")
    1.36 +ELSEIF(SOPLEX_FOUND)
    1.37 +  SET(DEFAULT_LP "SOPLEX")
    1.38  ENDIF()
    1.39  
    1.40  IF(NOT LEMON_DEFAULT_LP OR
    1.41      (NOT ILOG_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX")) OR
    1.42      (NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP")) OR
    1.43 -    (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK")))
    1.44 +    (NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK")) OR
    1.45 +    (NOT SOPLEX_FOUND AND (LEMON_DEFAULT_LP STREQUAL "SOPLEX")))
    1.46    SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
    1.47 -    "Default LP solver backend (GLPK, CPLEX or CLP)" FORCE)
    1.48 +    "Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)" FORCE)
    1.49  ENDIF()
    1.50  IF(NOT LEMON_DEFAULT_MIP OR
    1.51      (NOT ILOG_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX")) OR
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/cmake/FindSOPLEX.cmake	Thu Mar 28 14:52:43 2013 +0100
     2.3 @@ -0,0 +1,23 @@
     2.4 +SET(SOPLEX_ROOT_DIR "" CACHE PATH "SoPlex root directory")
     2.5 +
     2.6 +FIND_PATH(SOPLEX_INCLUDE_DIR
     2.7 +  soplex.h
     2.8 +  HINTS ${SOPLEX_ROOT_DIR}/src
     2.9 +)
    2.10 +FIND_LIBRARY(SOPLEX_LIBRARY
    2.11 +  soplex
    2.12 +  HINTS ${SOPLEX_ROOT_DIR}/lib
    2.13 +)
    2.14 +
    2.15 +INCLUDE(FindPackageHandleStandardArgs)
    2.16 +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SOPLEX DEFAULT_MSG SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR)
    2.17 +
    2.18 +IF(SOPLEX_FOUND)
    2.19 +  SET(SOPLEX_INCLUDE_DIRS ${SOPLEX_INCLUDE_DIR})
    2.20 +  SET(SOPLEX_LIBRARIES ${SOPLEX_LIBRARY})
    2.21 +  IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    2.22 +    SET(SOPLEX_LIBRARIES "${SOPLEX_LIBRARIES};z")
    2.23 +  ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    2.24 +ENDIF(SOPLEX_FOUND)
    2.25 +
    2.26 +MARK_AS_ADVANCED(SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR)
     3.1 --- a/lemon/CMakeLists.txt	Wed Aug 07 07:08:38 2013 +0200
     3.2 +++ b/lemon/CMakeLists.txt	Thu Mar 28 14:52:43 2013 +0100
     3.3 @@ -49,6 +49,11 @@
     3.4    INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
     3.5  ENDIF()
     3.6  
     3.7 +IF(LEMON_HAVE_SOPLEX)
     3.8 +  SET(LEMON_SOURCES ${LEMON_SOURCES} soplex.cc)
     3.9 +  INCLUDE_DIRECTORIES(${SOPLEX_INCLUDE_DIRS})
    3.10 +ENDIF()
    3.11 +
    3.12  ADD_LIBRARY(lemon ${LEMON_SOURCES})
    3.13  IF(UNIX)
    3.14    SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon)
     4.1 --- a/lemon/config.h.in	Wed Aug 07 07:08:38 2013 +0200
     4.2 +++ b/lemon/config.h.in	Thu Mar 28 14:52:43 2013 +0100
     4.3 @@ -4,6 +4,7 @@
     4.4  #cmakedefine LEMON_HAVE_MIP 1
     4.5  #cmakedefine LEMON_HAVE_GLPK 1
     4.6  #cmakedefine LEMON_HAVE_CPLEX 1
     4.7 +#cmakedefine LEMON_HAVE_SOPLEX 1
     4.8  #cmakedefine LEMON_HAVE_CLP 1
     4.9  #cmakedefine LEMON_HAVE_CBC 1
    4.10  #cmakedefine LEMON_DEFAULT_LP @LEMON_DEFAULT_LP@
     5.1 --- a/test/CMakeLists.txt	Wed Aug 07 07:08:38 2013 +0200
     5.2 +++ b/test/CMakeLists.txt	Thu Mar 28 14:52:43 2013 +0100
     5.3 @@ -74,6 +74,9 @@
     5.4    IF(LEMON_HAVE_CLP)
     5.5      SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
     5.6    ENDIF()
     5.7 +  IF(LEMON_HAVE_SOPLEX)
     5.8 +    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${SOPLEX_LIBRARIES})
     5.9 +  ENDIF()
    5.10  
    5.11    TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    5.12    ADD_TEST(lp_test lp_test)