test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Sat, 25 May 2013 06:59:31 +0200
changeset 1064 fc3854d936f7
parent 1000 404b98971e1f
child 1065 490d89913a17
permissions -rw-r--r--
Enable/disable options for LP/MIP backends (#465)
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
thoneyvazul@916
    40
  max_cardinality_search_test
kpeter@904
    41
  max_clique_test
deba@501
    42
  min_cost_arborescence_test
kpeter@601
    43
  min_cost_flow_test
kpeter@763
    44
  min_mean_cycle_test
deba@913
    45
  nagamochi_ibaraki_test
alpar@424
    46
  path_test
deba@797
    47
  planarity_test
alpar@424
    48
  preflow_test
ladanyi@473
    49
  radix_sort_test
alpar@225
    50
  random_test
alpar@424
    51
  suurballe_test
ladanyi@141
    52
  time_measure_test
ladanyi@679
    53
  unionfind_test
ladanyi@679
    54
)
ladanyi@510
    55
ladanyi@627
    56
IF(LEMON_HAVE_LP)
alpar@927
    57
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
    58
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@927
    59
  ELSE()
alpar@927
    60
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@927
    61
  ENDIF()
alpar@927
    62
ladanyi@620
    63
  SET(LP_TEST_LIBS lemon)
ladanyi@679
    64
ladanyi@627
    65
  IF(LEMON_HAVE_GLPK)
ladanyi@620
    66
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
    67
  ENDIF()
ladanyi@627
    68
  IF(LEMON_HAVE_CPLEX)
alpar@1062
    69
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${ILOG_LIBRARIES})
ladanyi@679
    70
  ENDIF()
ladanyi@627
    71
  IF(LEMON_HAVE_CLP)
ladanyi@621
    72
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@679
    73
  ENDIF()
ladanyi@679
    74
ladanyi@620
    75
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    76
  ADD_TEST(lp_test lp_test)
alpar@945
    77
  ADD_DEPENDENCIES(check lp_test)
ladanyi@473
    78
ladanyi@627
    79
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
    80
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    81
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    82
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@679
    83
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
    84
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
    85
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    86
    )
ladanyi@679
    87
  ENDIF()
ladanyi@679
    88
ladanyi@627
    89
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
    90
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    91
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    92
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
alpar@1062
    93
      COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}
ladanyi@620
    94
    )
ladanyi@679
    95
  ENDIF()
ladanyi@679
    96
ENDIF()
ladanyi@473
    97
ladanyi@627
    98
IF(LEMON_HAVE_MIP)
alpar@927
    99
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
   100
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@927
   101
  ELSE()
alpar@927
   102
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@927
   103
  ENDIF()
alpar@927
   104
ladanyi@620
   105
  SET(MIP_TEST_LIBS lemon)
ladanyi@679
   106
ladanyi@627
   107
  IF(LEMON_HAVE_GLPK)
ladanyi@620
   108
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@679
   109
  ENDIF()
ladanyi@627
   110
  IF(LEMON_HAVE_CPLEX)
alpar@1062
   111
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${ILOG_LIBRARIES})
ladanyi@679
   112
  ENDIF()
ladanyi@627
   113
  IF(LEMON_HAVE_CBC)
ladanyi@621
   114
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@679
   115
  ENDIF()
ladanyi@679
   116
ladanyi@620
   117
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   118
  ADD_TEST(mip_test mip_test)
alpar@945
   119
  ADD_DEPENDENCIES(check mip_test)
ladanyi@473
   120
ladanyi@627
   121
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@473
   122
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
   123
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
   124
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@679
   125
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@679
   126
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@679
   127
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   128
    )
ladanyi@679
   129
  ENDIF()
ladanyi@679
   130
ladanyi@627
   131
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@620
   132
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
   133
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
   134
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@1062
   135
      COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}
ladanyi@620
   136
    )
ladanyi@679
   137
  ENDIF()
ladanyi@679
   138
ENDIF()
ladanyi@141
   139
alpar@225
   140
FOREACH(TEST_NAME ${TESTS})
alpar@927
   141
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@927
   142
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@927
   143
  ELSE()
alpar@927
   144
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@927
   145
  ENDIF()
alpar@225
   146
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@933
   147
    IF(TEST_WITH_VALGRIND)
alpar@933
   148
      ADD_TEST(${TEST_NAME}
alpar@933
   149
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@933
   150
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@933
   151
    ELSE()
alpar@933
   152
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@933
   153
    ENDIF()
alpar@927
   154
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@679
   155
ENDFOREACH()