gravatar
ladanyi@tmit.bme.hu
ladanyi@tmit.bme.hu
FindGLPK improvements (#256)
0 4 0
default
4 files changed with 8 insertions and 11 deletions:
↑ Collapse diff ↑
Show white space 256 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

	
18 18
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
19 19

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

	
29
IF(GLPK_FOUND)
30
  SET(HAVE_LP TRUE)
31
  SET(HAVE_MIP TRUE)
32
  SET(HAVE_GLPK TRUE)
33
ENDIF(GLPK_FOUND)
34

	
35 29
INCLUDE(CheckTypeSize)
36 30
CHECK_TYPE_SIZE("long long" LONG_LONG)
37 31

	
38 32
ENABLE_TESTING()
39 33

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

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

	
56 50
    SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
57 51

	
58 52
    SET(CPACK_PACKAGE_INSTALL_DIRECTORY
59 53
      "${PROJECT_NAME} ${PROJECT_VERSION}")
60 54
    SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
61 55
      "${PROJECT_NAME} ${PROJECT_VERSION}")
62 56

	
63 57
    SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
64 58

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

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

	
79 73
    SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
80 74

	
81 75
    SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
82 76
    SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
83 77
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
84 78

	
85 79
    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
86 80
      "Components needed to develop software using LEMON")
87 81
    SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
88 82
      "Documentation of LEMON")
89 83

	
90 84
    SET(CPACK_ALL_INSTALL_TYPES Full Developer)
91 85

	
92 86
    SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
93 87
    SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
94 88
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
95 89

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

	
113 107
    INCLUDE(CPack)
114 108
  ENDIF(WIN32)
115 109
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
Show white space 256 line context
1 1
SET(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]")
2 2
GET_FILENAME_COMPONENT(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE)
3 3

	
4 4
FIND_PATH(GLPK_INCLUDE_DIR
5 5
  glpk.h
6 6
  PATHS ${GLPK_REGKEY}/include)
7 7

	
8 8
FIND_LIBRARY(GLPK_LIBRARY
9 9
  NAMES glpk
10 10
  PATHS ${GLPK_REGKEY}/lib)
11 11

	
12 12
INCLUDE(FindPackageHandleStandardArgs)
13 13
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLPK DEFAULT_MSG GLPK_LIBRARY GLPK_INCLUDE_DIR)
14 14

	
15 15
IF(GLPK_FOUND)
16
  SET(GLPK_INCLUDE_DIRS ${GLPK_INCLUDE_DIR})
16 17
  SET(GLPK_LIBRARIES ${GLPK_LIBRARY})
17 18
  SET(GLPK_BIN_DIR ${GLPK_ROOT_PATH}/bin)
18 19
ENDIF(GLPK_FOUND)
19 20

	
20 21
MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
22

	
23
IF(GLPK_FOUND)
24
  SET(HAVE_LP TRUE)
25
  SET(HAVE_MIP TRUE)
26
  SET(HAVE_GLPK TRUE)
27
ENDIF(GLPK_FOUND)
Show white space 256 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
  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
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
ADD_LIBRARY(lemon ${LEMON_SOURCES})
32 32

	
33 33
INSTALL(
34 34
  TARGETS lemon
35 35
  ARCHIVE DESTINATION lib
36 36
  COMPONENT library)
37 37

	
38 38
INSTALL(
39 39
  DIRECTORY . bits concepts
40 40
  DESTINATION include/lemon
41 41
  COMPONENT headers
42 42
  FILES_MATCHING PATTERN "*.h")
Show white space 256 line context
1 1
INCLUDE_DIRECTORIES(
2 2
  ${PROJECT_SOURCE_DIR}
3 3
  ${PROJECT_BINARY_DIR}
4 4
)
5 5

	
6
IF(HAVE_GLPK)
7
  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIR})
8
ENDIF(HAVE_GLPK)
9

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

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

	
43 39
IF(HAVE_LP)
44 40
  ADD_EXECUTABLE(lp_test lp_test.cc)
45 41
  IF(HAVE_GLPK)
46 42
    TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
47 43
  ENDIF(HAVE_GLPK)
48 44
  ADD_TEST(lp_test lp_test)
49 45

	
50 46
  IF(WIN32 AND HAVE_GLPK)
51 47
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
52 48
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
53 49
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
54 50
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
55 51
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
56 52
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
57 53
    )
58 54
  ENDIF(WIN32 AND HAVE_GLPK)
59 55
ENDIF(HAVE_LP)
60 56

	
61 57
IF(HAVE_MIP)
62 58
  ADD_EXECUTABLE(mip_test mip_test.cc)
63 59
  IF(HAVE_GLPK)
64 60
    TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
65 61
  ENDIF(HAVE_GLPK)
66 62
  ADD_TEST(mip_test mip_test)
67 63

	
68 64
  IF(WIN32 AND HAVE_GLPK)
69 65
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
70 66
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
71 67
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
72 68
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
73 69
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
74 70
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
75 71
    )
76 72
  ENDIF(WIN32 AND HAVE_GLPK)
77 73
ENDIF(HAVE_MIP)
78 74

	
79 75
FOREACH(TEST_NAME ${TESTS})
80 76
  ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
81 77
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
82 78
  ADD_TEST(${TEST_NAME} ${TEST_NAME})
83 79
ENDFOREACH(TEST_NAME)
0 comments (0 inline)