test/CMakeLists.txt
author Peter Kovacs <kpeter@inf.elte.hu>
Thu, 28 Feb 2013 18:05:56 +0100
changeset 1226 2f00ef323c2e
parent 1206 a2d142bb5d3c
child 1228 45befc97b1bc
permissions -rw-r--r--
Rename DefFlowMap named parameter to SetFlowMap (#177)
in EdmondsKarp according to Preflow
ladanyi@539
     1
INCLUDE_DIRECTORIES(
ladanyi@596
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@539
     3
  ${PROJECT_BINARY_DIR}
ladanyi@539
     4
)
ladanyi@141
     5
ladanyi@726
     6
LINK_DIRECTORIES(
ladanyi@726
     7
  ${PROJECT_BINARY_DIR}/lemon
ladanyi@726
     8
)
ladanyi@141
     9
alpar@1044
    10
SET(TEST_WITH_VALGRIND "NO" CACHE STRING
alpar@1044
    11
  "Run the test with valgrind (YES/NO).")
alpar@1044
    12
SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.")
ladanyi@539
    13
alpar@225
    14
SET(TESTS
deba@559
    15
  adaptors_test
alpar@1149
    16
  arc_look_up_test
kpeter@745
    17
  bellman_ford_test
ladanyi@141
    18
  bfs_test
deba@1186
    19
  bpgraph_test
alpar@443
    20
  circulation_test
kpeter@696
    21
  connectivity_test
ladanyi@141
    22
  counter_test
ladanyi@141
    23
  dfs_test
ladanyi@141
    24
  digraph_test
kpeter@170
    25
  dijkstra_test
ladanyi@141
    26
  dim_test
deba@559
    27
  edge_set_test
thoneyvazul@1224
    28
  edmonds_karp_test
ladanyi@141
    29
  error_test
ladanyi@569
    30
  euler_test
deba@948
    31
  fractional_matching_test
tapolcai@590
    32
  gomory_hu_test
deba@200
    33
  graph_copy_test
ladanyi@141
    34
  graph_test
kpeter@171
    35
  graph_utils_test
deba@426
    36
  hao_orlin_test
deba@203
    37
  heap_test
ladanyi@141
    38
  kruskal_test
deba@1198
    39
  lgf_reader_writer_test
alpar@1067
    40
  lgf_test
ladanyi@141
    41
  maps_test
kpeter@641
    42
  matching_test
thoneyvazul@1020
    43
  max_cardinality_search_test
kpeter@999
    44
  max_clique_test
deba@522
    45
  min_cost_arborescence_test
kpeter@648
    46
  min_cost_flow_test
kpeter@810
    47
  min_mean_cycle_test
deba@1017
    48
  nagamochi_ibaraki_test
alpar@443
    49
  path_test
deba@861
    50
  planarity_test
alpar@443
    51
  preflow_test
ladanyi@496
    52
  radix_sort_test
alpar@225
    53
  random_test
alpar@443
    54
  suurballe_test
ladanyi@141
    55
  time_measure_test
kpeter@1203
    56
  tsp_test
ladanyi@726
    57
  unionfind_test
ladanyi@726
    58
)
ladanyi@141
    59
ladanyi@674
    60
IF(LEMON_HAVE_LP)
alpar@1013
    61
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1013
    62
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@1013
    63
  ELSE()
alpar@1013
    64
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@1013
    65
  ENDIF()
alpar@1013
    66
ladanyi@667
    67
  SET(LP_TEST_LIBS lemon)
ladanyi@726
    68
ladanyi@674
    69
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    70
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    71
  ENDIF()
ladanyi@674
    72
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
    73
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
    74
  ENDIF()
ladanyi@674
    75
  IF(LEMON_HAVE_CLP)
ladanyi@668
    76
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@726
    77
  ENDIF()
ladanyi@726
    78
ladanyi@667
    79
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@496
    80
  ADD_TEST(lp_test lp_test)
alpar@1061
    81
  ADD_DEPENDENCIES(check lp_test)
ladanyi@496
    82
ladanyi@674
    83
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
    84
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@496
    85
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
    86
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    87
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
    88
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
    89
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
    90
    )
ladanyi@726
    91
  ENDIF()
ladanyi@726
    92
ladanyi@674
    93
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
    94
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@667
    95
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
    96
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
alpar@1119
    97
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
    98
    )
ladanyi@726
    99
  ENDIF()
ladanyi@726
   100
ENDIF()
ladanyi@496
   101
ladanyi@674
   102
IF(LEMON_HAVE_MIP)
alpar@1013
   103
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1013
   104
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@1013
   105
  ELSE()
alpar@1013
   106
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@1013
   107
  ENDIF()
alpar@1013
   108
ladanyi@667
   109
  SET(MIP_TEST_LIBS lemon)
ladanyi@726
   110
ladanyi@674
   111
  IF(LEMON_HAVE_GLPK)
ladanyi@667
   112
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
   113
  ENDIF()
ladanyi@674
   114
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
   115
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
   116
  ENDIF()
ladanyi@674
   117
  IF(LEMON_HAVE_CBC)
ladanyi@668
   118
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@726
   119
  ENDIF()
ladanyi@726
   120
ladanyi@667
   121
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@496
   122
  ADD_TEST(mip_test mip_test)
alpar@1061
   123
  ADD_DEPENDENCIES(check mip_test)
ladanyi@496
   124
ladanyi@674
   125
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
   126
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@496
   127
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
   128
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   129
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
   130
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
   131
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
   132
    )
ladanyi@726
   133
  ENDIF()
ladanyi@726
   134
ladanyi@674
   135
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
   136
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@667
   137
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
   138
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@1119
   139
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
   140
    )
ladanyi@726
   141
  ENDIF()
ladanyi@726
   142
ENDIF()
ladanyi@496
   143
alpar@225
   144
FOREACH(TEST_NAME ${TESTS})
alpar@996
   145
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@996
   146
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@996
   147
  ELSE()
alpar@996
   148
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@996
   149
  ENDIF()
alpar@225
   150
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@1044
   151
    IF(TEST_WITH_VALGRIND)
alpar@1044
   152
      ADD_TEST(${TEST_NAME}
alpar@1044
   153
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@1044
   154
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@1044
   155
    ELSE()
alpar@1044
   156
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@1044
   157
    ENDIF()
ladanyi@992
   158
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@726
   159
ENDFOREACH()