Better CPLEX discovery (#446)
authorAlpar Juttner <alpar@cs.elte.hu>
Sat, 21 Jul 2012 10:18:57 +0200 (2012-07-21)
changeset 1062caf16813b1e8
parent 1017 b4f4c08e1210
child 1063 1782aa72495a
Better CPLEX discovery (#446)
CMakeLists.txt
INSTALL
cmake/FindCPLEX.cmake
cmake/FindGLPK.cmake
cmake/FindILOG.cmake
lemon/CMakeLists.txt
test/CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Sun Feb 24 19:44:14 2013 +0100
     1.2 +++ b/CMakeLists.txt	Sat Jul 21 10:18:57 2012 +0200
     1.3 @@ -62,7 +62,7 @@
     1.4  FIND_PACKAGE(Doxygen)
     1.5  FIND_PACKAGE(Ghostscript)
     1.6  FIND_PACKAGE(GLPK 4.33)
     1.7 -FIND_PACKAGE(CPLEX)
     1.8 +FIND_PACKAGE(ILOG)
     1.9  FIND_PACKAGE(COIN)
    1.10  
    1.11  IF(DEFINED ENV{LEMON_CXX_WARNING})
     2.1 --- a/INSTALL	Sun Feb 24 19:44:14 2013 +0100
     2.2 +++ b/INSTALL	Sat Jul 21 10:18:57 2012 +0200
     2.3 @@ -108,7 +108,7 @@
     2.4  
     2.5  -DGLPK_ROOT_DIR=DIRECTORY
     2.6  -DCOIN_ROOT_DIR=DIRECTORY
     2.7 --DCPLEX_ROOT_DIR=DIRECTORY
     2.8 +-DILOG_ROOT_DIR=DIRECTORY
     2.9  
    2.10    Install root directory prefixes of optional third party libraries.
    2.11  
     3.1 --- a/cmake/FindCPLEX.cmake	Sun Feb 24 19:44:14 2013 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,40 +0,0 @@
     3.4 -SET(CPLEX_ROOT_DIR "" CACHE PATH "CPLEX root directory")
     3.5 -
     3.6 -FIND_PATH(CPLEX_INCLUDE_DIR
     3.7 -  ilcplex/cplex.h
     3.8 -  PATHS "C:/ILOG/CPLEX/include"
     3.9 -  PATHS "/opt/ilog/cplex/include"
    3.10 -  HINTS ${CPLEX_ROOT_DIR}/include
    3.11 -)
    3.12 -FIND_LIBRARY(CPLEX_LIBRARY
    3.13 -  cplex
    3.14 -  PATHS "C:/ILOG/CPLEX/lib/msvc7/stat_mda"
    3.15 -  PATHS "/opt/ilog/cplex/bin"
    3.16 -  HINTS ${CPLEX_ROOT_DIR}/bin
    3.17 -  HINTS ${CPLEX_ROOT_DIR}/lib
    3.18 -)
    3.19 -
    3.20 -INCLUDE(FindPackageHandleStandardArgs)
    3.21 -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPLEX DEFAULT_MSG CPLEX_LIBRARY CPLEX_INCLUDE_DIR)
    3.22 -
    3.23 -FIND_PATH(CPLEX_BIN_DIR
    3.24 -  cplex.dll
    3.25 -  PATHS "C:/ILOG/CPLEX/bin/x86_win32"
    3.26 -  HINTS ${CPLEX_ROOT_DIR}/bin
    3.27 -)
    3.28 -
    3.29 -IF(CPLEX_FOUND)
    3.30 -  SET(CPLEX_INCLUDE_DIRS ${CPLEX_INCLUDE_DIR})
    3.31 -  SET(CPLEX_LIBRARIES ${CPLEX_LIBRARY})
    3.32 -  IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    3.33 -    SET(CPLEX_LIBRARIES "${CPLEX_LIBRARIES};m;pthread")
    3.34 -  ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    3.35 -ENDIF(CPLEX_FOUND)
    3.36 -
    3.37 -MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_BIN_DIR)
    3.38 -
    3.39 -IF(CPLEX_FOUND)
    3.40 -  SET(LEMON_HAVE_LP TRUE)
    3.41 -  SET(LEMON_HAVE_MIP TRUE)
    3.42 -  SET(LEMON_HAVE_CPLEX TRUE)
    3.43 -ENDIF(CPLEX_FOUND)
     4.1 --- a/cmake/FindGLPK.cmake	Sun Feb 24 19:44:14 2013 +0100
     4.2 +++ b/cmake/FindGLPK.cmake	Sat Jul 21 10:18:57 2012 +0200
     4.3 @@ -59,3 +59,4 @@
     4.4    SET(LEMON_HAVE_MIP TRUE)
     4.5    SET(LEMON_HAVE_GLPK TRUE)
     4.6  ENDIF(GLPK_FOUND)
     4.7 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/cmake/FindILOG.cmake	Sat Jul 21 10:18:57 2012 +0200
     5.3 @@ -0,0 +1,108 @@
     5.4 +FIND_PATH(ILOG_ROOT_DIR
     5.5 +  NAMES cplex
     5.6 +  DOC "CPLEX STUDIO root directory"
     5.7 +  PATHS /opt/ibm/ILOG /usr/local/ibm/ILOG /usr/local/ILOG /usr/local/ilog
     5.8 +  PATHS "$ENV{HOME}/ILOG" "$ENV{HOME}/.local/ILOG"
     5.9 +  PATHS "$ENV{HOME}/ibm/ILOG" "$ENV{HOME}/.local/ibm/ILOG"
    5.10 +  PATHS "C:/Program Files/IBM/ILOG" 
    5.11 +  PATH_SUFFIXES "CPLEX_Studio126" "CPLEX_Studio125"
    5.12 +  "CPLEX_Studio124" "CPLEX_Studio123" "CPLEX_Studio122"
    5.13 +  NO_DEFAULT_PATH
    5.14 +)
    5.15 +
    5.16 +IF(WIN32)
    5.17 +  IF(MSVC_VERSION STREQUAL "1400")
    5.18 +    SET(ILOG_WIN_COMPILER "windows_vs2005")
    5.19 +  ELSEIF(MSVC_VERSION STREQUAL "1500")
    5.20 +    SET(ILOG_WIN_COMPILER "windows_vs2008")
    5.21 +  ELSEIF(MSVC_VERSION STREQUAL "1600")
    5.22 +    SET(ILOG_WIN_COMPILER "windows_vs2010")
    5.23 +  ELSE()
    5.24 +    SET(ILOG_WIN_COMPILER "windows_vs2008")
    5.25 +  ENDIF()
    5.26 +  IF(CMAKE_CL_64)
    5.27 +    SET(ILOG_WIN_COMPILER "x64_${ILOG_WIN_COMPILER}")
    5.28 +    SET(ILOG_WIN_PLATFORM "x64_win32")
    5.29 +  ELSE()
    5.30 +    SET(ILOG_WIN_COMPILER "x86_${ILOG_WIN_COMPILER}")
    5.31 +    SET(ILOG_WIN_PLATFORM "x86_win32")
    5.32 +  ENDIF()
    5.33 +ENDIF()
    5.34 +
    5.35 +FIND_PATH(ILOG_CPLEX_ROOT_DIR
    5.36 +  NAMES include/ilcplex
    5.37 +  HINTS ${ILOG_ROOT_DIR}/cplex ${ILOG_ROOT_DIR}/cplex121
    5.38 +  ${ILOG_ROOT_DIR}/cplex122 ${ILOG_ROOT_DIR}/cplex123
    5.39 +  DOC "CPLEX root directory"
    5.40 +  NO_DEFAULT_PATH
    5.41 +)
    5.42 +
    5.43 +FIND_PATH(ILOG_CONCERT_ROOT_DIR
    5.44 +  NAMES include/ilconcert
    5.45 +  HINTS ${ILOG_ROOT_DIR}/concert ${ILOG_ROOT_DIR}/concert29
    5.46 +  DOC "CONCERT root directory"
    5.47 +  NO_DEFAULT_PATH
    5.48 +)
    5.49 +
    5.50 +FIND_PATH(ILOG_CPLEX_INCLUDE_DIR
    5.51 +  ilcplex/cplex.h
    5.52 +  HINTS ${ILOG_CPLEX_ROOT_DIR}/include
    5.53 +  NO_DEFAULT_PATH
    5.54 +)
    5.55 +
    5.56 +FIND_PATH(ILOG_CONCERT_INCLUDE_DIR
    5.57 +  ilconcert/ilobasic.h
    5.58 +  HINTS ${ILOG_CONCERT_ROOT_DIR}/include
    5.59 +  NO_DEFAULT_PATH
    5.60 +)
    5.61 +
    5.62 +FIND_LIBRARY(ILOG_CPLEX_LIBRARY
    5.63 +  cplex cplex121 cplex122 cplex123 cplex124
    5.64 +  HINTS ${ILOG_CPLEX_ROOT_DIR}/lib/x86_sles10_4.1/static_pic
    5.65 +  ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
    5.66 +  ${ILOG_CPLEX_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
    5.67 +  ${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
    5.68 +  ${ILOG_CPLEX_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
    5.69 +  NO_DEFAULT_PATH
    5.70 +  )
    5.71 +
    5.72 +FIND_LIBRARY(ILOG_CONCERT_LIBRARY
    5.73 +  concert
    5.74 +  HINTS ${ILOG_CONCERT_ROOT_DIR}/lib/x86_sles10_4.1/static_pic
    5.75 +  ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
    5.76 +  ${ILOG_CONCERT_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
    5.77 +  ${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
    5.78 +  ${ILOG_CONCERT_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
    5.79 +  NO_DEFAULT_PATH
    5.80 +  )
    5.81 +
    5.82 +FIND_FILE(ILOG_CPLEX_DLL
    5.83 +  cplex121.dll cplex122.dll cplex123.dll cplex124.dll
    5.84 +  HINTS ${ILOG_CPLEX_ROOT_DIR}/bin/${ILOG_WIN_PLATFORM}
    5.85 +  NO_DEFAULT_PATH
    5.86 +  )
    5.87 +
    5.88 +INCLUDE(FindPackageHandleStandardArgs)
    5.89 +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ILOG
    5.90 +  DEFAULT_MSG ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR
    5.91 +  )
    5.92 +
    5.93 +IF(ILOG_FOUND)
    5.94 +  SET(ILOG_INCLUDE_DIRS ${ILOG_CPLEX_INCLUDE_DIR} ${ILOG_CONCERT_INCLUDE_DIR})
    5.95 +  SET(ILOG_LIBRARIES ${ILOG_CPLEX_LIBRARY} ${ILOG_CONCERT_LIBRARY})
    5.96 +  IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    5.97 +    # SET(CPLEX_LIBRARIES "${CPLEX_LIBRARIES};m;pthread")
    5.98 +    SET(ILOG_LIBRARIES ${ILOG_LIBRARIES} "m" "pthread")
    5.99 +  ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
   5.100 +ENDIF(ILOG_FOUND)
   5.101 +
   5.102 +MARK_AS_ADVANCED(
   5.103 +  ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR ILOG_CPLEX_DLL
   5.104 +  ILOG_CONCERT_LIBRARY ILOG_CONCERT_INCLUDE_DIR ILOG_CONCERT_DLL
   5.105 +  )
   5.106 +
   5.107 +IF(ILOG_FOUND)
   5.108 +  SET(LEMON_HAVE_LP TRUE)
   5.109 +  SET(LEMON_HAVE_MIP TRUE)
   5.110 +  SET(LEMON_HAVE_CPLEX TRUE)
   5.111 +ENDIF(ILOG_FOUND)
     6.1 --- a/lemon/CMakeLists.txt	Sun Feb 24 19:44:14 2013 +0100
     6.2 +++ b/lemon/CMakeLists.txt	Sat Jul 21 10:18:57 2012 +0200
     6.3 @@ -36,7 +36,7 @@
     6.4  
     6.5  IF(LEMON_HAVE_CPLEX)
     6.6    SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
     6.7 -  INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS})
     6.8 +  INCLUDE_DIRECTORIES(${ILOG_INCLUDE_DIRS})
     6.9  ENDIF()
    6.10  
    6.11  IF(LEMON_HAVE_CLP)
     7.1 --- a/test/CMakeLists.txt	Sun Feb 24 19:44:14 2013 +0100
     7.2 +++ b/test/CMakeLists.txt	Sat Jul 21 10:18:57 2012 +0200
     7.3 @@ -66,7 +66,7 @@
     7.4      SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
     7.5    ENDIF()
     7.6    IF(LEMON_HAVE_CPLEX)
     7.7 -    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
     7.8 +    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${ILOG_LIBRARIES})
     7.9    ENDIF()
    7.10    IF(LEMON_HAVE_CLP)
    7.11      SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    7.12 @@ -90,7 +90,7 @@
    7.13      GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    7.14      GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    7.15      ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    7.16 -      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
    7.17 +      COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}
    7.18      )
    7.19    ENDIF()
    7.20  ENDIF()
    7.21 @@ -108,7 +108,7 @@
    7.22      SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
    7.23    ENDIF()
    7.24    IF(LEMON_HAVE_CPLEX)
    7.25 -    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
    7.26 +    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${ILOG_LIBRARIES})
    7.27    ENDIF()
    7.28    IF(LEMON_HAVE_CBC)
    7.29      SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
    7.30 @@ -132,7 +132,7 @@
    7.31      GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
    7.32      GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    7.33      ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
    7.34 -      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
    7.35 +      COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}
    7.36      )
    7.37    ENDIF()
    7.38  ENDIF()