test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 12 Apr 2011 07:46:34 +0200
branch1.1
changeset 1054 632a72b27123
parent 1033 16d466589b54
child 1050 78b9fb1f4454
child 1051 cc9bb4f95ed3
child 1061 2024bf2ecdd6
permissions -rw-r--r--
Merge #418 to branch 1.1
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
ladanyi@141
    16
  bfs_test
alpar@443
    17
  circulation_test
kpeter@696
    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@559
    24
  edge_set_test
ladanyi@141
    25
  error_test
ladanyi@569
    26
  euler_test
tapolcai@590
    27
  gomory_hu_test
deba@200
    28
  graph_copy_test
ladanyi@141
    29
  graph_test
kpeter@171
    30
  graph_utils_test
deba@426
    31
  hao_orlin_test
deba@203
    32
  heap_test
ladanyi@141
    33
  kruskal_test
ladanyi@141
    34
  maps_test
kpeter@641
    35
  matching_test
deba@522
    36
  min_cost_arborescence_test
kpeter@648
    37
  min_cost_flow_test
alpar@443
    38
  path_test
alpar@443
    39
  preflow_test
ladanyi@496
    40
  radix_sort_test
alpar@225
    41
  random_test
alpar@443
    42
  suurballe_test
ladanyi@141
    43
  time_measure_test
ladanyi@726
    44
  unionfind_test
ladanyi@726
    45
)
ladanyi@141
    46
ladanyi@674
    47
IF(LEMON_HAVE_LP)
alpar@1033
    48
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    49
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@1033
    50
  ELSE()
alpar@1033
    51
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@1033
    52
  ENDIF()
alpar@1033
    53
ladanyi@667
    54
  SET(LP_TEST_LIBS lemon)
ladanyi@726
    55
ladanyi@674
    56
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    57
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    58
  ENDIF()
ladanyi@674
    59
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
    60
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
    61
  ENDIF()
ladanyi@674
    62
  IF(LEMON_HAVE_CLP)
ladanyi@668
    63
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@726
    64
  ENDIF()
ladanyi@726
    65
ladanyi@667
    66
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@496
    67
  ADD_TEST(lp_test lp_test)
ladanyi@496
    68
ladanyi@674
    69
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
    70
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@496
    71
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
    72
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    73
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
    74
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
    75
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
    76
    )
ladanyi@726
    77
  ENDIF()
ladanyi@726
    78
ladanyi@674
    79
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
    80
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@667
    81
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
    82
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    83
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@667
    84
    )
ladanyi@726
    85
  ENDIF()
ladanyi@726
    86
ENDIF()
ladanyi@496
    87
ladanyi@674
    88
IF(LEMON_HAVE_MIP)
alpar@1033
    89
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    90
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@1033
    91
  ELSE()
alpar@1033
    92
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@1033
    93
  ENDIF()
alpar@1033
    94
ladanyi@667
    95
  SET(MIP_TEST_LIBS lemon)
ladanyi@726
    96
ladanyi@674
    97
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    98
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    99
  ENDIF()
ladanyi@674
   100
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
   101
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
   102
  ENDIF()
ladanyi@674
   103
  IF(LEMON_HAVE_CBC)
ladanyi@668
   104
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@726
   105
  ENDIF()
ladanyi@726
   106
ladanyi@667
   107
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@496
   108
  ADD_TEST(mip_test mip_test)
ladanyi@496
   109
ladanyi@674
   110
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
   111
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@496
   112
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
   113
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   114
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
   115
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
   116
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
   117
    )
ladanyi@726
   118
  ENDIF()
ladanyi@726
   119
ladanyi@674
   120
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
   121
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@667
   122
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
   123
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   124
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@667
   125
    )
ladanyi@726
   126
  ENDIF()
ladanyi@726
   127
ENDIF()
ladanyi@496
   128
alpar@225
   129
FOREACH(TEST_NAME ${TESTS})
alpar@1033
   130
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
   131
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@1033
   132
  ELSE()
alpar@1033
   133
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@1033
   134
  ENDIF()
alpar@225
   135
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@1044
   136
    IF(TEST_WITH_VALGRIND)
alpar@1044
   137
      ADD_TEST(${TEST_NAME}
alpar@1044
   138
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@1044
   139
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@1044
   140
    ELSE()
alpar@1044
   141
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@1044
   142
    ENDIF()
alpar@1033
   143
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@726
   144
ENDFOREACH()