COIN-OR::LEMON - Graph Library

source: lemon-1.2/test/CMakeLists.txt @ 917:b4af20d02ae0

Last change on this file since 917:b4af20d02ae0 was 911:66156a3498ea, checked in by Alpar Juttner <alpar@…>, 9 years ago

Support tests with valgrind (#416)

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