test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Fri, 15 Apr 2011 09:40:17 +0200
changeset 946 1f1328691a07
parent 933 66156a3498ea
child 948 f9e3f73e17f1
child 959 17e36e175725
permissions -rw-r--r--
Also search for coin libs under ${COIN_ROOT_DIR}/lib/coin (#419)
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@141
     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.")
alpar@933
    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
ladanyi@141
    34
  maps_test
kpeter@594
    35
  matching_test
deba@501
    36
  min_cost_arborescence_test
kpeter@601
    37
  min_cost_flow_test
alpar@424
    38
  path_test
alpar@424
    39
  preflow_test
ladanyi@473
    40
  radix_sort_test
alpar@225
    41
  random_test
alpar@424
    42
  suurballe_test
ladanyi@141
    43
  time_measure_test
ladanyi@679
    44
  unionfind_test
ladanyi@679
    45
)
ladanyi@141
    46
ladanyi@627
    47
IF(LEMON_HAVE_LP)
alpar@927
    48
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
    49
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@927
    50
  ELSE()
alpar@927
    51
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@927
    52
  ENDIF()
alpar@927
    53
ladanyi@620
    54
  SET(LP_TEST_LIBS lemon)
ladanyi@679
    55
ladanyi@627
    56
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    57
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
    58
  ENDIF()
ladanyi@627
    59
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    60
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
    61
  ENDIF()
ladanyi@627
    62
  IF(LEMON_HAVE_CLP)
ladanyi@621
    63
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@679
    64
  ENDIF()
ladanyi@679
    65
ladanyi@620
    66
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    67
  ADD_TEST(lp_test lp_test)
alpar@945
    68
  ADD_DEPENDENCIES(check lp_test)
ladanyi@473
    69
ladanyi@627
    70
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    71
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    72
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    73
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    74
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
    75
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
    76
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    77
    )
ladanyi@679
    78
  ENDIF()
ladanyi@679
    79
ladanyi@627
    80
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    81
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    82
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    83
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    84
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
    85
    )
ladanyi@679
    86
  ENDIF()
ladanyi@679
    87
ENDIF()
ladanyi@473
    88
ladanyi@627
    89
IF(LEMON_HAVE_MIP)
alpar@927
    90
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
    91
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@927
    92
  ELSE()
alpar@927
    93
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@927
    94
  ENDIF()
alpar@927
    95
ladanyi@620
    96
  SET(MIP_TEST_LIBS lemon)
ladanyi@679
    97
ladanyi@627
    98
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    99
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
   100
  ENDIF()
ladanyi@627
   101
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
   102
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
   103
  ENDIF()
ladanyi@627
   104
  IF(LEMON_HAVE_CBC)
ladanyi@621
   105
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@679
   106
  ENDIF()
ladanyi@679
   107
ladanyi@620
   108
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   109
  ADD_TEST(mip_test mip_test)
alpar@945
   110
  ADD_DEPENDENCIES(check mip_test)
ladanyi@473
   111
ladanyi@627
   112
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
   113
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
   114
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
   115
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   116
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
   117
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
   118
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   119
    )
ladanyi@679
   120
  ENDIF()
ladanyi@679
   121
ladanyi@627
   122
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
   123
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
   124
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
   125
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   126
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
   127
    )
ladanyi@679
   128
  ENDIF()
ladanyi@679
   129
ENDIF()
ladanyi@473
   130
alpar@225
   131
FOREACH(TEST_NAME ${TESTS})
alpar@927
   132
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
   133
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@927
   134
  ELSE()
alpar@927
   135
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@927
   136
  ENDIF()
alpar@225
   137
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@933
   138
    IF(TEST_WITH_VALGRIND)
alpar@933
   139
      ADD_TEST(${TEST_NAME}
alpar@933
   140
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@933
   141
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@933
   142
    ELSE()
alpar@933
   143
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@933
   144
    ENDIF()
alpar@927
   145
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@679
   146
ENDFOREACH()