gravatar
ladanyi@tmit.bme.hu
ladanyi@tmit.bme.hu
FindCPLEX for CMake (#256)
0 4 1
default
5 files changed with 60 insertions and 2 deletions:
↑ Collapse diff ↑
Show white space 24 line context
1
FIND_PATH(CPLEX_INCLUDE_DIR
2
  ilcplex/cplex.h
3
  PATHS "C:/ILOG/CPLEX91/include")
4

	
5
FIND_LIBRARY(CPLEX_LIBRARY
6
  NAMES cplex91
7
  PATHS "C:/ILOG/CPLEX91/lib/msvc7/stat_mda")
8

	
9
INCLUDE(FindPackageHandleStandardArgs)
10
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPLEX DEFAULT_MSG CPLEX_LIBRARY CPLEX_INCLUDE_DIR)
11

	
12
FIND_PATH(CPLEX_BIN_DIR
13
  cplex91.dll
14
  PATHS "C:/ILOG/CPLEX91/bin/x86_win32")
15

	
16
IF(CPLEX_FOUND)
17
  SET(CPLEX_INCLUDE_DIRS ${CPLEX_INCLUDE_DIR})
18
  SET(CPLEX_LIBRARIES ${CPLEX_LIBRARY})
19
ENDIF(CPLEX_FOUND)
20

	
21
MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_BIN_DIR)
22

	
23
IF(CPLEX_FOUND)
24
  SET(HAVE_LP TRUE)
25
  SET(HAVE_MIP TRUE)
26
  SET(HAVE_CPLEX TRUE)
27
ENDIF(CPLEX_FOUND)
Show white space 24 line context
... ...
@@ -5,24 +5,25 @@
5 5
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
6 6
  SET(PROJECT_NAME "LEMON")
7 7
  SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.")
8 8
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
9 9

	
10 10
PROJECT(${PROJECT_NAME})
11 11

	
12 12
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
13 13

	
14 14
INCLUDE(FindDoxygen)
15 15
INCLUDE(FindGhostscript)
16 16
FIND_PACKAGE(GLPK 4.33)
17
FIND_PACKAGE(CPLEX)
17 18

	
18 19
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
19 20

	
20 21
IF(MSVC)
21 22
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4800 /wd4996")
22 23
# Suppressed warnings:
23 24
# C4250: 'class1' : inherits 'class2::member' via dominance
24 25
# C4355: 'this' : used in base member initializer list
25 26
# C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
26 27
# C4996: 'function': was declared deprecated
27 28
ENDIF(MSVC)
28 29

	
Show white space 24 line context
... ...
@@ -19,24 +19,29 @@
19 19
)
20 20

	
21 21
IF(HAVE_GLPK)
22 22
  SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
23 23
  INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIRS})
24 24
  IF(WIN32)
25 25
    INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
26 26
    INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin)
27 27
    INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin)
28 28
  ENDIF(WIN32)
29 29
ENDIF(HAVE_GLPK)
30 30

	
31
IF(HAVE_CPLEX)
32
  SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
33
  INCLUDE_DIRECTORIES(${CPLEX_INCLUDE_DIRS})
34
ENDIF(HAVE_CPLEX)
35

	
31 36
ADD_LIBRARY(lemon ${LEMON_SOURCES})
32 37

	
33 38
INSTALL(
34 39
  TARGETS lemon
35 40
  ARCHIVE DESTINATION lib
36 41
  COMPONENT library)
37 42

	
38 43
INSTALL(
39 44
  DIRECTORY . bits concepts
40 45
  DESTINATION include/lemon
41 46
  COMPONENT headers
42 47
  FILES_MATCHING PATTERN "*.h")
Show white space 24 line context
1 1
#cmakedefine HAVE_LONG_LONG 1
2 2
#cmakedefine HAVE_LP 1
3 3
#cmakedefine HAVE_MIP 1
4 4
#cmakedefine HAVE_GLPK 1
5
#cmakedefine HAVE_CPLEX 1
Show white space 24 line context
... ...
@@ -29,51 +29,75 @@
29 29
  min_cost_arborescence_test
30 30
  min_cost_flow_test
31 31
  path_test
32 32
  preflow_test
33 33
  radix_sort_test
34 34
  random_test
35 35
  suurballe_test
36 36
  time_measure_test
37 37
  unionfind_test)
38 38

	
39 39
IF(HAVE_LP)
40 40
  ADD_EXECUTABLE(lp_test lp_test.cc)
41
  SET(LP_TEST_LIBS lemon)
41 42
  IF(HAVE_GLPK)
42
    TARGET_LINK_LIBRARIES(lp_test lemon ${GLPK_LIBRARIES})
43
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
43 44
  ENDIF(HAVE_GLPK)
45
  IF(HAVE_CPLEX)
46
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
47
  ENDIF(HAVE_CPLEX)
48
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
44 49
  ADD_TEST(lp_test lp_test)
45 50

	
46 51
  IF(WIN32 AND HAVE_GLPK)
47 52
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
48 53
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
49 54
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
50 55
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
51 56
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
52 57
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
53 58
    )
54 59
  ENDIF(WIN32 AND HAVE_GLPK)
60
  IF(WIN32 AND HAVE_CPLEX)
61
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
62
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
63
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
64
      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
65
    )
66
  ENDIF(WIN32 AND HAVE_CPLEX)
55 67
ENDIF(HAVE_LP)
56 68

	
57 69
IF(HAVE_MIP)
58 70
  ADD_EXECUTABLE(mip_test mip_test.cc)
71
  SET(MIP_TEST_LIBS lemon)
59 72
  IF(HAVE_GLPK)
60
    TARGET_LINK_LIBRARIES(mip_test lemon ${GLPK_LIBRARIES})
73
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
61 74
  ENDIF(HAVE_GLPK)
75
  IF(HAVE_CPLEX)
76
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
77
  ENDIF(HAVE_CPLEX)
78
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
62 79
  ADD_TEST(mip_test mip_test)
63 80

	
64 81
  IF(WIN32 AND HAVE_GLPK)
65 82
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
66 83
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
67 84
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
68 85
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
69 86
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
70 87
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
71 88
    )
72 89
  ENDIF(WIN32 AND HAVE_GLPK)
90
  IF(WIN32 AND HAVE_CPLEX)
91
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
92
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
93
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
94
      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
95
    )
96
  ENDIF(WIN32 AND HAVE_CPLEX)
73 97
ENDIF(HAVE_MIP)
74 98

	
75 99
FOREACH(TEST_NAME ${TESTS})
76 100
  ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
77 101
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
78 102
  ADD_TEST(${TEST_NAME} ${TEST_NAME})
79 103
ENDFOREACH(TEST_NAME)
0 comments (0 inline)