test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Fri, 09 Aug 2013 11:07:27 +0200
changeset 1090 70b199792735
parent 972 1818cc848005
child 994 20ae244b4779
child 998 7fdaa05a69a1
permissions -rw-r--r--
Clarification in biNodeConnected() doc (#439)
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@510
     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.")
ladanyi@141
    13
alpar@225
    14
SET(TESTS
deba@488
    15
  adaptors_test
alpar@993
    16
  arc_look_up_test
ladanyi@141
    17
  bfs_test
alpar@424
    18
  circulation_test
kpeter@649
    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@488
    25
  edge_set_test
ladanyi@141
    26
  error_test
ladanyi@522
    27
  euler_test
tapolcai@543
    28
  gomory_hu_test
deba@200
    29
  graph_copy_test
ladanyi@141
    30
  graph_test
kpeter@171
    31
  graph_utils_test
deba@410
    32
  hao_orlin_test
deba@203
    33
  heap_test
ladanyi@141
    34
  kruskal_test
alpar@949
    35
  lgf_test
ladanyi@141
    36
  maps_test
kpeter@594
    37
  matching_test
deba@501
    38
  min_cost_arborescence_test
kpeter@601
    39
  min_cost_flow_test
alpar@424
    40
  path_test
alpar@424
    41
  preflow_test
ladanyi@473
    42
  radix_sort_test
alpar@225
    43
  random_test
alpar@424
    44
  suurballe_test
ladanyi@141
    45
  time_measure_test
ladanyi@679
    46
  unionfind_test
ladanyi@679
    47
)
ladanyi@510
    48
ladanyi@627
    49
IF(LEMON_HAVE_LP)
alpar@927
    50
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
    51
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@927
    52
  ELSE()
alpar@927
    53
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@927
    54
  ENDIF()
alpar@927
    55
ladanyi@620
    56
  SET(LP_TEST_LIBS lemon)
ladanyi@679
    57
ladanyi@627
    58
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    59
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
    60
  ENDIF()
ladanyi@627
    61
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
    62
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
    63
  ENDIF()
ladanyi@627
    64
  IF(LEMON_HAVE_CLP)
ladanyi@621
    65
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@679
    66
  ENDIF()
ladanyi@679
    67
ladanyi@620
    68
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    69
  ADD_TEST(lp_test lp_test)
alpar@945
    70
  ADD_DEPENDENCIES(check lp_test)
ladanyi@473
    71
ladanyi@627
    72
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    73
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    74
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    75
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    76
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
    77
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
    78
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    79
    )
ladanyi@679
    80
  ENDIF()
ladanyi@679
    81
ladanyi@627
    82
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    83
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    84
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    85
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
alpar@972
    86
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@620
    87
    )
ladanyi@679
    88
  ENDIF()
ladanyi@679
    89
ENDIF()
ladanyi@473
    90
ladanyi@627
    91
IF(LEMON_HAVE_MIP)
alpar@927
    92
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
    93
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@927
    94
  ELSE()
alpar@927
    95
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@927
    96
  ENDIF()
alpar@927
    97
ladanyi@620
    98
  SET(MIP_TEST_LIBS lemon)
ladanyi@679
    99
ladanyi@627
   100
  IF(LEMON_HAVE_GLPK)
ladanyi@620
   101
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
   102
  ENDIF()
ladanyi@627
   103
  IF(LEMON_HAVE_CPLEX)
ladanyi@620
   104
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@679
   105
  ENDIF()
ladanyi@627
   106
  IF(LEMON_HAVE_CBC)
ladanyi@621
   107
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@679
   108
  ENDIF()
ladanyi@679
   109
ladanyi@620
   110
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   111
  ADD_TEST(mip_test mip_test)
alpar@945
   112
  ADD_DEPENDENCIES(check mip_test)
ladanyi@473
   113
ladanyi@627
   114
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
   115
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
   116
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
   117
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   118
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
   119
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
   120
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   121
    )
ladanyi@679
   122
  ENDIF()
ladanyi@679
   123
ladanyi@627
   124
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
   125
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
   126
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
   127
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@972
   128
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@620
   129
    )
ladanyi@679
   130
  ENDIF()
ladanyi@679
   131
ENDIF()
ladanyi@141
   132
alpar@225
   133
FOREACH(TEST_NAME ${TESTS})
alpar@927
   134
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
   135
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@927
   136
  ELSE()
alpar@927
   137
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@927
   138
  ENDIF()
alpar@225
   139
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@933
   140
    IF(TEST_WITH_VALGRIND)
alpar@933
   141
      ADD_TEST(${TEST_NAME}
alpar@933
   142
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@933
   143
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@933
   144
    ELSE()
alpar@933
   145
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@933
   146
    ENDIF()
alpar@927
   147
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@679
   148
ENDFOREACH()