COIN-OR::LEMON - Graph Library

Ticket #256: 003-coin-cmake.patch

File 003-coin-cmake.patch, 4.0 KB (added by Akos Ladanyi, 16 years ago)

b536eaacb39b

  • CMakeLists.txt

    # HG changeset patch
    # User Akos Ladanyi <ladanyi@tmit.bme.hu>
    # Date 1240468240 -3600
    # Node ID b536eaacb39b5b109ea5653721241ddf90bdc372
    # Parent  c3ce597c11aecffef8499114b46a4879bd1b6cdd
    FindCOIN for CMake (#256)
    
    diff --git a/CMakeLists.txt b/CMakeLists.txt
    a b  
    1515INCLUDE(FindGhostscript)
    1616FIND_PACKAGE(GLPK 4.33)
    1717FIND_PACKAGE(CPLEX)
     18FIND_PACKAGE(COIN)
    1819
    1920ADD_DEFINITIONS(-DHAVE_CONFIG_H)
    2021
  • new file cmake/FindCOIN.cmake

    diff --git a/cmake/FindCOIN.cmake b/cmake/FindCOIN.cmake
    new file mode 100644
    - +  
     1SET(COIN_ROOT_DIR "" CACHE PATH "COIN root directory")
     2
     3FIND_PATH(COIN_INCLUDE_DIR coin/CoinUtilsConfig.h
     4  PATHS ${COIN_ROOT_DIR}/include)
     5
     6FIND_LIBRARY(COIN_CBC_LIBRARY libCbc
     7  PATHS ${COIN_ROOT_DIR}/lib)
     8FIND_LIBRARY(COIN_CBC_SOLVER_LIBRARY libCbcSolver
     9  PATHS ${COIN_ROOT_DIR}/lib)
     10FIND_LIBRARY(COIN_CGL_LIBRARY libCgl
     11  PATHS ${COIN_ROOT_DIR}/lib)
     12FIND_LIBRARY(COIN_CLP_LIBRARY libClp
     13  PATHS ${COIN_ROOT_DIR}/lib)
     14FIND_LIBRARY(COIN_COIN_UTILS_LIBRARY libCoinUtils
     15  PATHS ${COIN_ROOT_DIR}/lib)
     16FIND_LIBRARY(COIN_OSI_LIBRARY libOsi
     17  PATHS ${COIN_ROOT_DIR}/lib)
     18FIND_LIBRARY(COIN_OSI_CBC_LIBRARY libOsiCbc
     19  PATHS ${COIN_ROOT_DIR}/lib)
     20FIND_LIBRARY(COIN_OSI_CLP_LIBRARY libOsiClp
     21  PATHS ${COIN_ROOT_DIR}/lib)
     22FIND_LIBRARY(COIN_OSI_VOL_LIBRARY libOsiVol
     23  PATHS ${COIN_ROOT_DIR}/lib)
     24FIND_LIBRARY(COIN_VOL_LIBRARY libVol
     25  PATHS ${COIN_ROOT_DIR}/lib)
     26
     27INCLUDE(FindPackageHandleStandardArgs)
     28FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG
     29  COIN_INCLUDE_DIR
     30  COIN_CBC_LIBRARY
     31  COIN_CBC_SOLVER_LIBRARY
     32  COIN_CGL_LIBRARY
     33  COIN_CLP_LIBRARY
     34  COIN_COIN_UTILS_LIBRARY
     35  COIN_OSI_LIBRARY
     36  COIN_OSI_CBC_LIBRARY
     37  COIN_OSI_CLP_LIBRARY
     38  COIN_OSI_VOL_LIBRARY
     39  COIN_VOL_LIBRARY
     40)
     41
     42IF(COIN_FOUND)
     43  SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
     44  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}")
     45  SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY}")
     46  SET(COIN_CBC_LIBRARIES ${COIN_LIBRARIES})
     47ENDIF(COIN_FOUND)
     48
     49MARK_AS_ADVANCED(
     50  COIN_INCLUDE_DIR
     51  COIN_CBC_LIBRARY
     52  COIN_CBC_SOLVER_LIBRARY
     53  COIN_CGL_LIBRARY
     54  COIN_CLP_LIBRARY
     55  COIN_COIN_UTILS_LIBRARY
     56  COIN_OSI_LIBRARY
     57  COIN_OSI_CBC_LIBRARY
     58  COIN_OSI_CLP_LIBRARY
     59  COIN_OSI_VOL_LIBRARY
     60  COIN_VOL_LIBRARY
     61)
     62
     63IF(COIN_FOUND)
     64  SET(HAVE_LP TRUE)
     65  SET(HAVE_MIP TRUE)
     66  SET(HAVE_CLP TRUE)
     67  SET(HAVE_CBC TRUE)
     68ENDIF(COIN_FOUND)
  • lemon/CMakeLists.txt

    diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt
    a b  
    3333  INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS})
    3434ENDIF(HAVE_CPLEX)
    3535
     36IF(HAVE_CLP)
     37  SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc)
     38  INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
     39ENDIF(HAVE_CLP)
     40
     41IF(HAVE_CBC)
     42  SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc)
     43  INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
     44ENDIF(HAVE_CBC)
     45
    3646ADD_LIBRARY(lemon ${LEMON_SOURCES})
    3747
    3848INSTALL(
  • lemon/config.h.cmake

    diff --git a/lemon/config.h.cmake b/lemon/config.h.cmake
    a b  
    33#cmakedefine HAVE_MIP 1
    44#cmakedefine HAVE_GLPK 1
    55#cmakedefine HAVE_CPLEX 1
     6#cmakedefine HAVE_CLP 1
     7#cmakedefine HAVE_CBC 1
  • test/CMakeLists.txt

    diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
    a b  
    4545  IF(HAVE_CPLEX)
    4646    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    4747  ENDIF(HAVE_CPLEX)
     48  IF(HAVE_CLP)
     49    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
     50  ENDIF(HAVE_CLP)
    4851  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    4952  ADD_TEST(lp_test lp_test)
    5053
     
    7578  IF(HAVE_CPLEX)
    7679    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
    7780  ENDIF(HAVE_CPLEX)
     81  IF(HAVE_CBC)
     82    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
     83  ENDIF(HAVE_CBC)
    7884  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
    7985  ADD_TEST(mip_test mip_test)
    8086