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