test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 20 Dec 2011 17:43:11 +0100
changeset 940 4efe7b32b134
parent 918 2024bf2ecdd6
parent 922 54464584b157
child 942 2b6bffe0e7e8
child 950 1818cc848005
permissions -rw-r--r--
Merge
ladanyi@499
     1
INCLUDE_DIRECTORIES(
ladanyi@549
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@499
     3
  ${PROJECT_BINARY_DIR}
ladanyi@499
     4
)
ladanyi@141
     5
ladanyi@679
     6
LINK_DIRECTORIES(
ladanyi@679
     7
  ${PROJECT_BINARY_DIR}/lemon
ladanyi@679
     8
)
ladanyi@499
     9
alpar@911
    10
SET(TEST_WITH_VALGRIND "NO" CACHE STRING
alpar@911
    11
  "Run the test with valgrind (YES/NO).")
alpar@911
    12
SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.")
ladanyi@141
    13
alpar@225
    14
SET(TESTS
deba@512
    15
  adaptors_test
ladanyi@141
    16
  bfs_test
alpar@424
    17
  circulation_test
kpeter@649
    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@512
    24
  edge_set_test
ladanyi@141
    25
  error_test
ladanyi@522
    26
  euler_test
tapolcai@543
    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@922
    34
  lgf_test
ladanyi@141
    35
  maps_test
kpeter@594
    36
  matching_test
deba@490
    37
  min_cost_arborescence_test
kpeter@601
    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@679
    45
  unionfind_test
ladanyi@679
    46
)
ladanyi@499
    47
ladanyi@627
    48
IF(LEMON_HAVE_LP)
alpar@904
    49
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
    50
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@904
    51
  ELSE()
alpar@904
    52
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@904
    53
  ENDIF()
alpar@904
    54
ladanyi@620
    55
  SET(LP_TEST_LIBS lemon)
ladanyi@679
    56
ladanyi@627
    57
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    58
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
    59
  ENDIF()
ladanyi@627
    60
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    61
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
    62
  ENDIF()
ladanyi@627
    63
  IF(LEMON_HAVE_CLP)
ladanyi@621
    64
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@679
    65
  ENDIF()
ladanyi@679
    66
ladanyi@620
    67
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    68
  ADD_TEST(lp_test lp_test)
alpar@918
    69
  ADD_DEPENDENCIES(check lp_test)
ladanyi@473
    70
ladanyi@627
    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@679
    75
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
    76
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
    77
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    78
    )
ladanyi@679
    79
  ENDIF()
ladanyi@679
    80
ladanyi@627
    81
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    82
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    83
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    84
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    85
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
    86
    )
ladanyi@679
    87
  ENDIF()
ladanyi@679
    88
ENDIF()
ladanyi@473
    89
ladanyi@627
    90
IF(LEMON_HAVE_MIP)
alpar@904
    91
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
    92
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@904
    93
  ELSE()
alpar@904
    94
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@904
    95
  ENDIF()
alpar@904
    96
ladanyi@620
    97
  SET(MIP_TEST_LIBS lemon)
ladanyi@679
    98
ladanyi@627
    99
  IF(LEMON_HAVE_GLPK)
ladanyi@620
   100
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
   101
  ENDIF()
ladanyi@627
   102
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
   103
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
   104
  ENDIF()
ladanyi@627
   105
  IF(LEMON_HAVE_CBC)
ladanyi@621
   106
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@679
   107
  ENDIF()
ladanyi@679
   108
ladanyi@620
   109
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   110
  ADD_TEST(mip_test mip_test)
alpar@918
   111
  ADD_DEPENDENCIES(check mip_test)
ladanyi@473
   112
ladanyi@627
   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@679
   117
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
   118
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
   119
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   120
    )
ladanyi@679
   121
  ENDIF()
ladanyi@679
   122
ladanyi@627
   123
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
   124
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
   125
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
   126
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   127
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
   128
    )
ladanyi@679
   129
  ENDIF()
ladanyi@679
   130
ENDIF()
ladanyi@141
   131
alpar@225
   132
FOREACH(TEST_NAME ${TESTS})
alpar@904
   133
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
   134
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@904
   135
  ELSE()
alpar@904
   136
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@904
   137
  ENDIF()
alpar@225
   138
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@911
   139
    IF(TEST_WITH_VALGRIND)
alpar@911
   140
      ADD_TEST(${TEST_NAME}
alpar@911
   141
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@911
   142
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@911
   143
    ELSE()
alpar@911
   144
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@911
   145
    ENDIF()
alpar@904
   146
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@679
   147
ENDFOREACH()