test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 26 Apr 2011 17:25:00 +0200
changeset 1059 4f9e5801224e
parent 1040 8e39ccaabf48
parent 1044 66156a3498ea
child 1066 f9e3f73e17f1
permissions -rw-r--r--
Merge bugfix #420
ladanyi@539
     1
INCLUDE_DIRECTORIES(
ladanyi@596
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@539
     3
  ${PROJECT_BINARY_DIR}
ladanyi@539
     4
)
ladanyi@141
     5
ladanyi@726
     6
LINK_DIRECTORIES(
ladanyi@726
     7
  ${PROJECT_BINARY_DIR}/lemon
ladanyi@726
     8
)
ladanyi@141
     9
alpar@1044
    10
SET(TEST_WITH_VALGRIND "NO" CACHE STRING
alpar@1044
    11
  "Run the test with valgrind (YES/NO).")
alpar@1044
    12
SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.")
alpar@1044
    13
alpar@225
    14
SET(TESTS
deba@559
    15
  adaptors_test
kpeter@745
    16
  bellman_ford_test
ladanyi@141
    17
  bfs_test
alpar@443
    18
  circulation_test
kpeter@696
    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@559
    25
  edge_set_test
ladanyi@141
    26
  error_test
ladanyi@569
    27
  euler_test
deba@948
    28
  fractional_matching_test
tapolcai@590
    29
  gomory_hu_test
deba@200
    30
  graph_copy_test
ladanyi@141
    31
  graph_test
kpeter@171
    32
  graph_utils_test
deba@426
    33
  hao_orlin_test
deba@203
    34
  heap_test
ladanyi@141
    35
  kruskal_test
ladanyi@141
    36
  maps_test
kpeter@641
    37
  matching_test
thoneyvazul@1020
    38
  max_cardinality_search_test
kpeter@999
    39
  max_clique_test
deba@522
    40
  min_cost_arborescence_test
kpeter@648
    41
  min_cost_flow_test
kpeter@810
    42
  min_mean_cycle_test
deba@1017
    43
  nagamochi_ibaraki_test
alpar@443
    44
  path_test
deba@861
    45
  planarity_test
alpar@443
    46
  preflow_test
ladanyi@496
    47
  radix_sort_test
alpar@225
    48
  random_test
alpar@443
    49
  suurballe_test
ladanyi@141
    50
  time_measure_test
ladanyi@726
    51
  unionfind_test
ladanyi@726
    52
)
ladanyi@141
    53
ladanyi@674
    54
IF(LEMON_HAVE_LP)
alpar@1033
    55
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    56
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@1033
    57
  ELSE()
alpar@1033
    58
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@1033
    59
  ENDIF()
alpar@1033
    60
ladanyi@667
    61
  SET(LP_TEST_LIBS lemon)
ladanyi@726
    62
ladanyi@674
    63
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    64
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    65
  ENDIF()
ladanyi@674
    66
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
    67
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
    68
  ENDIF()
ladanyi@674
    69
  IF(LEMON_HAVE_CLP)
ladanyi@668
    70
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@726
    71
  ENDIF()
ladanyi@726
    72
ladanyi@667
    73
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@496
    74
  ADD_TEST(lp_test lp_test)
ladanyi@496
    75
ladanyi@674
    76
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
    77
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@496
    78
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
    79
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    80
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
    81
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
    82
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
    83
    )
ladanyi@726
    84
  ENDIF()
ladanyi@726
    85
ladanyi@674
    86
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
    87
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@667
    88
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
    89
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    90
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@667
    91
    )
ladanyi@726
    92
  ENDIF()
ladanyi@726
    93
ENDIF()
ladanyi@496
    94
ladanyi@674
    95
IF(LEMON_HAVE_MIP)
alpar@1033
    96
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    97
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@1033
    98
  ELSE()
alpar@1033
    99
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@1033
   100
  ENDIF()
alpar@1033
   101
ladanyi@667
   102
  SET(MIP_TEST_LIBS lemon)
ladanyi@726
   103
ladanyi@674
   104
  IF(LEMON_HAVE_GLPK)
ladanyi@667
   105
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
   106
  ENDIF()
ladanyi@674
   107
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
   108
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
   109
  ENDIF()
ladanyi@674
   110
  IF(LEMON_HAVE_CBC)
ladanyi@668
   111
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@726
   112
  ENDIF()
ladanyi@726
   113
ladanyi@667
   114
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@496
   115
  ADD_TEST(mip_test mip_test)
ladanyi@496
   116
ladanyi@674
   117
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
   118
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@496
   119
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
   120
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   121
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
   122
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
   123
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
   124
    )
ladanyi@726
   125
  ENDIF()
ladanyi@726
   126
ladanyi@674
   127
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
   128
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@667
   129
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
   130
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   131
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@667
   132
    )
ladanyi@726
   133
  ENDIF()
ladanyi@726
   134
ENDIF()
ladanyi@496
   135
alpar@225
   136
FOREACH(TEST_NAME ${TESTS})
alpar@1033
   137
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
   138
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@1033
   139
  ELSE()
alpar@1033
   140
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@1033
   141
  ENDIF()
alpar@225
   142
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@1044
   143
    IF(TEST_WITH_VALGRIND)
alpar@1044
   144
      ADD_TEST(${TEST_NAME}
alpar@1044
   145
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@1044
   146
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@1044
   147
    ELSE()
alpar@1044
   148
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@1044
   149
    ENDIF()
alpar@1033
   150
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@726
   151
ENDFOREACH()