test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 05 Jun 2012 12:06:28 +0200
changeset 1222 c40a9d94442d
parent 1111 c8fce9beb46a
parent 1119 1818cc848005
child 1152 20ae244b4779
permissions -rw-r--r--
New features in time_measure.h (#442)
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@539
     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@141
    13
alpar@225
    14
SET(TESTS
deba@559
    15
  adaptors_test
kpeter@745
    16
  bellman_ford_test
ladanyi@141
    17
  bfs_test
alpar@443
    18
  circulation_test
kpeter@696
    19
  connectivity_test
ladanyi@141
    20
  counter_test
ladanyi@141
    21
  dfs_test
ladanyi@141
    22
  digraph_test
kpeter@170
    23
  dijkstra_test
ladanyi@141
    24
  dim_test
deba@559
    25
  edge_set_test
ladanyi@141
    26
  error_test
ladanyi@569
    27
  euler_test
deba@948
    28
  fractional_matching_test
tapolcai@590
    29
  gomory_hu_test
deba@200
    30
  graph_copy_test
ladanyi@141
    31
  graph_test
kpeter@171
    32
  graph_utils_test
deba@426
    33
  hao_orlin_test
deba@203
    34
  heap_test
ladanyi@141
    35
  kruskal_test
alpar@1067
    36
  lgf_test
ladanyi@141
    37
  maps_test
kpeter@641
    38
  matching_test
thoneyvazul@1020
    39
  max_cardinality_search_test
kpeter@999
    40
  max_clique_test
deba@522
    41
  min_cost_arborescence_test
kpeter@648
    42
  min_cost_flow_test
kpeter@810
    43
  min_mean_cycle_test
deba@1017
    44
  nagamochi_ibaraki_test
alpar@443
    45
  path_test
deba@861
    46
  planarity_test
alpar@443
    47
  preflow_test
ladanyi@496
    48
  radix_sort_test
alpar@225
    49
  random_test
alpar@443
    50
  suurballe_test
ladanyi@141
    51
  time_measure_test
ladanyi@726
    52
  unionfind_test
ladanyi@726
    53
)
ladanyi@539
    54
ladanyi@674
    55
IF(LEMON_HAVE_LP)
alpar@1033
    56
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    57
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@1033
    58
  ELSE()
alpar@1033
    59
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@1033
    60
  ENDIF()
alpar@1033
    61
ladanyi@667
    62
  SET(LP_TEST_LIBS lemon)
ladanyi@726
    63
ladanyi@674
    64
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    65
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    66
  ENDIF()
ladanyi@674
    67
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
    68
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
    69
  ENDIF()
ladanyi@674
    70
  IF(LEMON_HAVE_CLP)
ladanyi@668
    71
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@726
    72
  ENDIF()
ladanyi@726
    73
ladanyi@667
    74
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@496
    75
  ADD_TEST(lp_test lp_test)
alpar@1061
    76
  ADD_DEPENDENCIES(check lp_test)
ladanyi@496
    77
ladanyi@674
    78
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
    79
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@496
    80
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
    81
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    82
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
    83
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
    84
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
    85
    )
ladanyi@726
    86
  ENDIF()
ladanyi@726
    87
ladanyi@674
    88
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
    89
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@667
    90
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
    91
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
alpar@1119
    92
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
    93
    )
ladanyi@726
    94
  ENDIF()
ladanyi@726
    95
ENDIF()
ladanyi@496
    96
ladanyi@674
    97
IF(LEMON_HAVE_MIP)
alpar@1033
    98
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    99
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@1033
   100
  ELSE()
alpar@1033
   101
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@1033
   102
  ENDIF()
alpar@1033
   103
ladanyi@667
   104
  SET(MIP_TEST_LIBS lemon)
ladanyi@726
   105
ladanyi@674
   106
  IF(LEMON_HAVE_GLPK)
ladanyi@667
   107
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
   108
  ENDIF()
ladanyi@674
   109
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
   110
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
   111
  ENDIF()
ladanyi@674
   112
  IF(LEMON_HAVE_CBC)
ladanyi@668
   113
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@726
   114
  ENDIF()
ladanyi@726
   115
ladanyi@667
   116
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@496
   117
  ADD_TEST(mip_test mip_test)
alpar@1061
   118
  ADD_DEPENDENCIES(check mip_test)
ladanyi@496
   119
ladanyi@674
   120
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
   121
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@496
   122
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
   123
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   124
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
   125
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
   126
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
   127
    )
ladanyi@726
   128
  ENDIF()
ladanyi@726
   129
ladanyi@674
   130
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
   131
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@667
   132
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
   133
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@1119
   134
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
   135
    )
ladanyi@726
   136
  ENDIF()
ladanyi@726
   137
ENDIF()
ladanyi@141
   138
alpar@225
   139
FOREACH(TEST_NAME ${TESTS})
alpar@1033
   140
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
   141
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@1033
   142
  ELSE()
alpar@1033
   143
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@1033
   144
  ENDIF()
alpar@225
   145
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@1044
   146
    IF(TEST_WITH_VALGRIND)
alpar@1044
   147
      ADD_TEST(${TEST_NAME}
alpar@1044
   148
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@1044
   149
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@1044
   150
    ELSE()
alpar@1044
   151
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@1044
   152
    ENDIF()
alpar@1033
   153
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@726
   154
ENDFOREACH()