test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Wed, 15 May 2019 13:33:55 +0200
branch1.2
changeset 1424 7edc220d6244
parent 1151 0da74b2d0bea
parent 1159 7fdaa05a69a1
permissions -rw-r--r--
Backport relevant parts of bugfixes [ad22262328b3], [61fdd06833a6] and [4add05447ca0] to branch 1.2 (#623)
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@539
     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.")
ladanyi@141
    13
alpar@225
    14
SET(TESTS
deba@559
    15
  adaptors_test
alpar@1149
    16
  arc_look_up_test
kpeter@745
    17
  bellman_ford_test
ladanyi@141
    18
  bfs_test
alpar@443
    19
  circulation_test
kpeter@696
    20
  connectivity_test
ladanyi@141
    21
  counter_test
ladanyi@141
    22
  dfs_test
ladanyi@141
    23
  digraph_test
kpeter@170
    24
  dijkstra_test
ladanyi@141
    25
  dim_test
deba@559
    26
  edge_set_test
ladanyi@141
    27
  error_test
ladanyi@569
    28
  euler_test
deba@948
    29
  fractional_matching_test
tapolcai@590
    30
  gomory_hu_test
deba@200
    31
  graph_copy_test
ladanyi@141
    32
  graph_test
kpeter@171
    33
  graph_utils_test
deba@426
    34
  hao_orlin_test
deba@203
    35
  heap_test
ladanyi@141
    36
  kruskal_test
alpar@1067
    37
  lgf_test
ladanyi@141
    38
  maps_test
kpeter@641
    39
  matching_test
deba@522
    40
  min_cost_arborescence_test
kpeter@648
    41
  min_cost_flow_test
kpeter@810
    42
  min_mean_cycle_test
alpar@443
    43
  path_test
deba@861
    44
  planarity_test
alpar@443
    45
  preflow_test
ladanyi@496
    46
  radix_sort_test
alpar@225
    47
  random_test
alpar@443
    48
  suurballe_test
ladanyi@141
    49
  time_measure_test
ladanyi@726
    50
  unionfind_test
ladanyi@726
    51
)
ladanyi@539
    52
ladanyi@674
    53
IF(LEMON_HAVE_LP)
alpar@1033
    54
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    55
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@1033
    56
  ELSE()
alpar@1033
    57
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@1033
    58
  ENDIF()
alpar@1033
    59
ladanyi@667
    60
  SET(LP_TEST_LIBS lemon)
ladanyi@726
    61
ladanyi@674
    62
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    63
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    64
  ENDIF()
ladanyi@674
    65
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
    66
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
    67
  ENDIF()
ladanyi@674
    68
  IF(LEMON_HAVE_CLP)
ladanyi@668
    69
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@726
    70
  ENDIF()
ladanyi@726
    71
ladanyi@667
    72
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@496
    73
  ADD_TEST(lp_test lp_test)
alpar@1061
    74
  ADD_DEPENDENCIES(check 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
alpar@1119
    90
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.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)
alpar@1061
   116
  ADD_DEPENDENCIES(check mip_test)
ladanyi@496
   117
ladanyi@674
   118
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
   119
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@496
   120
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
   121
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   122
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
   123
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
   124
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
   125
    )
ladanyi@726
   126
  ENDIF()
ladanyi@726
   127
ladanyi@674
   128
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
   129
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@667
   130
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
   131
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@1119
   132
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
   133
    )
ladanyi@726
   134
  ENDIF()
ladanyi@726
   135
ENDIF()
ladanyi@141
   136
alpar@225
   137
FOREACH(TEST_NAME ${TESTS})
alpar@1033
   138
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
   139
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@1033
   140
  ELSE()
alpar@1033
   141
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@1033
   142
  ENDIF()
alpar@225
   143
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@1044
   144
    IF(TEST_WITH_VALGRIND)
alpar@1044
   145
      ADD_TEST(${TEST_NAME}
alpar@1044
   146
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@1044
   147
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@1044
   148
    ELSE()
alpar@1044
   149
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@1044
   150
    ENDIF()
alpar@1033
   151
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@726
   152
ENDFOREACH()