gravatar
ladanyi@tmit.bme.hu
ladanyi@tmit.bme.hu
Fix CMAKE build without GLPK
0 3 0
default
3 files changed with 18 insertions and 13 deletions:
↑ Collapse diff ↑
Show white space 64 line context
1 1
INCLUDE_DIRECTORIES(
2 2
  ${CMAKE_SOURCE_DIR}
3 3
  ${CMAKE_BINARY_DIR}
4
  ${GLPK_INCLUDE_DIR}
5 4
)
6 5

	
7 6
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
8 7

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

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

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

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

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

	
24 29
ADD_LIBRARY(lemon ${LEMON_SOURCES})
25 30

	
26 31
INSTALL(
27 32
  TARGETS lemon
28 33
  ARCHIVE DESTINATION lib
29 34
  COMPONENT library)
30 35

	
31 36
INSTALL(
32 37
  DIRECTORY . bits concepts
33 38
  DESTINATION include/lemon
34 39
  COMPONENT headers
35 40
  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)
Show white space 64 line context
1 1
INCLUDE_DIRECTORIES(
2 2
  ${CMAKE_SOURCE_DIR}
3 3
  ${CMAKE_BINARY_DIR}
4
  ${GLPK_INCLUDE_DIR}
5 4
)
6 5

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

	
7 10
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon)
8 11

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

	
36 39
IF(HAVE_LP)
37 40
  ADD_EXECUTABLE(lp_test lp_test.cc)
41
  IF(HAVE_GLPK)
38 42
  TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
43
  ENDIF(HAVE_GLPK)
39 44
  ADD_TEST(lp_test lp_test)
40 45

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

	
52 57
IF(HAVE_MIP)
53 58
  ADD_EXECUTABLE(mip_test mip_test.cc)
59
  IF(HAVE_GLPK)
54 60
  TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
61
  ENDIF(HAVE_GLPK)
55 62
  ADD_TEST(mip_test mip_test)
56 63

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

	
68 75
FOREACH(TEST_NAME ${TESTS})
69 76
  ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
70 77
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
71 78
  ADD_TEST(${TEST_NAME} ${TEST_NAME})
72 79
ENDFOREACH(TEST_NAME)
0 comments (0 inline)