-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists_ILP.txt
111 lines (93 loc) · 4.28 KB
/
CMakeLists_ILP.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
cmake_minimum_required( VERSION 3.0 )
option(ILP "Build ILP" ON)
option(CPLEX "Use CPLEX" ON)
if (ILP)
if (CPLEX)
project( linTracer-CPLEX VERSION 1.0 )
else()
project( linTracer-GUROBI VERSION 1.0 )
endif()
else()
project ( linTracer VERSION 1.0 )
endif()
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} ${CMAKE_MODULE_PATH} )
set( startle_src
src/ilp/startle.cpp
src/ilp/utils.cpp
src/ilp/matrix.cpp
src/ilp/ilpsolver.cpp
)
set( startle_hdr
src/ilp/utils.h
src/ilp/matrix.h
src/ilp/ilpsolver.h
)
if( NOT CPLEX_INC_DIR OR NOT CPLEX_LIB_DIR OR NOT CONCERT_INC_DIR OR NOT CONCERT_LIB_DIR)
set( CPLEX_AUTODETECTION_PREFIXES "$ENV{HOME}/ILOG;/opt/ibm/ILOG;$ENV{HOME}/Applications/IBM/ILOG;/Applications;$ENV{HOME}/libraries/cplex/cplex-install" CACHE STRING "CPLEX automatic lookup directories" )
foreach( CplexInstallPrefix ${CPLEX_AUTODETECTION_PREFIXES} )
file( GLOB_RECURSE CplexLibraryPaths ${CplexInstallPrefix}/*/cplex/lib/*/libcplex.a )
if( CplexLibraryPaths )
list( LENGTH CplexLibraryPaths NumPath )
if( NumPath GREATER 1 )
message( WARNING "Found multiple CPLEX installations in ${CplexInstallPrefix}, automatically selecting the first one, please set {CPLEX|CONCERT}_{INC|LIB}_DIR manually if this is not the right selection" )
else()
message( "Found CPLEX's installation in ${CPlexInstallPrefix}" )
endif()
list( GET CplexLibraryPaths 0 CplexLibraryPath )
set( MyRegex "${CplexInstallPrefix}/(.*)/cplex/?/lib/(.*)/libcplex.a" )
string( REGEX MATCH "${MyRegex}" ValidatedCplexLibPath ${CplexLibraryPath} )
if( NOT ValidatedCplexLibPath )
message( WARNING "Unable to recognize ${CplexLibraryPath} as a valid CPLEX path" )
else()
string( REGEX REPLACE "${MyRegex}" "\\1" CplexHome ${ValidatedCplexLibPath} )
string( REGEX REPLACE "${MyRegex}" "\\2" CplexArch ${ValidatedCplexLibPath} )
set( CPLEX_INC_DIR "${CplexInstallPrefix}/${CplexHome}/cplex/include" CACHE PATH "CPLEX's include dir" )
set( CPLEX_LIB_DIR "${CplexInstallPrefix}/${CplexHome}/cplex/lib/${CplexArch}" CACHE PATH "CPLEX's library dir" )
set( CONCERT_INC_DIR "${CplexInstallPrefix}/${CplexHome}/concert/include" CACHE PATH "Concert's include dir" )
set( CONCERT_LIB_DIR "${CplexInstallPrefix}/${CplexHome}/concert/lib/${CplexArch}" CACHE PATH "Concert's library dir" )
break()
endif()
else()
message( "Unable to find CPLEX and Concert installation in ${CplexInstallPrefix}" )
endif()
endforeach()
if( NOT CPLEX_INC_DIR OR NOT CPLEX_LIB_DIR OR NOT CONCERT_INC_DIR OR NOT CONCERT_LIB_DIR )
message( "Unable to autodeted CPLEX's and Concert's installation directories, please set {CPLEX|CONCERT}_{INC|LIB}_DIR manually" )
else()
message( "Autodetected CPLEX's include dir : ${CPLEX_INC_DIR}" )
message( "Autodetected CPLEX's library dir : ${CPLEX_LIB_DIR}" )
message( "Autodetected Concert's include dir : ${CONCERT_INC_DIR}" )
message( "Autodetected Concert's library dir : ${CONCERT_LIB_DIR}" )
endif()
endif()
set( Boost_USE_STATIC_LIBS ON )
find_package( Boost REQUIRED )
MESSAGE( STATUS "found boost:"
"\nINCLUDE: ${Boost_INCLUDE_DIRS}"
"\nLIB: ${Boost_LIBRARIES}"
)
set( LIBLEMON_ROOT "$ENV{HOME}/lemon" CACHE PATH "Additional search directory for lemon library" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
add_definitions( -DCPLEX -DIL_STD )
if( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" )
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: Debug Release Profile" FORCE)
endif(NOT CMAKE_BUILD_TYPE)
include_directories( ${CPLEX_INC_DIR} ${CONCERT_INC_DIR} "${LIBLEMON_ROOT}/include" "src" ${Boost_INCLUDE_DIRS} )
link_directories( ${CPLEX_LIB_DIR} ${CONCERT_LIB_DIR} "${LIBLEMON_ROOT}/lib" )
set( CommonLibs
m
ilocplex
cplex
concert
pthread
emon
dl
${Boost_LIBRARIES}
)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG" )
add_executable( startle ${startle_src} ${startle_hdr} )
##target_include_directories( startle PUBLIC "${LIBLEMON_ROOT}/include" "src" ${Boost_INCLUDE_DIRS} ${CPLEX_INC_DIR} ${CONCERT_INC_DIR} )
target_link_libraries( startle ${CommonLibs})