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)
ladanyi@510
     1
INCLUDE_DIRECTORIES(
ladanyi@549
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@510
     3
  ${PROJECT_BINARY_DIR}
ladanyi@510
     4
)
ladanyi@141
     5
ladanyi@679
     6
LINK_DIRECTORIES(
ladanyi@679
     7
  ${PROJECT_BINARY_DIR}/lemon
ladanyi@679
     8
)
ladanyi@510
     9
alpar@933
    10
SET(TEST_WITH_VALGRIND "NO" CACHE STRING
alpar@933
    11
  "Run the test with valgrind (YES/NO).")
alpar@933
    12
SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.")
ladanyi@141
    13
alpar@225
    14
SET(TESTS
deba@488
    15
  adaptors_test
alpar@993
    16
  arc_look_up_test
kpeter@698
    17
  bellman_ford_test
ladanyi@141
    18
  bfs_test
deba@1018
    19
  bpgraph_test
alpar@424
    20
  circulation_test
kpeter@649
    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@488
    27
  edge_set_test
ladanyi@141
    28
  error_test
ladanyi@522
    29
  euler_test
deba@869
    30
  fractional_matching_test
tapolcai@543
    31
  gomory_hu_test
deba@200
    32
  graph_copy_test
ladanyi@141
    33
  graph_test
kpeter@171
    34
  graph_utils_test
deba@410
    35
  hao_orlin_test
deba@203
    36
  heap_test
ladanyi@141
    37
  kruskal_test
alpar@949
    38
  lgf_test
ladanyi@141
    39
  maps_test
kpeter@594
    40
  matching_test
thoneyvazul@916
    41
  max_cardinality_search_test
kpeter@904
    42
  max_clique_test
deba@501
    43
  min_cost_arborescence_test
kpeter@601
    44
  min_cost_flow_test
kpeter@763
    45
  min_mean_cycle_test
deba@913
    46
  nagamochi_ibaraki_test
alpar@424
    47
  path_test
deba@797
    48
  planarity_test
alpar@424
    49
  preflow_test
ladanyi@473
    50
  radix_sort_test
alpar@225
    51
  random_test
alpar@424
    52
  suurballe_test
ladanyi@141
    53
  time_measure_test
ladanyi@679
    54
  unionfind_test
ladanyi@679
    55
)
ladanyi@510
    56
ladanyi@627
    57
IF(LEMON_HAVE_LP)
alpar@927
    58
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
    59
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@927
    60
  ELSE()
alpar@927
    61
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@927
    62
  ENDIF()
alpar@927
    63
ladanyi@620
    64
  SET(LP_TEST_LIBS lemon)
ladanyi@679
    65
ladanyi@627
    66
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    67
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
    68
  ENDIF()
ladanyi@627
    69
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    70
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
    71
  ENDIF()
ladanyi@627
    72
  IF(LEMON_HAVE_CLP)
ladanyi@621
    73
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@679
    74
  ENDIF()
ladanyi@679
    75
ladanyi@620
    76
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    77
  ADD_TEST(lp_test lp_test)
alpar@945
    78
  ADD_DEPENDENCIES(check lp_test)
ladanyi@473
    79
ladanyi@627
    80
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    81
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    82
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    83
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    84
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
    85
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
    86
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    87
    )
ladanyi@679
    88
  ENDIF()
ladanyi@679
    89
ladanyi@627
    90
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    91
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    92
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    93
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
alpar@972
    94
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@620
    95
    )
ladanyi@679
    96
  ENDIF()
ladanyi@679
    97
ENDIF()
ladanyi@473
    98
ladanyi@627
    99
IF(LEMON_HAVE_MIP)
alpar@927
   100
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
   101
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@927
   102
  ELSE()
alpar@927
   103
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@927
   104
  ENDIF()
alpar@927
   105
ladanyi@620
   106
  SET(MIP_TEST_LIBS lemon)
ladanyi@679
   107
ladanyi@627
   108
  IF(LEMON_HAVE_GLPK)
ladanyi@620
   109
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
   110
  ENDIF()
ladanyi@627
   111
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
   112
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
   113
  ENDIF()
ladanyi@627
   114
  IF(LEMON_HAVE_CBC)
ladanyi@621
   115
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@679
   116
  ENDIF()
ladanyi@679
   117
ladanyi@620
   118
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   119
  ADD_TEST(mip_test mip_test)
alpar@945
   120
  ADD_DEPENDENCIES(check mip_test)
ladanyi@473
   121
ladanyi@627
   122
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
   123
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
   124
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
   125
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   126
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
   127
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
   128
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   129
    )
ladanyi@679
   130
  ENDIF()
ladanyi@679
   131
ladanyi@627
   132
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
   133
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
   134
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
   135
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@972
   136
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@620
   137
    )
ladanyi@679
   138
  ENDIF()
ladanyi@679
   139
ENDIF()
ladanyi@141
   140
alpar@225
   141
FOREACH(TEST_NAME ${TESTS})
alpar@927
   142
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
   143
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@927
   144
  ELSE()
alpar@927
   145
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@927
   146
  ENDIF()
alpar@225
   147
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@933
   148
    IF(TEST_WITH_VALGRIND)
alpar@933
   149
      ADD_TEST(${TEST_NAME}
alpar@933
   150
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@933
   151
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@933
   152
    ELSE()
alpar@933
   153
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@933
   154
    ENDIF()
alpar@927
   155
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@679
   156
ENDFOREACH()