COIN-OR::LEMON - Graph Library

source: lemon/test/CMakeLists.txt @ 1044:66156a3498ea

Last change on this file since 1044:66156a3498ea was 1044:66156a3498ea, checked in by Alpar Juttner <alpar@…>, 10 years ago

Support tests with valgrind (#416)

File size: 3.8 KB
RevLine 
[539]1INCLUDE_DIRECTORIES(
[596]2  ${PROJECT_SOURCE_DIR}
[539]3  ${PROJECT_BINARY_DIR}
4)
[141]5
[726]6LINK_DIRECTORIES(
7  ${PROJECT_BINARY_DIR}/lemon
8)
[141]9
[1044]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
[225]14SET(TESTS
[559]15  adaptors_test
[141]16  bfs_test
[443]17  circulation_test
[696]18  connectivity_test
[141]19  counter_test
20  dfs_test
21  digraph_test
[170]22  dijkstra_test
[141]23  dim_test
[559]24  edge_set_test
[141]25  error_test
[569]26  euler_test
[590]27  gomory_hu_test
[200]28  graph_copy_test
[141]29  graph_test
[171]30  graph_utils_test
[426]31  hao_orlin_test
[203]32  heap_test
[141]33  kruskal_test
34  maps_test
[641]35  matching_test
[522]36  min_cost_arborescence_test
[648]37  min_cost_flow_test
[443]38  path_test
39  preflow_test
[496]40  radix_sort_test
[225]41  random_test
[443]42  suurballe_test
[141]43  time_measure_test
[726]44  unionfind_test
45)
[141]46
[674]47IF(LEMON_HAVE_LP)
[1033]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
[667]54  SET(LP_TEST_LIBS lemon)
[726]55
[674]56  IF(LEMON_HAVE_GLPK)
[667]57    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
[726]58  ENDIF()
[674]59  IF(LEMON_HAVE_CPLEX)
[667]60    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
[726]61  ENDIF()
[674]62  IF(LEMON_HAVE_CLP)
[668]63    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
[726]64  ENDIF()
65
[667]66  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
[496]67  ADD_TEST(lp_test lp_test)
68
[674]69  IF(WIN32 AND LEMON_HAVE_GLPK)
[496]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
[726]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}
[496]76    )
[726]77  ENDIF()
78
[674]79  IF(WIN32 AND LEMON_HAVE_CPLEX)
[667]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
[726]83      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
[667]84    )
[726]85  ENDIF()
86ENDIF()
[496]87
[674]88IF(LEMON_HAVE_MIP)
[1033]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
[667]95  SET(MIP_TEST_LIBS lemon)
[726]96
[674]97  IF(LEMON_HAVE_GLPK)
[667]98    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
[726]99  ENDIF()
[674]100  IF(LEMON_HAVE_CPLEX)
[667]101    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
[726]102  ENDIF()
[674]103  IF(LEMON_HAVE_CBC)
[668]104    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
[726]105  ENDIF()
106
[667]107  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
[496]108  ADD_TEST(mip_test mip_test)
109
[674]110  IF(WIN32 AND LEMON_HAVE_GLPK)
[496]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
[726]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}
[496]117    )
[726]118  ENDIF()
119
[674]120  IF(WIN32 AND LEMON_HAVE_CPLEX)
[667]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
[726]124      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
[667]125    )
[726]126  ENDIF()
127ENDIF()
[496]128
[225]129FOREACH(TEST_NAME ${TESTS})
[1033]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()
[225]135  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
[1044]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()
[1033]143  ADD_DEPENDENCIES(check ${TEST_NAME})
[726]144ENDFOREACH()
Note: See TracBrowser for help on using the repository browser.