test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Fri, 22 Jun 2012 16:25:56 +0200
changeset 990 7440937d154b
parent 959 17e36e175725
child 974 b1744d7bdb47
child 993 157427808b40
permissions -rw-r--r--
Bugfix in path copy constructors and assignment operators (#444)
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
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@488
    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@949
    34
  lgf_test
ladanyi@141
    35
  maps_test
kpeter@594
    36
  matching_test
deba@501
    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@510
    47
ladanyi@627
    48
IF(LEMON_HAVE_LP)
alpar@927
    49
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
    50
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@927
    51
  ELSE()
alpar@927
    52
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@927
    53
  ENDIF()
alpar@927
    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@945
    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
alpar@972
    85
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.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@927
    91
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
    92
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@927
    93
  ELSE()
alpar@927
    94
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@927
    95
  ENDIF()
alpar@927
    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@945
   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
alpar@972
   127
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.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@927
   133
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
   134
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@927
   135
  ELSE()
alpar@927
   136
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@927
   137
  ENDIF()
alpar@225
   138
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@933
   139
    IF(TEST_WITH_VALGRIND)
alpar@933
   140
      ADD_TEST(${TEST_NAME}
alpar@933
   141
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@933
   142
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@933
   143
    ELSE()
alpar@933
   144
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@933
   145
    ENDIF()
alpar@927
   146
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@679
   147
ENDFOREACH()