-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
134 lines (111 loc) · 5.08 KB
/
CMakeLists.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
cmake_minimum_required( VERSION 2.8 )
project( xHeinz )
set( xHeinz_Hdr
src/CppUtils.hpp
src/Math.hpp
src/BaseGraphTypes.hpp
src/Graph.hpp
src/GraphBuilder.hpp
src/GraphComponent.hpp
src/ChainGraph.hpp
src/ThreeWayGraph.hpp
src/Verbosity.hpp
src/ListsParser.hpp
src/Solver.hpp
src/Solver/Backoff.hpp
src/Solver/Config.hpp
src/Solver/Solution.hpp
src/Solver/BkMaxFlow.hpp
src/Solver/Callback.hpp
src/Solver/LazyConstraintCallback.hpp
src/Solver/UserCutCallback.hpp
src/Solver/ExtChainGraph.hpp
src/Solver/GraphVariables.hpp
src/Solver/MinCutDigraph.hpp
src/Solver/HeuristicCallback.hpp
src/Solver/MinCutDigraphComponent.hpp
)
set( xHeinz_Src
src/xHeinz.cpp
src/Verbosity.cpp
src/ListsParser.cpp
src/Solver.cpp
src/Solver/Config.cpp
src/Solver/Solution.cpp
src/Solver/BkMaxFlow.cpp
src/Solver/Callback.cpp
src/Solver/LazyConstraintCallback.cpp
src/Solver/UserCutCallback.cpp
src/Solver/HeuristicCallback.cpp
src/Solver/MinCutDigraphComponent.cpp
)
set( XHEINZ_INT_EPSILON 1e-5 CACHE STRING "xHeinz integrality epsilon (double type) value" )
set( XHEINZ_CUT_EPSILON 1e-5 CACHE STRING "xHeinz cut epsilon (double type) value" )
set( GitCommand1 "symbolic-ref HEAD 2> /dev/null | cut -b 12-" )
execute_process( COMMAND git symbolic-ref HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND tail -c -7 COMMAND tr -d "\\n" OUTPUT_VARIABLE GitBranch )
set( GitCommand2 "log --pretty=format:\\\"%h\\\" -1" )
execute_process( COMMAND git log --pretty=format:%h WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND head -n 1 COMMAND tr -d "\\n" OUTPUT_VARIABLE GitHashtag )
set( XHEINZ_VERSION \"${GitBranch}-${GitHashtag}\" )
set( Boost_USE_STATIC_LIBS ON )
find_package( Boost 1.49.0 REQUIRED )
set( LIBLEMON_ROOT "$ENV{HOME}/lemon" CACHE PATH "Additional search directory for lemon library" )
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" 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( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-write-strings " )
#if( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
# set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ " )
#endif()
add_definitions( -DIL_STD )
configure_file( src/Config.hpp.in ${PROJECT_SOURCE_DIR}/src/Config.hpp )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -DVERBOSE " )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast " )
include_directories( ${CPLEX_INC_DIR} ${CONCERT_INC_DIR} "src/externlib/boost_1_55_0_patched" ${Boost_INCLUDE_DIRS} "${LIBLEMON_ROOT}/include" "src" "src/externlib" )
link_directories( ${CPLEX_LIB_DIR} ${CONCERT_LIB_DIR} "${LIBLEMON_ROOT}/lib" )
set( CommonLibs
m
ilocplex
cplex
concert
pthread
emon
)
add_executable( xHeinz ${xHeinz_Src} ${xHeinz_Hdr} ${CommonObjs} )
target_link_libraries( xHeinz ${CommonLibs} )