gravatar
ladanyi@tmit.bme.hu
ladanyi@tmit.bme.hu
FindCOIN for CMake (#256)
0 4 1
default
5 files changed with 87 insertions and 0 deletions:
↑ Collapse diff ↑
Ignore white space 384 line context
1
SET(COIN_ROOT_DIR "" CACHE PATH "COIN root directory")
2

	
3
FIND_PATH(COIN_INCLUDE_DIR coin/CoinUtilsConfig.h
4
  PATHS ${COIN_ROOT_DIR}/include)
5

	
6
FIND_LIBRARY(COIN_CBC_LIBRARY libCbc
7
  PATHS ${COIN_ROOT_DIR}/lib)
8
FIND_LIBRARY(COIN_CBC_SOLVER_LIBRARY libCbcSolver
9
  PATHS ${COIN_ROOT_DIR}/lib)
10
FIND_LIBRARY(COIN_CGL_LIBRARY libCgl
11
  PATHS ${COIN_ROOT_DIR}/lib)
12
FIND_LIBRARY(COIN_CLP_LIBRARY libClp
13
  PATHS ${COIN_ROOT_DIR}/lib)
14
FIND_LIBRARY(COIN_COIN_UTILS_LIBRARY libCoinUtils
15
  PATHS ${COIN_ROOT_DIR}/lib)
16
FIND_LIBRARY(COIN_OSI_LIBRARY libOsi
17
  PATHS ${COIN_ROOT_DIR}/lib)
18
FIND_LIBRARY(COIN_OSI_CBC_LIBRARY libOsiCbc
19
  PATHS ${COIN_ROOT_DIR}/lib)
20
FIND_LIBRARY(COIN_OSI_CLP_LIBRARY libOsiClp
21
  PATHS ${COIN_ROOT_DIR}/lib)
22
FIND_LIBRARY(COIN_OSI_VOL_LIBRARY libOsiVol
23
  PATHS ${COIN_ROOT_DIR}/lib)
24
FIND_LIBRARY(COIN_VOL_LIBRARY libVol
25
  PATHS ${COIN_ROOT_DIR}/lib)
26

	
27
INCLUDE(FindPackageHandleStandardArgs)
28
FIND_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

	
42
IF(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})
47
ENDIF(COIN_FOUND)
48

	
49
MARK_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

	
63
IF(COIN_FOUND)
64
  SET(HAVE_LP TRUE)
65
  SET(HAVE_MIP TRUE)
66
  SET(HAVE_CLP TRUE)
67
  SET(HAVE_CBC TRUE)
68
ENDIF(COIN_FOUND)
Ignore white space 6 line context
1 1
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 2

	
3 3
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
4 4
  INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake)
5 5
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
6 6
  SET(PROJECT_NAME "LEMON")
7 7
  SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.")
8 8
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
9 9

	
10 10
PROJECT(${PROJECT_NAME})
11 11

	
12 12
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
13 13

	
14 14
INCLUDE(FindDoxygen)
15 15
INCLUDE(FindGhostscript)
16 16
FIND_PACKAGE(GLPK 4.33)
17 17
FIND_PACKAGE(CPLEX)
18
FIND_PACKAGE(COIN)
18 19

	
19 20
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
20 21

	
21 22
IF(MSVC)
22 23
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4800 /wd4996")
23 24
# Suppressed warnings:
24 25
# C4250: 'class1' : inherits 'class2::member' via dominance
25 26
# C4355: 'this' : used in base member initializer list
26 27
# C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
27 28
# C4996: 'function': was declared deprecated
28 29
ENDIF(MSVC)
29 30

	
30 31
INCLUDE(CheckTypeSize)
31 32
CHECK_TYPE_SIZE("long long" LONG_LONG)
32 33

	
33 34
ENABLE_TESTING()
34 35

	
35 36
ADD_SUBDIRECTORY(lemon)
36 37
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
37 38
  ADD_SUBDIRECTORY(demo)
38 39
  ADD_SUBDIRECTORY(tools)
39 40
  ADD_SUBDIRECTORY(doc)
