COIN-OR::LEMON - Graph Library

source: lemon-main/test/CMakeLists.txt @ 945:2024bf2ecdd6

Last change on this file since 945:2024bf2ecdd6 was 945:2024bf2ecdd6, checked in by Alpar Juttner <alpar@…>, 14 years ago

Build of mip_test and lp_test precede the running of the tests (#419)

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