1 | INCLUDE_DIRECTORIES( |
---|
2 | ${PROJECT_SOURCE_DIR} |
---|
3 | ${PROJECT_BINARY_DIR} |
---|
4 | ) |
---|
5 | |
---|
6 | LINK_DIRECTORIES( |
---|
7 | ${PROJECT_BINARY_DIR}/lemon |
---|
8 | ) |
---|
9 | |
---|
10 | SET(TEST_WITH_VALGRIND "NO" CACHE STRING |
---|
11 | "Run the test with valgrind (YES/NO).") |
---|
12 | SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.") |
---|
13 | |
---|
14 | SET(TESTS |
---|
15 | adaptors_test |
---|
16 | arc_look_up_test |
---|
17 | bellman_ford_test |
---|
18 | bfs_test |
---|
19 | bpgraph_test |
---|
20 | circulation_test |
---|
21 | connectivity_test |
---|
22 | counter_test |
---|
23 | dfs_test |
---|
24 | digraph_test |
---|
25 | dijkstra_test |
---|
26 | dim_test |
---|
27 | edge_set_test |
---|
28 | error_test |
---|
29 | euler_test |
---|
30 | fractional_matching_test |
---|
31 | gomory_hu_test |
---|
32 | graph_copy_test |
---|
33 | graph_test |
---|
34 | graph_utils_test |
---|
35 | hao_orlin_test |
---|
36 | heap_test |
---|
37 | kruskal_test |
---|
38 | lgf_reader_writer_test |
---|
39 | lgf_test |
---|
40 | maps_test |
---|
41 | matching_test |
---|
42 | max_cardinality_search_test |
---|
43 | max_clique_test |
---|
44 | max_flow_test |
---|
45 | min_cost_arborescence_test |
---|
46 | min_cost_flow_test |
---|
47 | min_mean_cycle_test |
---|
48 | nagamochi_ibaraki_test |
---|
49 | path_test |
---|
50 | planarity_test |
---|
51 | radix_sort_test |
---|
52 | random_test |
---|
53 | suurballe_test |
---|
54 | time_measure_test |
---|
55 | tsp_test |
---|
56 | unionfind_test |
---|
57 | vf2_test |
---|
58 | ) |
---|
59 | |
---|
60 | IF(LEMON_HAVE_LP) |
---|
61 | IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") |
---|
62 | ADD_EXECUTABLE(lp_test lp_test.cc) |
---|
63 | ELSE() |
---|
64 | ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc) |
---|
65 | ENDIF() |
---|
66 | |
---|
67 | SET(LP_TEST_LIBS lemon) |
---|
68 | |
---|
69 | IF(LEMON_HAVE_GLPK) |
---|
70 | SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES}) |
---|
71 | ENDIF() |
---|
72 | IF(LEMON_HAVE_CPLEX) |
---|
73 | SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${ILOG_LIBRARIES}) |
---|
74 | ENDIF() |
---|
75 | IF(LEMON_HAVE_CLP) |
---|
76 | SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES}) |
---|
77 | ENDIF() |
---|
78 | IF(LEMON_HAVE_SOPLEX) |
---|
79 | SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${SOPLEX_LIBRARIES}) |
---|
80 | ENDIF() |
---|
81 | |
---|
82 | TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS}) |
---|
83 | ADD_TEST(lp_test lp_test) |
---|
84 | ADD_DEPENDENCIES(check lp_test) |
---|
85 | |
---|
86 | IF(WIN32 AND LEMON_HAVE_GLPK) |
---|
87 | ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD |
---|
88 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll $<TARGET_FILE_DIR:lp_test> |
---|
89 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll $<TARGET_FILE_DIR:lp_test> |
---|
90 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll $<TARGET_FILE_DIR:lp_test> |
---|
91 | ) |
---|
92 | ENDIF() |
---|
93 | |
---|
94 | IF(WIN32 AND LEMON_HAVE_CPLEX) |
---|
95 | GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) |
---|
96 | GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
---|
97 | ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD |
---|
98 | COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH} |
---|
99 | ) |
---|
100 | ENDIF() |
---|
101 | ENDIF() |
---|
102 | |
---|
103 | IF(LEMON_HAVE_MIP) |
---|
104 | IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") |
---|
105 | ADD_EXECUTABLE(mip_test mip_test.cc) |
---|
106 | ELSE() |
---|
107 | ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc) |
---|
108 | ENDIF() |
---|
109 | |
---|
110 | SET(MIP_TEST_LIBS lemon) |
---|
111 | |
---|
112 | IF(LEMON_HAVE_GLPK) |
---|
113 | SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES}) |
---|
114 | ENDIF() |
---|
115 | IF(LEMON_HAVE_CPLEX) |
---|
116 | SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${ILOG_LIBRARIES}) |
---|
117 | ENDIF() |
---|
118 | IF(LEMON_HAVE_CBC) |
---|
119 | SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES}) |
---|
120 | ENDIF() |
---|
121 | |
---|
122 | TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS}) |
---|
123 | ADD_TEST(mip_test mip_test) |
---|
124 | ADD_DEPENDENCIES(check mip_test) |
---|
125 | |
---|
126 | IF(WIN32 AND LEMON_HAVE_GLPK) |
---|
127 | GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) |
---|
128 | GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
---|
129 | ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD |
---|
130 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} |
---|
131 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} |
---|
132 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} |
---|
133 | ) |
---|
134 | ENDIF() |
---|
135 | |
---|
136 | IF(WIN32 AND LEMON_HAVE_CPLEX) |
---|
137 | GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) |
---|
138 | GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
---|
139 | ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD |
---|
140 | COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH} |
---|
141 | ) |
---|
142 | ENDIF() |
---|
143 | ENDIF() |
---|
144 | |
---|
145 | FOREACH(TEST_NAME ${TESTS}) |
---|
146 | IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") |
---|
147 | ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc) |
---|
148 | ELSE() |
---|
149 | ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc) |
---|
150 | ENDIF() |
---|
151 | TARGET_LINK_LIBRARIES(${TEST_NAME} lemon) |
---|
152 | IF(TEST_WITH_VALGRIND) |
---|
153 | ADD_TEST(${TEST_NAME} |
---|
154 | valgrind --error-exitcode=1 ${VALGRIND_FLAGS} |
---|
155 | ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} ) |
---|
156 | ELSE() |
---|
157 | ADD_TEST(${TEST_NAME} ${TEST_NAME}) |
---|
158 | ENDIF() |
---|
159 | ADD_DEPENDENCIES(check ${TEST_NAME}) |
---|
160 | ENDFOREACH() |
---|