40 41
  ADD_SUBDIRECTORY(test)
41 42
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
42 43

	
43 44
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
44 45
  IF(WIN32)
45 46
    SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
46 47
    SET(CPACK_PACKAGE_VENDOR "EGRES")
47 48
    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
48 49
      "LEMON - Library of Efficient Models and Optimization in Networks")
49 50
    SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
50 51

	
51 52
    SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
52 53

	
53 54
    SET(CPACK_PACKAGE_INSTALL_DIRECTORY
54 55
      "${PROJECT_NAME} ${PROJECT_VERSION}")
55 56
    SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
56 57
      "${PROJECT_NAME} ${PROJECT_VERSION}")
57 58

	
58 59
    SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
59 60

	
60 61
    SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
61 62
    SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
62 63
    SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
63 64
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
64 65

	
65 66
    SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
66 67
      "C++ header files")
67 68
    SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
68 69
      "DLL and import library")
69 70
    SET(CPACK_COMPONENT_BIN_DESCRIPTION
70 71
      "Command line utilities")
71 72
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
72 73
      "Doxygen generated documentation")
73 74

	
74 75
    SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
75 76

	
76 77
    SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
77 78
    SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
78 79
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
79 80

	
80 81
    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
81 82
      "Components needed to develop software using LEMON")
82 83
    SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
83 84
      "Documentation of LEMON")
84 85

	
85 86
    SET(CPACK_ALL_INSTALL_TYPES Full Developer)
86 87

	
87 88
    SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
88 89
    SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
89 90
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
90 91

	
91 92
    SET(CPACK_GENERATOR "NSIS")
92 93
    SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
93 94
    SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
94 95
    #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
95 96
    SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
96 97
    SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
97 98
    SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
98 99
    SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
99 100
    SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
100 101
    SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
101 102
      CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
102 103
      ")
103 104
    SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
104 105
      !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
105 106
      Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
106 107
      ")
107 108

	
108 109
    INCLUDE(CPack)
109 110
  ENDIF(WIN32)
110 111
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
Ignore white space 6 line context
1 1
INCLUDE_DIRECTORIES(
2 2
  ${PROJECT_SOURCE_DIR}
3 3
  ${PROJECT_BINARY_DIR}
4 4
)
5 5

	
6 6
CONFIGURE_FILE(
7 7
  ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
8 8
  ${CMAKE_CURRENT_BINARY_DIR}/config.h
9 9
)
10 10

	
11 11
SET(LEMON_SOURCES
12 12
  arg_parser.cc
13 13
  base.cc
14 14
  color.cc
15 15
  lp_base.cc
16 16
  lp_skeleton.cc
17 17
  random.cc
18 18
  bits/windows.cc
19 19
)
20 20

	
21 21
IF(HAVE_GLPK)
22 22
  SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
23 23
  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIRS})
24 24
  IF(WIN32)
25 25
    INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
26 26
    INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin)
27 27
    INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin)
28 28
  ENDIF(WIN32)
29 29
ENDIF(HAVE_GLPK)
30 30

	
31 31
IF(HAVE_CPLEX)
32 32
  SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
33 33
  INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS})
34 34
ENDIF(HAVE_CPLEX)
35 35

	
36
IF(HAVE_CLP)
37
  SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc)
38
  INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
39
ENDIF(HAVE_CLP)
40

	
41
IF(HAVE_CBC)
42
  SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc)
43
  INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
44
ENDIF(HAVE_CBC)
45

	
36 46
ADD_LIBRARY(lemon ${LEMON_SOURCES})
37 47

	
38 48
INSTALL(
39 49
  TARGETS lemon
40 50
  ARCHIVE DESTINATION lib
41 51
  COMPONENT library)
42 52

	
43 53
INSTALL(
44 54
  DIRECTORY . bits concepts
45 55
  DESTINATION include/lemon
46 56
  COMPONENT headers
47 57
  FILES_MATCHING PATTERN "*.h")
