test/CMakeLists.txt
author Peter Kovacs <kpeter@inf.elte.hu>
Thu, 28 Feb 2013 18:17:53 +0100
changeset 1057 6a8a688eacf6
parent 1038 a2d142bb5d3c
child 1060 45befc97b1bc
permissions -rw-r--r--
Improve and fix API doc of EdmondsKarp according to Preflow (#177)
     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   edmonds_karp_test
    29   error_test
    30   euler_test
    31   fractional_matching_test
    32   gomory_hu_test
    33   graph_copy_test
    34   graph_test
    35   graph_utils_test
    36   hao_orlin_test
    37   heap_test
    38   kruskal_test
    39   lgf_reader_writer_test
    40   lgf_test
    41   maps_test
    42   matching_test
    43   max_cardinality_search_test
    44   max_clique_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   preflow_test
    52   radix_sort_test
    53   random_test
    54   suurballe_test
    55   time_measure_test
    56   tsp_test
    57   unionfind_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} ${CPLEX_LIBRARIES})
    74   ENDIF()
    75   IF(LEMON_HAVE_CLP)
    76     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    77   ENDIF()
    78 
    79   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    80   ADD_TEST(lp_test lp_test)
    81   ADD_DEPENDENCIES(check lp_test)
    82 
    83   IF(WIN32 AND LEMON_HAVE_GLPK)
    84     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    85     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    86     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    87       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    88       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    89       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    90     )
    91   ENDIF()
    92 
    93   IF(WIN32 AND LEMON_HAVE_CPLEX)
    94     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    95     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    96     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    97       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
    98     )
    99   ENDIF()
   100 ENDIF()
   101 
   102 IF(LEMON_HAVE_MIP)
   103   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
   104     ADD_EXECUTABLE(mip_test mip_test.cc)
   105   ELSE()
   106     ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
   107   ENDIF()
   108 
   109   SET(MIP_TEST_LIBS lemon)
   110 
   111   IF(LEMON_HAVE_GLPK)
   112     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
   113   ENDIF()
   114   IF(LEMON_HAVE_CPLEX)
   115     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
   116   ENDIF()
   117   IF(LEMON_HAVE_CBC)
   118     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
   119   ENDIF()
   120 
   121   TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
   122   ADD_TEST(mip_test mip_test)
   123   ADD_DEPENDENCIES(check mip_test)
   124 
   125   IF(WIN32 AND LEMON_HAVE_GLPK)
   126     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   127     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   128     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   129       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
   130       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
   131       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
   132     )
   133   ENDIF()
   134 
   135   IF(WIN32 AND LEMON_HAVE_CPLEX)
   136     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   137     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   138     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   139       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
   140     )
   141   ENDIF()
   142 ENDIF()
   143 
   144 FOREACH(TEST_NAME ${TESTS})
   145   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
   146     ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
   147   ELSE()
   148     ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
   149   ENDIF()
   150   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
   151     IF(TEST_WITH_VALGRIND)
   152       ADD_TEST(${TEST_NAME}
   153         valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
   154         ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
   155     ELSE()
   156       ADD_TEST(${TEST_NAME} ${TEST_NAME})
   157     ENDIF()
   158   ADD_DEPENDENCIES(check ${TEST_NAME})
   159 ENDFOREACH()