test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Tue, 30 Jul 2013 15:03:53 +0200
changeset 800 756022ac1674
parent 780 1818cc848005
permissions -rw-r--r--
Suppress 'unused local typedefs' warnings, and resolve others (#470)
ladanyi@620
     1
INCLUDE_DIRECTORIES(
ladanyi@538
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@620
     3
  ${PROJECT_BINARY_DIR}
ladanyi@620
     4
)
ladanyi@141
     5
ladanyi@681
     6
LINK_DIRECTORIES(
ladanyi@681
     7
  ${PROJECT_BINARY_DIR}/lemon
ladanyi@681
     8
)
ladanyi@620
     9
alpar@747
    10
SET(TEST_WITH_VALGRIND "NO" CACHE STRING
alpar@747
    11
  "Run the test with valgrind (YES/NO).")
alpar@747
    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@789
    16
  arc_look_up_test
ladanyi@141
    17
  bfs_test
alpar@424
    18
  circulation_test
kpeter@647
    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@506
    27
  euler_test
tapolcai@531
    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@756
    35
  lgf_test
ladanyi@141
    36
  maps_test
kpeter@586
    37
  matching_test
deba@512
    38
  min_cost_arborescence_test
kpeter@593
    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@681
    46
  unionfind_test
ladanyi@681
    47
)
ladanyi@620
    48
ladanyi@622
    49
IF(LEMON_HAVE_LP)
alpar@742
    50
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@742
    51
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@742
    52
  ELSE()
alpar@742
    53
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@742
    54
  ENDIF()
alpar@742
    55
ladanyi@612
    56
  SET(LP_TEST_LIBS lemon)
ladanyi@681
    57
ladanyi@622
    58
  IF(LEMON_HAVE_GLPK)
ladanyi@612
    59
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@681
    60
  ENDIF()
ladanyi@622
    61
  IF(LEMON_HAVE_CPLEX)
ladanyi@612
    62
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@681
    63
  ENDIF()
ladanyi@622
    64
  IF(LEMON_HAVE_CLP)
ladanyi@613
    65
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@681
    66
  ENDIF()
ladanyi@681
    67
ladanyi@612
    68
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    69
  ADD_TEST(lp_test lp_test)
alpar@752
    70
  ADD_DEPENDENCIES(check lp_test)
ladanyi@473
    71
ladanyi@622
    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@681
    76
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@681
    77
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@681
    78
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    79
    )
ladanyi@681
    80
  ENDIF()
ladanyi@681
    81
ladanyi@622
    82
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@612
    83
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@612
    84
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@612
    85
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
alpar@780
    86
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@612
    87
    )
ladanyi@681
    88
  ENDIF()
ladanyi@681
    89
ENDIF()
ladanyi@473
    90
ladanyi@622
    91
IF(LEMON_HAVE_MIP)
alpar@742
    92
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@742
    93
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@742
    94
  ELSE()
alpar@742
    95
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@742
    96
  ENDIF()
alpar@742
    97
ladanyi@612
    98
  SET(MIP_TEST_LIBS lemon)
ladanyi@681
    99
ladanyi@622
   100
  IF(LEMON_HAVE_GLPK)
ladanyi@612
   101
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@681
   102
  ENDIF()
ladanyi@622
   103
  IF(LEMON_HAVE_CPLEX)
ladanyi@612
   104
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@681
   105
  ENDIF()
ladanyi@622
   106
  IF(LEMON_HAVE_CBC)
ladanyi@613
   107
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@681
   108
  ENDIF()
ladanyi@681
   109
ladanyi@612
   110
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
   111
  ADD_TEST(mip_test mip_test)
alpar@752
   112
  ADD_DEPENDENCIES(check mip_test)
ladanyi@473
   113
ladanyi@622
   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@681
   118
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@681
   119
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@681
   120
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
   121
    )
ladanyi@681
   122
  ENDIF()
ladanyi@681
   123
ladanyi@622
   124
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@612
   125
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@612
   126
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@612
   127
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@780
   128
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@612
   129
    )
ladanyi@681
   130
  ENDIF()
ladanyi@681
   131
ENDIF()
ladanyi@141
   132
alpar@225
   133
FOREACH(TEST_NAME ${TESTS})
alpar@742
   134
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@742
   135
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@742
   136
  ELSE()
alpar@742
   137
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@742
   138
  ENDIF()
alpar@225
   139
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@747
   140
    IF(TEST_WITH_VALGRIND)
alpar@747
   141
      ADD_TEST(${TEST_NAME}
alpar@747
   142
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@747
   143
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@747
   144
    ELSE()
alpar@747
   145
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@747
   146
    ENDIF()
alpar@742
   147
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@681
   148
ENDFOREACH()