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 | vf2pp_test |
---|
59 | ) |
---|
60 | |
---|
61 | IF(LEMON_HAVE_LP) |
---|
62 | IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") |
---|
63 | ADD_EXECUTABLE(lp_test lp_test.cc) |
---|
64 | ELSE() |
---|
65 | ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc) |
---|
66 | ENDIF() |
---|
67 | |
---|
68 | SET(LP_TEST_LIBS lemon) |
---|
69 | |
---|
70 | IF(LEMON_HAVE_GLPK) |
---|
71 | SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES}) |
---|
72 | ENDIF() |
---|
73 | IF(LEMON_HAVE_CPLEX) |
---|
74 | SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${ILOG_LIBRARIES}) |
---|
75 | ENDIF() |
---|
76 | IF(LEMON_HAVE_CLP) |
---|
77 | SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES}) |
---|
78 | ENDIF() |
---|
79 | IF(LEMON_HAVE_SOPLEX) |
---|
80 | SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${SOPLEX_LIBRARIES}) |
---|
81 | ENDIF() |
---|
82 | |
---|
83 | TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS}) |
---|
84 | ADD_TEST(lp_test lp_test) |
---|
85 | ADD_DEPENDENCIES(check lp_test) |
---|
86 | |
---|
87 | IF(WIN32 AND LEMON_HAVE_GLPK) |
---|
88 | GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) |
---|
89 | GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
---|
90 | ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD |
---|
91 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} |
---|
92 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} |
---|
93 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} |
---|
94 | ) |
---|
95 | ENDIF() |
---|
96 | |
---|
97 | IF(WIN32 AND LEMON_HAVE_CPLEX) |
---|
98 | GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION) |
---|
99 | GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
---|
100 | ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD |
---|
101 | COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH} |
---|
102 | ) |
---|
103 | ENDIF() |
---|
104 | ENDIF() |
---|
105 | |
---|
106 | IF(LEMON_HAVE_MIP) |
---|
107 | IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") |
---|
108 | ADD_EXECUTABLE(mip_test mip_test.cc) |
---|
109 | ELSE() |
---|
110 | ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc) |
---|
111 | ENDIF() |
---|
112 | |
---|
113 | SET(MIP_TEST_LIBS lemon) |
---|
114 | |
---|
115 | IF(LEMON_HAVE_GLPK) |
---|
116 | SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES}) |
---|
117 | ENDIF() |
---|
118 | IF(LEMON_HAVE_CPLEX) |
---|
119 | SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${ILOG_LIBRARIES}) |
---|
120 | ENDIF() |
---|
121 | IF(LEMON_HAVE_CBC) |
---|
122 | SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES}) |
---|
123 | ENDIF() |
---|
124 | |
---|
125 | TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS}) |
---|
126 | ADD_TEST(mip_test mip_test) |
---|
127 | ADD_DEPENDENCIES(check mip_test) |
---|
128 | |
---|
129 | IF(WIN32 AND LEMON_HAVE_GLPK) |
---|
130 | GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) |
---|
131 | GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
---|
132 | ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD |
---|
133 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH} |
---|
134 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH} |
---|
135 | COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH} |
---|
136 | ) |
---|
137 | ENDIF() |
---|
138 | |
---|
139 | IF(WIN32 AND LEMON_HAVE_CPLEX) |
---|
140 | GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION) |
---|
141 | GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH) |
---|
142 | ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD |
---|
143 | COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH} |
---|
144 | ) |
---|
145 | ENDIF() |
---|
146 | ENDIF() |
---|
147 | |
---|
148 | FOREACH(TEST_NAME ${TESTS}) |
---|
149 | IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer") |
---|
150 | ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc) |
---|
151 | ELSE() |
---|
152 | ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc) |
---|
153 | ENDIF() |
---|
154 | TARGET_LINK_LIBRARIES(${TEST_NAME} lemon) |
---|
155 | IF(TEST_WITH_VALGRIND) |
---|
156 | ADD_TEST(${TEST_NAME} |
---|
157 | valgrind --error-exitcode=1 ${VALGRIND_FLAGS} |
---|
158 | ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} ) |
---|
159 | ELSE() |
---|
160 | ADD_TEST(${TEST_NAME} ${TEST_NAME}) |
---|
161 | ENDIF() |
---|
162 | ADD_DEPENDENCIES(check ${TEST_NAME}) |
---|
163 | ENDFOREACH() |
---|