test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Thu, 19 Jan 2012 15:25:06 +0100
changeset 1125 b873350e6258
parent 1069 b1b534ddb539
child 1122 0976225b5cae
child 1124 b1744d7bdb47
child 1149 157427808b40
permissions -rw-r--r--
Intel C++ compatibility fixes
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
ladanyi@141
    16
  bfs_test
alpar@443
    17
  circulation_test
kpeter@696
    18
  connectivity_test
ladanyi@141
    19
  counter_test
ladanyi@141
    20
  dfs_test
ladanyi@141
    21
  digraph_test
kpeter@170
    22
  dijkstra_test
ladanyi@141
    23
  dim_test
deba@559
    24
  edge_set_test
ladanyi@141
    25
  error_test
ladanyi@569
    26
  euler_test
tapolcai@590
    27
  gomory_hu_test
deba@200
    28
  graph_copy_test
ladanyi@141
    29
  graph_test
kpeter@171
    30
  graph_utils_test
deba@426
    31
  hao_orlin_test
deba@203
    32
  heap_test
ladanyi@141
    33
  kruskal_test
alpar@1067
    34
  lgf_test
ladanyi@141
    35
  maps_test
kpeter@641
    36
  matching_test
deba@522
    37
  min_cost_arborescence_test
kpeter@648
    38
  min_cost_flow_test
alpar@443
    39
  path_test
alpar@443
    40
  preflow_test
ladanyi@496
    41
  radix_sort_test
alpar@225
    42
  random_test
alpar@443
    43
  suurballe_test
ladanyi@141
    44
  time_measure_test
ladanyi@726
    45
  unionfind_test
ladanyi@726
    46
)
ladanyi@539
    47
ladanyi@674
    48
IF(LEMON_HAVE_LP)
alpar@1033
    49
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    50
    ADD_EXECUTABLE(lp_test lp_test.cc)
alpar@1033
    51
  ELSE()
alpar@1033
    52
    ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
alpar@1033
    53
  ENDIF()
alpar@1033
    54
ladanyi@667
    55
  SET(LP_TEST_LIBS lemon)
ladanyi@726
    56
ladanyi@674
    57
  IF(LEMON_HAVE_GLPK)
ladanyi@667
    58
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
    59
  ENDIF()
ladanyi@674
    60
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
    61
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
    62
  ENDIF()
ladanyi@674
    63
  IF(LEMON_HAVE_CLP)
ladanyi@668
    64
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@726
    65
  ENDIF()
ladanyi@726
    66
ladanyi@667
    67
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@496
    68
  ADD_TEST(lp_test lp_test)
alpar@1061
    69
  ADD_DEPENDENCIES(check lp_test)
ladanyi@496
    70
ladanyi@674
    71
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
    72
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@496
    73
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
    74
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@726
    75
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
    76
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
    77
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
    78
    )
ladanyi@726
    79
  ENDIF()
ladanyi@726
    80
ladanyi@674
    81
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
    82
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@667
    83
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
    84
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
alpar@1119
    85
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
    86
    )
ladanyi@726
    87
  ENDIF()
ladanyi@726
    88
ENDIF()
ladanyi@496
    89
ladanyi@674
    90
IF(LEMON_HAVE_MIP)
alpar@1033
    91
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
    92
    ADD_EXECUTABLE(mip_test mip_test.cc)
alpar@1033
    93
  ELSE()
alpar@1033
    94
    ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
alpar@1033
    95
  ENDIF()
alpar@1033
    96
ladanyi@667
    97
  SET(MIP_TEST_LIBS lemon)
ladanyi@726
    98
ladanyi@674
    99
  IF(LEMON_HAVE_GLPK)
ladanyi@667
   100
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@726
   101
  ENDIF()
ladanyi@674
   102
  IF(LEMON_HAVE_CPLEX)
ladanyi@667
   103
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@726
   104
  ENDIF()
ladanyi@674
   105
  IF(LEMON_HAVE_CBC)
ladanyi@668
   106
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@726
   107
  ENDIF()
ladanyi@726
   108
ladanyi@667
   109
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@496
   110
  ADD_TEST(mip_test mip_test)
alpar@1061
   111
  ADD_DEPENDENCIES(check mip_test)
ladanyi@496
   112
ladanyi@674
   113
  IF(WIN32 AND LEMON_HAVE_GLPK)
ladanyi@496
   114
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@496
   115
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@496
   116
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@726
   117
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@726
   118
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@726
   119
      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@496
   120
    )
ladanyi@726
   121
  ENDIF()
ladanyi@726
   122
ladanyi@674
   123
  IF(WIN32 AND LEMON_HAVE_CPLEX)
ladanyi@667
   124
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@667
   125
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@667
   126
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
alpar@1119
   127
      COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex.dll ${TARGET_PATH}
ladanyi@667
   128
    )
ladanyi@726
   129
  ENDIF()
ladanyi@726
   130
ENDIF()
ladanyi@141
   131
alpar@225
   132
FOREACH(TEST_NAME ${TESTS})
alpar@1033
   133
  IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
alpar@1033
   134
    ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@1033
   135
  ELSE()
alpar@1033
   136
    ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
alpar@1033
   137
  ENDIF()
alpar@225
   138
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@1044
   139
    IF(TEST_WITH_VALGRIND)
alpar@1044
   140
      ADD_TEST(${TEST_NAME}
alpar@1044
   141
        valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
alpar@1044
   142
        ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
alpar@1044
   143
    ELSE()
alpar@1044
   144
      ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@1044
   145
    ENDIF()
alpar@1033
   146
  ADD_DEPENDENCIES(check ${TEST_NAME})
ladanyi@726
   147
ENDFOREACH()