test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Thu, 04 Aug 2011 22:02:45 +0200
branch1.2
changeset 1075 ece3d43d7e72
parent 1065 b522385b2a0d
parent 1067 54464584b157
child 1110 02c93d1f00d7
permissions -rw-r--r--
Merge AUTHORS file update to branch 1.2
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
kpeter@745
    16
  bellman_ford_test
ladanyi@141
    17
  bfs_test
alpar@443
    18
  circulation_test
kpeter@696
    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@559
    25
  edge_set_test
ladanyi@141
    26
  error_test
ladanyi@569
    27
  euler_test
deba@948
    28
  fractional_matching_test
tapolcai@590
    29
  gomory_hu_test
deba@200
    30
  graph_copy_test
ladanyi@141
    31
  graph_test
kpeter@171
    32
  graph_utils_test
deba@426
    33
  hao_orlin_test
deba@203
    34
  heap_test
ladanyi@141
    35
  kruskal_test
alpar@1067
    36
  lgf_test
ladanyi@141
    37
  maps_test
kpeter@641
    38
  matching_test
deba@522
    39
  min_cost_arborescence_test
kpeter@648
    40
  min_cost_flow_test
kpeter@810
    41
  min_mean_cycle_test
alpar@443
    42
  path_test
deba@861
    43
  planarity_test
alpar@443
    44
  preflow_test
ladanyi@496
    45
  radix_sort_test
alpar@225
    46
  random_test
alpar@443
    47
  suurballe_test
ladanyi@141
    48
  time_measure_test
ladanyi@726
    49
  unionfind_test
ladanyi@726
    50
)
ladanyi@539
    51
ladanyi@674
    52
IF(LEMON_HAVE_LP)
alpar@1033
    53
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    54
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@1033
    55
  ELSE()
alpar@1033
    56
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@1033
    57
  ENDIF()
alpar@1033
    58
ladanyi@667
    59
  SET(LP_TEST_LIBS lemon)
ladanyi@726
    60
ladanyi@674
    61
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    62
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    63
  ENDIF()
ladanyi@674
    64
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
    65
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
    66
  ENDIF()
ladanyi@674
    67
  IF(LEMON_HAVE_CLP)
ladanyi@668
    68
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@726
    69
  ENDIF()
ladanyi@726
    70
ladanyi@667
    71
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@496
    72
  ADD_TEST(lp_test lp_test)
alpar@1061
    73
  ADD_DEPENDENCIES(check lp_test)
ladanyi@496
    74
ladanyi@674
    75
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
    76
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@496
    77
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
    78
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    79
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
    80
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
    81
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
    82
    )
ladanyi@726
    83
  ENDIF()
ladanyi@726
    84
ladanyi@674
    85
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
    86
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@667
    87
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
    88
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    89
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@667
    90
    )
ladanyi@726
    91
  ENDIF()
ladanyi@726
    92
ENDIF()
ladanyi@496
    93
ladanyi@674
    94
IF(LEMON_HAVE_MIP)
alpar@1033
    95
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    96
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@1033
    97
  ELSE()
alpar@1033
    98
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@1033
    99
  ENDIF()
alpar@1033
   100
ladanyi@667
   101
  SET(MIP_TEST_LIBS lemon)
ladanyi@726
   102
ladanyi@674
   103
  IF(LEMON_HAVE_GLPK)
ladanyi@667
   104
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
   105
  ENDIF()
ladanyi@674
   106
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
   107
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
   108
  ENDIF()
ladanyi@674
   109
  IF(LEMON_HAVE_CBC)
ladanyi@668
   110
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@726
   111
  ENDIF()
ladanyi@726
   112
ladanyi@667
   113
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@496
   114
  ADD_TEST(mip_test mip_test)
alpar@1061
   115
  ADD_DEPENDENCIES(check mip_test)
ladanyi@496
   116
ladanyi@674
   117
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
   118
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@496
   119
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
   120
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   121
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
   122
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
   123
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
   124
    )
ladanyi@726
   125
  ENDIF()
ladanyi@726
   126
ladanyi@674
   127
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
   128
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@667
   129
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
   130
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   131
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@667
   132
    )
ladanyi@726
   133
  ENDIF()
ladanyi@726
   134
ENDIF()
ladanyi@141
   135
alpar@225
   136
FOREACH(TEST_NAME ${TESTS})
alpar@1033
   137
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
   138
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@1033
   139
  ELSE()
alpar@1033
   140
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@1033
   141
  ENDIF()
alpar@225
   142
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@1044
   143
    IF(TEST_WITH_VALGRIND)
alpar@1044
   144
      ADD_TEST(${TEST_NAME}
alpar@1044
   145
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@1044
   146
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@1044
   147
    ELSE()
alpar@1044
   148
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@1044
   149
    ENDIF()
alpar@1033
   150
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@726
   151
ENDFOREACH()