test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Fri, 09 Aug 2013 14:01:24 +0200
branch1.1
changeset 1267 bd24650d5cd2
parent 1119 1818cc848005
child 1151 0da74b2d0bea
child 1152 20ae244b4779
child 1159 7fdaa05a69a1
permissions -rw-r--r--
Merge bugfix #439 to branch 1.1
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
alpar@1149
    16
  arc_look_up_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
tapolcai@590
    28
  gomory_hu_test
deba@200
    29
  graph_copy_test
ladanyi@141
    30
  graph_test
kpeter@171
    31
  graph_utils_test
deba@426
    32
  hao_orlin_test
deba@203
    33
  heap_test
ladanyi@141
    34
  kruskal_test
alpar@1067
    35
  lgf_test
ladanyi@141
    36
  maps_test
kpeter@641
    37
  matching_test
deba@522
    38
  min_cost_arborescence_test
kpeter@648
    39
  min_cost_flow_test
alpar@443
    40
  path_test
alpar@443
    41
  preflow_test
ladanyi@496
    42
  radix_sort_test
alpar@225
    43
  random_test
alpar@443
    44
  suurballe_test
ladanyi@141
    45
  time_measure_test
ladanyi@726
    46
  unionfind_test
ladanyi@726
    47
)
ladanyi@539
    48
ladanyi@674
    49
IF(LEMON_HAVE_LP)
alpar@1033
    50
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    51
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@1033
    52
  ELSE()
alpar@1033
    53
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@1033
    54
  ENDIF()
alpar@1033
    55
ladanyi@667
    56
  SET(LP_TEST_LIBS lemon)
ladanyi@726
    57
ladanyi@674
    58
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    59
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    60
  ENDIF()
ladanyi@674
    61
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
    62
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
    63
  ENDIF()
ladanyi@674
    64
  IF(LEMON_HAVE_CLP)
ladanyi@668
    65
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@726
    66
  ENDIF()
ladanyi@726
    67
ladanyi@667
    68
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@496
    69
  ADD_TEST(lp_test lp_test)
alpar@1061
    70
  ADD_DEPENDENCIES(check lp_test)
ladanyi@496
    71
ladanyi@674
    72
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
    73
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@496
    74
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
    75
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    76
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
    77
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
    78
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
    79
    )
ladanyi@726
    80
  ENDIF()
ladanyi@726
    81
ladanyi@674
    82
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
    83
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@667
    84
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
    85
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
alpar@1119
    86
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
    87
    )
ladanyi@726
    88
  ENDIF()
ladanyi@726
    89
ENDIF()
ladanyi@496
    90
ladanyi@674
    91
IF(LEMON_HAVE_MIP)
alpar@1033
    92
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    93
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@1033
    94
  ELSE()
alpar@1033
    95
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@1033
    96
  ENDIF()
alpar@1033
    97
ladanyi@667
    98
  SET(MIP_TEST_LIBS lemon)
ladanyi@726
    99
ladanyi@674
   100
  IF(LEMON_HAVE_GLPK)
ladanyi@667
   101
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
   102
  ENDIF()
ladanyi@674
   103
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
   104
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
   105
  ENDIF()
ladanyi@674
   106
  IF(LEMON_HAVE_CBC)
ladanyi@668
   107
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@726
   108
  ENDIF()
ladanyi@726
   109
ladanyi@667
   110
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@496
   111
  ADD_TEST(mip_test mip_test)
alpar@1061
   112
  ADD_DEPENDENCIES(check mip_test)
ladanyi@496
   113
ladanyi@674
   114
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
   115
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@496
   116
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
   117
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   118
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
   119
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
   120
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
   121
    )
ladanyi@726
   122
  ENDIF()
ladanyi@726
   123
ladanyi@674
   124
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
   125
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@667
   126
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
   127
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@1119
   128
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
   129
    )
ladanyi@726
   130
  ENDIF()
ladanyi@726
   131
ENDIF()
ladanyi@141
   132
alpar@225
   133
FOREACH(TEST_NAME ${TESTS})
alpar@1033
   134
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
   135
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@1033
   136
  ELSE()
alpar@1033
   137
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@1033
   138
  ENDIF()
alpar@225
   139
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@1044
   140
    IF(TEST_WITH_VALGRIND)
alpar@1044
   141
      ADD_TEST(${TEST_NAME}
alpar@1044
   142
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@1044
   143
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@1044
   144
    ELSE()
alpar@1044
   145
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@1044
   146
    ENDIF()
alpar@1033
   147
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@726
   148
ENDFOREACH()