test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 20 Dec 2011 19:21:08 +0100
changeset 777 63fd58460c39
parent 752 2024bf2ecdd6
parent 756 54464584b157
child 780 1818cc848005
permissions -rw-r--r--
Add missing doc/template.h to release tarball (#432)
ladanyi@620
     1
INCLUDE_DIRECTORIES(
ladanyi@538
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@620
     3
  ${PROJECT_BINARY_DIR}
ladanyi@620
     4
)
ladanyi@141
     5
ladanyi@681
     6
LINK_DIRECTORIES(
ladanyi@681
     7
  ${PROJECT_BINARY_DIR}/lemon
ladanyi@681
     8
)
ladanyi@620
     9
alpar@747
    10
SET(TEST_WITH_VALGRIND "NO" CACHE STRING
alpar@747
    11
  "Run the test with valgrind (YES/NO).")
alpar@747
    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
ladanyi@141
    16
  bfs_test
alpar@424
    17
  circulation_test
kpeter@647
    18
  connectivity_test
ladanyi@141
    19
  counter_test
ladanyi@141
    20
  dfs_test
ladanyi@141
    21
  digraph_test
kpeter@170
    22
  dijkstra_test
ladanyi@141
    23
  dim_test
deba@488
    24
  edge_set_test
ladanyi@141
    25
  error_test
ladanyi@506
    26
  euler_test
tapolcai@531
    27
  gomory_hu_test
deba@200
    28
  graph_copy_test
ladanyi@141
    29
  graph_test
kpeter@171
    30
  graph_utils_test
deba@410
    31
  hao_orlin_test
deba@203
    32
  heap_test
ladanyi@141
    33
  kruskal_test
alpar@756
    34
  lgf_test
ladanyi@141
    35
  maps_test
kpeter@586
    36
  matching_test
deba@512
    37
  min_cost_arborescence_test
kpeter@593
    38
  min_cost_flow_test
alpar@424
    39
  path_test
alpar@424
    40
  preflow_test
ladanyi@473
    41
  radix_sort_test
alpar@225
    42
  random_test
alpar@424
    43
  suurballe_test
ladanyi@141
    44
  time_measure_test
ladanyi@681
    45
  unionfind_test
ladanyi@681
    46
)
ladanyi@620
    47
ladanyi@622
    48
IF(LEMON_HAVE_LP)
alpar@742
    49
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@742
    50
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@742
    51
  ELSE()
alpar@742
    52
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@742
    53
  ENDIF()
alpar@742
    54
ladanyi@612
    55
  SET(LP_TEST_LIBS lemon)
ladanyi@681
    56
ladanyi@622
    57
  IF(LEMON_HAVE_GLPK)
ladanyi@612
    58
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@681
    59
  ENDIF()
ladanyi@622
    60
  IF(LEMON_HAVE_CPLEX)
ladanyi@612
    61
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@681
    62
  ENDIF()
ladanyi@622
    63
  IF(LEMON_HAVE_CLP)
ladanyi@613
    64
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@681
    65
  ENDIF()
ladanyi@681
    66
ladanyi@612
    67
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    68
  ADD_TEST(lp_test lp_test)
alpar@752
    69
  ADD_DEPENDENCIES(check lp_test)
ladanyi@473
    70
ladanyi@622
    71
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    72
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    73
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    74
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@681
    75
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@681
    76
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@681
    77
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    78
    )
ladanyi@681
    79
  ENDIF()
ladanyi@681
    80
ladanyi@622
    81
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@612
    82
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@612
    83
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@612
    84
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@681
    85
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@612
    86
    )
ladanyi@681
    87
  ENDIF()
ladanyi@681
    88
ENDIF()
ladanyi@473
    89
ladanyi@622
    90
IF(LEMON_HAVE_MIP)
alpar@742
    91
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@742
    92
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@742
    93
  ELSE()
alpar@742
    94
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@742
    95
  ENDIF()
alpar@742
    96
ladanyi@612
    97
  SET(MIP_TEST_LIBS lemon)
ladanyi@681
    98
ladanyi@622
    99
  IF(LEMON_HAVE_GLPK)
ladanyi@612
   100
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@681
   101
  ENDIF()
ladanyi@622
   102
  IF(LEMON_HAVE_CPLEX)
ladanyi@612
   103
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@681
   104
  ENDIF()
ladanyi@622
   105
  IF(LEMON_HAVE_CBC)
ladanyi@613
   106
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@681
   107
  ENDIF()
ladanyi@681
   108
ladanyi@612
   109
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   110
  ADD_TEST(mip_test mip_test)
alpar@752
   111
  ADD_DEPENDENCIES(check mip_test)
ladanyi@473
   112
ladanyi@622
   113
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
   114
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
   115
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
   116
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@681
   117
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@681
   118
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@681
   119
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   120
    )
ladanyi@681
   121
  ENDIF()
ladanyi@681
   122
ladanyi@622
   123
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@612
   124
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@612
   125
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@612
   126
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@681
   127
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@612
   128
    )
ladanyi@681
   129
  ENDIF()
ladanyi@681
   130
ENDIF()
ladanyi@141
   131
alpar@225
   132
FOREACH(TEST_NAME ${TESTS})
alpar@742
   133
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@742
   134
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@742
   135
  ELSE()
alpar@742
   136
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@742
   137
  ENDIF()
alpar@225
   138
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@747
   139
    IF(TEST_WITH_VALGRIND)
alpar@747
   140
      ADD_TEST(${TEST_NAME}
alpar@747
   141
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@747
   142
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@747
   143
    ELSE()
alpar@747
   144
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@747
   145
    ENDIF()
alpar@742
   146
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@681
   147
ENDFOREACH()