test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 20 Dec 2011 19:39:29 +0100
branch1.2
changeset 949 10271bbbb793
parent 923 c8c8801db0a4
parent 942 2b6bffe0e7e8
child 952 0976225b5cae
permissions -rw-r--r--
Merge #432 and #433 to branch 1.2
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@141
     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@499
    13
alpar@225
    14
SET(TESTS
deba@512
    15
  adaptors_test
kpeter@698
    16
  bellman_ford_test
ladanyi@141
    17
  bfs_test
alpar@424
    18
  circulation_test
kpeter@649
    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@512
    25
  edge_set_test
ladanyi@141
    26
  error_test
ladanyi@522
    27
  euler_test
deba@869
    28
  fractional_matching_test
tapolcai@543
    29
  gomory_hu_test
deba@200
    30
  graph_copy_test
ladanyi@141
    31
  graph_test
kpeter@171
    32
  graph_utils_test
deba@410
    33
  hao_orlin_test
deba@203
    34
  heap_test
ladanyi@141
    35
  kruskal_test
alpar@922
    36
  lgf_test
ladanyi@141
    37
  maps_test
kpeter@594
    38
  matching_test
deba@490
    39
  min_cost_arborescence_test
kpeter@601
    40
  min_cost_flow_test
kpeter@763
    41
  min_mean_cycle_test
alpar@424
    42
  path_test
deba@797
    43
  planarity_test
alpar@424
    44
  preflow_test
ladanyi@473
    45
  radix_sort_test
alpar@225
    46
  random_test
alpar@424
    47
  suurballe_test
ladanyi@141
    48
  time_measure_test
ladanyi@679
    49
  unionfind_test
ladanyi@679
    50
)
ladanyi@141
    51
ladanyi@627
    52
IF(LEMON_HAVE_LP)
alpar@904
    53
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
    54
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@904
    55
  ELSE()
alpar@904
    56
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@904
    57
  ENDIF()
alpar@904
    58
ladanyi@620
    59
  SET(LP_TEST_LIBS lemon)
ladanyi@679
    60
ladanyi@627
    61
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    62
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
    63
  ENDIF()
ladanyi@627
    64
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    65
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
    66
  ENDIF()
ladanyi@627
    67
  IF(LEMON_HAVE_CLP)
ladanyi@621
    68
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@679
    69
  ENDIF()
ladanyi@679
    70
ladanyi@620
    71
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    72
  ADD_TEST(lp_test lp_test)
alpar@918
    73
  ADD_DEPENDENCIES(check lp_test)
ladanyi@473
    74
ladanyi@627
    75
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    76
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    77
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    78
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    79
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
    80
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
    81
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    82
    )
ladanyi@679
    83
  ENDIF()
ladanyi@679
    84
ladanyi@627
    85
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    86
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    87
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    88
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    89
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
    90
    )
ladanyi@679
    91
  ENDIF()
ladanyi@679
    92
ENDIF()
ladanyi@473
    93
ladanyi@627
    94
IF(LEMON_HAVE_MIP)
alpar@904
    95
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
    96
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@904
    97
  ELSE()
alpar@904
    98
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@904
    99
  ENDIF()
alpar@904
   100
ladanyi@620
   101
  SET(MIP_TEST_LIBS lemon)
ladanyi@679
   102
ladanyi@627
   103
  IF(LEMON_HAVE_GLPK)
ladanyi@620
   104
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
   105
  ENDIF()
ladanyi@627
   106
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
   107
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
   108
  ENDIF()
ladanyi@627
   109
  IF(LEMON_HAVE_CBC)
ladanyi@621
   110
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@679
   111
  ENDIF()
ladanyi@679
   112
ladanyi@620
   113
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   114
  ADD_TEST(mip_test mip_test)
alpar@918
   115
  ADD_DEPENDENCIES(check mip_test)
ladanyi@473
   116
ladanyi@627
   117
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
   118
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
   119
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
   120
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   121
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
   122
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
   123
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   124
    )
ladanyi@679
   125
  ENDIF()
ladanyi@679
   126
ladanyi@627
   127
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
   128
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
   129
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
   130
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   131
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
   132
    )
ladanyi@679
   133
  ENDIF()
ladanyi@679
   134
ENDIF()
ladanyi@473
   135
alpar@225
   136
FOREACH(TEST_NAME ${TESTS})
alpar@904
   137
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@904
   138
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@904
   139
  ELSE()
alpar@904
   140
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@904
   141
  ENDIF()
alpar@225
   142
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@911
   143
    IF(TEST_WITH_VALGRIND)
alpar@911
   144
      ADD_TEST(${TEST_NAME}
alpar@911
   145
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@911
   146
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@911
   147
    ELSE()
alpar@911
   148
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@911
   149
    ENDIF()
alpar@904
   150
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@679
   151
ENDFOREACH()