gravatar
ladanyi@tmit.bme.hu
ladanyi@tmit.bme.hu
Build GLPK dependent parts with CMake too
0 4 2
default
6 files changed with 101 insertions and 8 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
1
SET(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]")
2
GET_FILENAME_COMPONENT(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE)
3

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

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

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

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

	
20
MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)
Ignore white space 6 line context
1
#cmakedefine HAVE_LP 1
2
#cmakedefine HAVE_MIP 1
3
#cmakedefine HAVE_GLPK 1
Ignore white space 6 line context
1 1
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 2

	
3 3
SET(PROJECT_NAME "LEMON")
4 4
SET(PROJECT_VERSION "hg-tip" CACHE STRING "The version string.")
5 5

	
6 6
PROJECT(${PROJECT_NAME})
7 7

	
8 8
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
9 9

	
10 10
INCLUDE(FindDoxygen)
11 11
INCLUDE(FindGhostscript)
12
FIND_PACKAGE(GLPK 4.33)
13

	
14
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
15

	
16
IF(GLPK_FOUND)
17
  SET(HAVE_LP TRUE)
18
  SET(HAVE_MIP TRUE)
19
  SET(HAVE_GLPK TRUE)
20
ENDIF(GLPK_FOUND)
12 21

	
13 22
ENABLE_TESTING()
14 23

	
15 24
ADD_SUBDIRECTORY(lemon)
16 25
ADD_SUBDIRECTORY(demo)
17 26
ADD_SUBDIRECTORY(doc)
18 27
ADD_SUBDIRECTORY(test)
19 28

	
20 29
IF(WIN32)
21 30
  INSTALL(FILES ${CMAKE_SOURCE_DIR}/cmake/nsis/lemon.ico
22 31
    DESTINATION bin)
23 32
ENDIF(WIN32)
24 33

	
25 34
IF(WIN32)
26 35
  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
27 36
  SET(CPACK_PACKAGE_VENDOR
28 37
    "EGRES - Egervary Research Group on Combinatorial Optimization")
29 38
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
30 39
    "LEMON - Library of Efficient Models and Optimization in Networks")
31 40
  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
32 41

	
33 42
  SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
34 43

	
35 44
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY
36 45
    "${PROJECT_NAME} ${PROJECT_VERSION}")
37 46
  SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
38 47
    "${PROJECT_NAME} ${PROJECT_VERSION}")
39 48

	
40 49
  # Variables to generate a component-based installer.
41 50
  #SET(CPACK_COMPONENTS_ALL headers library html_documentation)
42 51

	
43 52
  #SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
44 53
  #SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Static library")
45 54
  #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
46 55

	
47 56
  #SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
48 57
  #  "C++ header files for use with the LEMON library")
49 58
  #SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
50 59
  #  "Static library used to build programs with LEMON")
51 60
  #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
52 61
  #  "Doxygen generated documentation")
53 62

	
54 63
  #SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
55 64

	
56 65
  #SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
57 66
  #SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
58 67
  #SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
59 68

	
Ignore white space 6 line context
1
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
1
INCLUDE_DIRECTORIES(
2
  ${CMAKE_SOURCE_DIR}
3
  ${CMAKE_BINARY_DIR}
4
  ${GLPK_INCLUDE_DIR}
5
)
2 6

	
3 7
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
4 8

	
5 9
SET(DEMOS
6 10
  arg_parser_demo
7 11
  graph_to_eps_demo
8 12
  lgf_demo)
9 13

	
10 14
FOREACH(DEMO_NAME ${DEMOS})
11 15
  ADD_EXECUTABLE(${DEMO_NAME} ${DEMO_NAME}.cc)
12 16
  TARGET_LINK_LIBRARIES(${DEMO_NAME} lemon)
13 17
ENDFOREACH(DEMO_NAME)
Ignore white space 96 line context
1
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
1
INCLUDE_DIRECTORIES(
2
  ${CMAKE_SOURCE_DIR}
3
  ${CMAKE_BINARY_DIR}
4
  ${GLPK_INCLUDE_DIR}
5
)
2 6

	
3
ADD_LIBRARY(lemon
7
CONFIGURE_FILE(
8
  ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
9
  ${CMAKE_CURRENT_BINARY_DIR}/config.h
10
)
11

	
12
SET(LEMON_SOURCES
4 13
  arg_parser.cc
5 14
  base.cc
6 15
  color.cc
16
  lp_base.cc
17
  lp_skeleton.cc
7 18
  random.cc)
8 19

	
20
IF(HAVE_GLPK)
21
  SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
22
ENDIF(HAVE_GLPK)
23

	
24
ADD_LIBRARY(lemon ${LEMON_SOURCES})
25

	
9 26
INSTALL(
10 27
  TARGETS lemon
11 28
  ARCHIVE DESTINATION lib
12 29
  COMPONENT library)
13 30

	
14 31
INSTALL(
15 32
  DIRECTORY . bits concepts
16 33
  DESTINATION include/lemon
17 34
  COMPONENT headers
18 35
  FILES_MATCHING PATTERN "*.h")
36

	
37
IF(WIN32)
38
  INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
39
  INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin)
40
  INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin)
41
ENDIF(WIN32)
Ignore white space 6 line context
1
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
1
INCLUDE_DIRECTORIES(
2
  ${CMAKE_SOURCE_DIR}
3
  ${CMAKE_BINARY_DIR}
4
  ${GLPK_INCLUDE_DIR}
5
)
2 6

	
3 7
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
4 8

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

	
36
IF(HAVE_LP)
37
  ADD_EXECUTABLE(lp_test lp_test.cc)
38
  TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
39
  ADD_TEST(lp_test lp_test)
40

	
41
  IF(WIN32)
42
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
43
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
44
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
45
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
46
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
47
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
48
    )
49
  ENDIF(WIN32)
50
ENDIF(HAVE_LP)
51

	
52
IF(HAVE_MIP)
53
  ADD_EXECUTABLE(mip_test mip_test.cc)
54
  TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
55
  ADD_TEST(mip_test mip_test)
56

	
57
  IF(WIN32)
58
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
59
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
60
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
61
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
62
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
63
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
64
    )
65
  ENDIF(WIN32)
66
ENDIF(HAVE_MIP)
67

	
34 68
FOREACH(TEST_NAME ${TESTS})
35 69
  ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
36 70
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
37 71
  ADD_TEST(${TEST_NAME} ${TEST_NAME})
38 72
ENDFOREACH(TEST_NAME)
0 comments (0 inline)