diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ INCLUDE(FindGhostscript) FIND_PACKAGE(GLPK 4.33) FIND_PACKAGE(CPLEX) +FIND_PACKAGE(COIN) ADD_DEFINITIONS(-DHAVE_CONFIG_H) diff --git a/cmake/FindCOIN.cmake b/cmake/FindCOIN.cmake new file mode 100644 --- /dev/null +++ b/cmake/FindCOIN.cmake @@ -0,0 +1,68 @@ +SET(COIN_ROOT_DIR "" CACHE PATH "COIN root directory") + +FIND_PATH(COIN_INCLUDE_DIR coin/CoinUtilsConfig.h + PATHS ${COIN_ROOT_DIR}/include) + +FIND_LIBRARY(COIN_CBC_LIBRARY libCbc + PATHS ${COIN_ROOT_DIR}/lib) +FIND_LIBRARY(COIN_CBC_SOLVER_LIBRARY libCbcSolver + PATHS ${COIN_ROOT_DIR}/lib) +FIND_LIBRARY(COIN_CGL_LIBRARY libCgl + PATHS ${COIN_ROOT_DIR}/lib) +FIND_LIBRARY(COIN_CLP_LIBRARY libClp + PATHS ${COIN_ROOT_DIR}/lib) +FIND_LIBRARY(COIN_COIN_UTILS_LIBRARY libCoinUtils + PATHS ${COIN_ROOT_DIR}/lib) +FIND_LIBRARY(COIN_OSI_LIBRARY libOsi + PATHS ${COIN_ROOT_DIR}/lib) +FIND_LIBRARY(COIN_OSI_CBC_LIBRARY libOsiCbc + PATHS ${COIN_ROOT_DIR}/lib) +FIND_LIBRARY(COIN_OSI_CLP_LIBRARY libOsiClp + PATHS ${COIN_ROOT_DIR}/lib) +FIND_LIBRARY(COIN_OSI_VOL_LIBRARY libOsiVol + PATHS ${COIN_ROOT_DIR}/lib) +FIND_LIBRARY(COIN_VOL_LIBRARY libVol + PATHS ${COIN_ROOT_DIR}/lib) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG + COIN_INCLUDE_DIR + COIN_CBC_LIBRARY + COIN_CBC_SOLVER_LIBRARY + COIN_CGL_LIBRARY + COIN_CLP_LIBRARY + COIN_COIN_UTILS_LIBRARY + COIN_OSI_LIBRARY + COIN_OSI_CBC_LIBRARY + COIN_OSI_CLP_LIBRARY + COIN_OSI_VOL_LIBRARY + COIN_VOL_LIBRARY +) + +IF(COIN_FOUND) + SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR}) + SET(COIN_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_OSI_VOL_LIBRARY};${COIN_VOL_LIBRARY}") + SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}") + SET(COIN_CBC_LIBRARIES ${COIN_LIBRARIES}) +ENDIF(COIN_FOUND) + +MARK_AS_ADVANCED( + COIN_INCLUDE_DIR + COIN_CBC_LIBRARY + COIN_CBC_SOLVER_LIBRARY + COIN_CGL_LIBRARY + COIN_CLP_LIBRARY + COIN_COIN_UTILS_LIBRARY + COIN_OSI_LIBRARY + COIN_OSI_CBC_LIBRARY + COIN_OSI_CLP_LIBRARY + COIN_OSI_VOL_LIBRARY + COIN_VOL_LIBRARY +) + +IF(COIN_FOUND) + SET(HAVE_LP TRUE) + SET(HAVE_MIP TRUE) + SET(HAVE_CLP TRUE) + SET(HAVE_CBC TRUE) +ENDIF(COIN_FOUND) diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt --- a/lemon/CMakeLists.txt +++ b/lemon/CMakeLists.txt @@ -33,6 +33,16 @@ INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS}) ENDIF(HAVE_CPLEX) +IF(HAVE_CLP) + SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc) + INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) +ENDIF(HAVE_CLP) + +IF(HAVE_CBC) + SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc) + INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS}) +ENDIF(HAVE_CBC) + ADD_LIBRARY(lemon ${LEMON_SOURCES}) INSTALL( diff --git a/lemon/config.h.cmake b/lemon/config.h.cmake --- a/lemon/config.h.cmake +++ b/lemon/config.h.cmake @@ -3,3 +3,5 @@ #cmakedefine HAVE_MIP 1 #cmakedefine HAVE_GLPK 1 #cmakedefine HAVE_CPLEX 1 +#cmakedefine HAVE_CLP 1 +#cmakedefine HAVE_CBC 1 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -45,6 +45,9 @@ IF(HAVE_CPLEX) SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES}) ENDIF(HAVE_CPLEX) + IF(HAVE_CLP) + SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES}) + ENDIF(HAVE_CLP) TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS}) ADD_TEST(lp_test lp_test) @@ -75,6 +78,9 @@ IF(HAVE_CPLEX) SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES}) ENDIF(HAVE_CPLEX) + IF(HAVE_CBC) + SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES}) + ENDIF(HAVE_CBC) TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS}) ADD_TEST(mip_test mip_test)