test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 12 Apr 2011 07:52:25 +0200
branch1.2
changeset 1055 60f4aaedb20f
parent 1035 d149eaf24638
parent 1044 66156a3498ea
child 1065 b522385b2a0d
permissions -rw-r--r--
Merge #418 to branch 1.2
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
deba@522
    38
  min_cost_arborescence_test
kpeter@648
    39
  min_cost_flow_test
kpeter@810
    40
  min_mean_cycle_test
alpar@443
    41
  path_test
deba@861
    42
  planarity_test
alpar@443
    43
  preflow_test
ladanyi@496
    44
  radix_sort_test
alpar@225
    45
  random_test
alpar@443
    46
  suurballe_test
ladanyi@141
    47
  time_measure_test
ladanyi@726
    48
  unionfind_test
ladanyi@726
    49
)
ladanyi@141
    50
ladanyi@674
    51
IF(LEMON_HAVE_LP)
alpar@1033
    52
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    53
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@1033
    54
  ELSE()
alpar@1033
    55
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@1033
    56
  ENDIF()
alpar@1033
    57
ladanyi@667
    58
  SET(LP_TEST_LIBS lemon)
ladanyi@726
    59
ladanyi@674
    60
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    61
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    62
  ENDIF()
ladanyi@674
    63
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
    64
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
    65
  ENDIF()
ladanyi@674
    66
  IF(LEMON_HAVE_CLP)
ladanyi@668
    67
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@726
    68
  ENDIF()
ladanyi@726
    69
ladanyi@667
    70
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@496
    71
  ADD_TEST(lp_test lp_test)
ladanyi@496
    72
ladanyi@674
    73
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
    74
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@496
    75
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
    76
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    77
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
    78
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
    79
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
    80
    )
ladanyi@726
    81
  ENDIF()
ladanyi@726
    82
ladanyi@674
    83
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
    84
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@667
    85
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
    86
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    87
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@667
    88
    )
ladanyi@726
    89
  ENDIF()
ladanyi@726
    90
ENDIF()
ladanyi@496
    91
ladanyi@674
    92
IF(LEMON_HAVE_MIP)
alpar@1033
    93
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    94
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@1033
    95
  ELSE()
alpar@1033
    96
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@1033
    97
  ENDIF()
alpar@1033
    98
ladanyi@667
    99
  SET(MIP_TEST_LIBS lemon)
ladanyi@726
   100
ladanyi@674
   101
  IF(LEMON_HAVE_GLPK)
ladanyi@667
   102
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
   103
  ENDIF()
ladanyi@674
   104
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
   105
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
   106
  ENDIF()
ladanyi@674
   107
  IF(LEMON_HAVE_CBC)
ladanyi@668
   108
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@726
   109
  ENDIF()
ladanyi@726
   110
ladanyi@667
   111
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@496
   112
  ADD_TEST(mip_test mip_test)
ladanyi@496
   113
ladanyi@674
   114
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
   115
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@496
   116
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
   117
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   118
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
   119
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
   120
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
   121
    )
ladanyi@726
   122
  ENDIF()
ladanyi@726
   123
ladanyi@674
   124
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
   125
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@667
   126
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
   127
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   128
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@667
   129
    )
ladanyi@726
   130
  ENDIF()
ladanyi@726
   131
ENDIF()
ladanyi@496
   132
alpar@225
   133
FOREACH(TEST_NAME ${TESTS})
alpar@1033
   134
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
   135
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@1033
   136
  ELSE()
alpar@1033
   137
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@1033
   138
  ENDIF()
alpar@225
   139
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@1044
   140
    IF(TEST_WITH_VALGRIND)
alpar@1044
   141
      ADD_TEST(${TEST_NAME}
alpar@1044
   142
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@1044
   143
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@1044
   144
    ELSE()
alpar@1044
   145
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@1044
   146
    ENDIF()
alpar@1033
   147
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@726
   148
ENDFOREACH()