test/CMakeLists.txt
author Balazs Dezso <deba@inf.elte.hu>
Thu, 01 Dec 2011 09:05:47 +0100
changeset 1025 c8fa41fcc4a7
parent 1000 404b98971e1f
child 1030 4936be66d2f5
permissions -rw-r--r--
Type safe red and blue node set (#69)
     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_test
    39   maps_test
    40   matching_test
    41   max_cardinality_search_test
    42   max_clique_test
    43   min_cost_arborescence_test
    44   min_cost_flow_test
    45   min_mean_cycle_test
    46   nagamochi_ibaraki_test
    47   path_test
    48   planarity_test
    49   preflow_test
    50   radix_sort_test
    51   random_test
    52   suurballe_test
    53   time_measure_test
    54   unionfind_test
    55 )
    56 
    57 IF(LEMON_HAVE_LP)
    58   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    59     ADD_EXECUTABLE(lp_test lp_test.cc)
    60   ELSE()
    61     ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
    62   ENDIF()
    63 
    64   SET(LP_TEST_LIBS lemon)
    65 
    66   IF(LEMON_HAVE_GLPK)
    67     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
    68   ENDIF()
    69   IF(LEMON_HAVE_CPLEX)
    70     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    71   ENDIF()
    72   IF(LEMON_HAVE_CLP)
    73     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    74   ENDIF()
    75 
    76   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    77   ADD_TEST(lp_test lp_test)
    78   ADD_DEPENDENCIES(check lp_test)
    79 
    80   IF(WIN32 AND LEMON_HAVE_GLPK)
    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
    84       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    85       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    86       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    87     )
    88   ENDIF()
    89 
    90   IF(WIN32 AND LEMON_HAVE_CPLEX)
    91     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    92     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    93     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    94       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
    95     )
    96   ENDIF()
    97 ENDIF()
    98 
    99 IF(LEMON_HAVE_MIP)
   100   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
   101     ADD_EXECUTABLE(mip_test mip_test.cc)
   102   ELSE()
   103     ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
   104   ENDIF()
   105 
   106   SET(MIP_TEST_LIBS lemon)
   107 
   108   IF(LEMON_HAVE_GLPK)
   109     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
   110   ENDIF()
   111   IF(LEMON_HAVE_CPLEX)
   112     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
   113   ENDIF()
   114   IF(LEMON_HAVE_CBC)
   115     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
   116   ENDIF()
   117 
   118   TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
   119   ADD_TEST(mip_test mip_test)
   120   ADD_DEPENDENCIES(check mip_test)
   121 
   122   IF(WIN32 AND LEMON_HAVE_GLPK)
   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
   126       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
   127       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
   128       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
   129     )
   130   ENDIF()
   131 
   132   IF(WIN32 AND LEMON_HAVE_CPLEX)
   133     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   134     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   135     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   136       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
   137     )
   138   ENDIF()
   139 ENDIF()
   140 
   141 FOREACH(TEST_NAME ${TESTS})
   142   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
   143     ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
   144   ELSE()
   145     ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
   146   ENDIF()
   147   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
   148     IF(TEST_WITH_VALGRIND)
   149       ADD_TEST(${TEST_NAME}
   150         valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
   151         ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
   152     ELSE()
   153       ADD_TEST(${TEST_NAME} ${TEST_NAME})
   154     ENDIF()
   155   ADD_DEPENDENCIES(check ${TEST_NAME})
   156 ENDFOREACH()