test/CMakeLists.txt
author Alpar Juttner <alpar@cs.elte.hu>
Wed, 20 Jan 2021 16:31:29 +0100
changeset 1206 86a5b114a066
parent 1186 3feba0ea1bda
child 1204 736a341e604b
permissions -rw-r--r--
Implement CplLp::write() for LP format (#640)
     1 INCLUDE_DIRECTORIES(
     2   ${PROJECT_SOURCE_DIR}
     3   ${PROJECT_BINARY_DIR}
     4 )
     5 
     6 LINK_DIRECTORIES(
     7   ${PROJECT_BINARY_DIR}/lemon
     8 )
     9 
    10 SET(TEST_WITH_VALGRIND "NO" CACHE STRING
    11   "Run the test with valgrind (YES/NO).")
    12 SET(VALGRIND_FLAGS "" CACHE STRING "Valgrind flags used by the tests.")
    13 
    14 SET(TESTS
    15   adaptors_test
    16   arc_look_up_test
    17   bellman_ford_test
    18   bfs_test
    19   bpgraph_test
    20   circulation_test
    21   connectivity_test
    22   counter_test
    23   dfs_test
    24   digraph_test
    25   dijkstra_test
    26   dim_test
    27   edge_set_test
    28   error_test
    29   euler_test
    30   fractional_matching_test
    31   gomory_hu_test
    32   graph_copy_test
    33   graph_test
    34   graph_utils_test
    35   hao_orlin_test
    36   heap_test
    37   kruskal_test
    38   lgf_reader_writer_test
    39   lgf_test
    40   maps_test
    41   matching_test
    42   max_cardinality_search_test
    43   max_clique_test
    44   max_flow_test
    45   min_cost_arborescence_test
    46   min_cost_flow_test
    47   min_mean_cycle_test
    48   nagamochi_ibaraki_test
    49   path_test
    50   planarity_test
    51   radix_sort_test
    52   random_test
    53   suurballe_test
    54   time_measure_test
    55   tsp_test
    56   unionfind_test
    57   vf2_test
    58 )
    59 
    60 IF(LEMON_HAVE_LP)
    61   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
    62     ADD_EXECUTABLE(lp_test lp_test.cc)
    63   ELSE()
    64     ADD_EXECUTABLE(lp_test EXCLUDE_FROM_ALL lp_test.cc)
    65   ENDIF()
    66 
    67   SET(LP_TEST_LIBS lemon)
    68 
    69   IF(LEMON_HAVE_GLPK)
    70     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
    71   ENDIF()
    72   IF(LEMON_HAVE_CPLEX)
    73     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${ILOG_LIBRARIES})
    74   ENDIF()
    75   IF(LEMON_HAVE_CLP)
    76     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    77   ENDIF()
    78   IF(LEMON_HAVE_SOPLEX)
    79     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${SOPLEX_LIBRARIES})
    80   ENDIF()
    81 
    82   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    83   ADD_TEST(lp_test lp_test)
    84   ADD_DEPENDENCIES(check lp_test)
    85 
    86   IF(WIN32 AND LEMON_HAVE_GLPK)
    87     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    88     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    89     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    90       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    91       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    92       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    93     )
    94   ENDIF()
    95 
    96   IF(WIN32 AND LEMON_HAVE_CPLEX)
    97     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    98     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    99     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
   100       COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}
   101     )
   102   ENDIF()
   103 ENDIF()
   104 
   105 IF(LEMON_HAVE_MIP)
   106   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
   107     ADD_EXECUTABLE(mip_test mip_test.cc)
   108   ELSE()
   109     ADD_EXECUTABLE(mip_test EXCLUDE_FROM_ALL mip_test.cc)
   110   ENDIF()
   111 
   112   SET(MIP_TEST_LIBS lemon)
   113 
   114   IF(LEMON_HAVE_GLPK)
   115     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
   116   ENDIF()
   117   IF(LEMON_HAVE_CPLEX)
   118     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${ILOG_LIBRARIES})
   119   ENDIF()
   120   IF(LEMON_HAVE_CBC)
   121     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
   122   ENDIF()
   123 
   124   TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
   125   ADD_TEST(mip_test mip_test)
   126   ADD_DEPENDENCIES(check mip_test)
   127 
   128   IF(WIN32 AND LEMON_HAVE_GLPK)
   129     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   130     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   131     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   132       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
   133       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
   134       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
   135     )
   136   ENDIF()
   137 
   138   IF(WIN32 AND LEMON_HAVE_CPLEX)
   139     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   140     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   141     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   142       COMMAND ${CMAKE_COMMAND} -E copy ${ILOG_CPLEX_DLL} ${TARGET_PATH}
   143     )
   144   ENDIF()
   145 ENDIF()
   146 
   147 FOREACH(TEST_NAME ${TESTS})
   148   IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
   149     ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
   150   ELSE()
   151     ADD_EXECUTABLE(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_NAME}.cc)
   152   ENDIF()
   153   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
   154     IF(TEST_WITH_VALGRIND)
   155       ADD_TEST(${TEST_NAME}
   156         valgrind --error-exitcode=1 ${VALGRIND_FLAGS}
   157         ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME} )
   158     ELSE()
   159       ADD_TEST(${TEST_NAME} ${TEST_NAME})
   160     ENDIF()
   161   ADD_DEPENDENCIES(check ${TEST_NAME})
   162 ENDFOREACH()