test/CMakeLists.txt
changeset 727 257e91516e09
parent 696 76cbcb3e9bbb
child 745 f9746e45246e
child 810 93cd93e82f9b
child 1033 16d466589b54
equal deleted inserted replaced
34:9b251702767c 35:1e50ff577c29
     1 INCLUDE_DIRECTORIES(
     1 INCLUDE_DIRECTORIES(
     2   ${PROJECT_SOURCE_DIR}
     2   ${PROJECT_SOURCE_DIR}
     3   ${PROJECT_BINARY_DIR}
     3   ${PROJECT_BINARY_DIR}
     4 )
     4 )
     5 
     5 
     6 LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon)
     6 LINK_DIRECTORIES(
       
     7   ${PROJECT_BINARY_DIR}/lemon
       
     8 )
     7 
     9 
     8 SET(TESTS
    10 SET(TESTS
     9   adaptors_test
    11   adaptors_test
    10   bfs_test
    12   bfs_test
    11   circulation_test
    13   circulation_test
    33   preflow_test
    35   preflow_test
    34   radix_sort_test
    36   radix_sort_test
    35   random_test
    37   random_test
    36   suurballe_test
    38   suurballe_test
    37   time_measure_test
    39   time_measure_test
    38   unionfind_test)
    40   unionfind_test
       
    41 )
    39 
    42 
    40 IF(LEMON_HAVE_LP)
    43 IF(LEMON_HAVE_LP)
    41   ADD_EXECUTABLE(lp_test lp_test.cc)
    44   ADD_EXECUTABLE(lp_test lp_test.cc)
    42   SET(LP_TEST_LIBS lemon)
    45   SET(LP_TEST_LIBS lemon)
       
    46 
    43   IF(LEMON_HAVE_GLPK)
    47   IF(LEMON_HAVE_GLPK)
    44     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
    48     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
    45   ENDIF(LEMON_HAVE_GLPK)
    49   ENDIF()
    46   IF(LEMON_HAVE_CPLEX)
    50   IF(LEMON_HAVE_CPLEX)
    47     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    51     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
    48   ENDIF(LEMON_HAVE_CPLEX)
    52   ENDIF()
    49   IF(LEMON_HAVE_CLP)
    53   IF(LEMON_HAVE_CLP)
    50     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    54     SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
    51   ENDIF(LEMON_HAVE_CLP)
    55   ENDIF()
       
    56 
    52   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    57   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
    53   ADD_TEST(lp_test lp_test)
    58   ADD_TEST(lp_test lp_test)
    54 
    59 
    55   IF(WIN32 AND LEMON_HAVE_GLPK)
    60   IF(WIN32 AND LEMON_HAVE_GLPK)
    56     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    61     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    57     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    62     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    58     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    63     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    59       COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    64       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    60       COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    65       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    61       COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    66       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    62     )
    67     )
    63   ENDIF(WIN32 AND LEMON_HAVE_GLPK)
    68   ENDIF()
       
    69 
    64   IF(WIN32 AND LEMON_HAVE_CPLEX)
    70   IF(WIN32 AND LEMON_HAVE_CPLEX)
    65     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    71     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
    66     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    72     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    67     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    73     ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    68       COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
    74       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
    69     )
    75     )
    70   ENDIF(WIN32 AND LEMON_HAVE_CPLEX)
    76   ENDIF()
    71 ENDIF(LEMON_HAVE_LP)
    77 ENDIF()
    72 
    78 
    73 IF(LEMON_HAVE_MIP)
    79 IF(LEMON_HAVE_MIP)
    74   ADD_EXECUTABLE(mip_test mip_test.cc)
    80   ADD_EXECUTABLE(mip_test mip_test.cc)
    75   SET(MIP_TEST_LIBS lemon)
    81   SET(MIP_TEST_LIBS lemon)
       
    82 
    76   IF(LEMON_HAVE_GLPK)
    83   IF(LEMON_HAVE_GLPK)
    77     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
    84     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
    78   ENDIF(LEMON_HAVE_GLPK)
    85   ENDIF()
    79   IF(LEMON_HAVE_CPLEX)
    86   IF(LEMON_HAVE_CPLEX)
    80     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
    87     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
    81   ENDIF(LEMON_HAVE_CPLEX)
    88   ENDIF()
    82   IF(LEMON_HAVE_CBC)
    89   IF(LEMON_HAVE_CBC)
    83     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
    90     SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
    84   ENDIF(LEMON_HAVE_CBC)
    91   ENDIF()
       
    92 
    85   TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
    93   TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
    86   ADD_TEST(mip_test mip_test)
    94   ADD_TEST(mip_test mip_test)
    87 
    95 
    88   IF(WIN32 AND LEMON_HAVE_GLPK)
    96   IF(WIN32 AND LEMON_HAVE_GLPK)
    89     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
    97     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
    90     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    98     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    91     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
    99     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
    92       COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
   100       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
    93       COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
   101       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
    94       COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
   102       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    95     )
   103     )
    96   ENDIF(WIN32 AND LEMON_HAVE_GLPK)
   104   ENDIF()
       
   105 
    97   IF(WIN32 AND LEMON_HAVE_CPLEX)
   106   IF(WIN32 AND LEMON_HAVE_CPLEX)
    98     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
   107     GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
    99     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   108     GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
   100     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   109     ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
   101       COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
   110       COMMAND ${CMAKE_COMMAND} -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
   102     )
   111     )
   103   ENDIF(WIN32 AND LEMON_HAVE_CPLEX)
   112   ENDIF()
   104 ENDIF(LEMON_HAVE_MIP)
   113 ENDIF()
   105 
   114 
   106 FOREACH(TEST_NAME ${TESTS})
   115 FOREACH(TEST_NAME ${TESTS})
   107   ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
   116   ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
   108   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
   117   TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
   109   ADD_TEST(${TEST_NAME} ${TEST_NAME})
   118   ADD_TEST(${TEST_NAME} ${TEST_NAME})
   110 ENDFOREACH(TEST_NAME)
   119 ENDFOREACH()