Ignore white space 6 line context
1 1
#cmakedefine HAVE_LONG_LONG 1
2 2
#cmakedefine HAVE_LP 1
3 3
#cmakedefine HAVE_MIP 1
4 4
#cmakedefine HAVE_GLPK 1
5 5
#cmakedefine HAVE_CPLEX 1
6
#cmakedefine HAVE_CLP 1
7
#cmakedefine HAVE_CBC 1
Ignore white space 6 line context
1 1
INCLUDE_DIRECTORIES(
2 2
  ${PROJECT_SOURCE_DIR}
3 3
  ${PROJECT_BINARY_DIR}
4 4
)
5 5

	
6 6
LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon)
7 7

	
8 8
SET(TESTS
9 9
  adaptors_test
10 10
  bfs_test
11 11
  circulation_test
12 12
  counter_test
13 13
  dfs_test
14 14
  digraph_test
15 15
  dijkstra_test
16 16
  dim_test
17 17
  edge_set_test
18 18
  error_test
19 19
  euler_test
20 20
  gomory_hu_test
21 21
  graph_copy_test
22 22
  graph_test
23 23
  graph_utils_test
24 24
  hao_orlin_test
25 25
  heap_test
26 26
  kruskal_test
27 27
  maps_test
28 28
  matching_test
29 29
  min_cost_arborescence_test
30 30
  min_cost_flow_test
31 31
  path_test
32 32
  preflow_test
33 33
  radix_sort_test
34 34
  random_test
35 35
  suurballe_test
36 36
  time_measure_test
37 37
  unionfind_test)
38 38

	
39 39
IF(HAVE_LP)
40 40
  ADD_EXECUTABLE(lp_test lp_test.cc)
41 41
  SET(LP_TEST_LIBS lemon)
42 42
  IF(HAVE_GLPK)
43 43
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
44 44
  ENDIF(HAVE_GLPK)
45 45
  IF(HAVE_CPLEX)
46 46
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
47 47
  ENDIF(HAVE_CPLEX)
48
  IF(HAVE_CLP)
49
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
50
  ENDIF(HAVE_CLP)
48 51
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
49 52
  ADD_TEST(lp_test lp_test)
50 53

	
51 54
  IF(WIN32 AND HAVE_GLPK)
52 55
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
53 56
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
54 57
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
55 58
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
56 59
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
57 60
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
58 61
    )
59 62
  ENDIF(WIN32 AND HAVE_GLPK)
60 63
  IF(WIN32 AND HAVE_CPLEX)
61 64
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
62 65
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
63 66
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
64 67
      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
65 68
    )
66 69
  ENDIF(WIN32 AND HAVE_CPLEX)
67 70
ENDIF(HAVE_LP)
68 71

	
69 72
IF(HAVE_MIP)
70 73
  ADD_EXECUTABLE(mip_test mip_test.cc)
71 74
  SET(MIP_TEST_LIBS lemon)
72 75
  IF(HAVE_GLPK)
73 76
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
74 77
  ENDIF(HAVE_GLPK)
75 78
  IF(HAVE_CPLEX)
76 79
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
77 80
  ENDIF(HAVE_CPLEX)
81
  IF(HAVE_CBC)
82
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
83
  ENDIF(HAVE_CBC)
78 84
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
79 85
  ADD_TEST(mip_test mip_test)
80 86

	
81 87
  IF(WIN32 AND HAVE_GLPK)
82 88
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
83 89
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
84 90
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
85 91
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
86 92
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
87 93
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
88 94
    )
89 95
  ENDIF(WIN32 AND HAVE_GLPK)
90 96
  IF(WIN32 AND HAVE_CPLEX)
91 97
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
92 98
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
93 99
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
94 100
      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
95 101
    )
96 102
  ENDIF(WIN32 AND HAVE_CPLEX)
97 103
ENDIF(HAVE_MIP)
98 104

	
99 105
FOREACH(TEST_NAME ${TESTS})
100 106
  ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
101 107
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
102 108
  ADD_TEST(${TEST_NAME} ${TEST_NAME})
103 109
ENDFOREACH(TEST_NAME)
0 comments (0 inline)