-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
CMakeLists.txt
215 lines (199 loc) · 7.1 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# ##############################################################################
# SWIG (WIN32)
# ##############################################################################
if(WIN32
AND (BUILD_PYTHON
OR BUILD_JAVA
OR BUILD_DOTNET))
message(CHECK_START "Fetching SWIG")
list(APPEND CMAKE_MESSAGE_INDENT " ")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SWIG.CMakeLists.txt.in
${CMAKE_CURRENT_BINARY_DIR}/SWIG/CMakeLists.txt @ONLY)
execute_process(
COMMAND ${CMAKE_COMMAND} -H. -Bproject_build -G "${CMAKE_GENERATOR}"
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SWIG)
if(result)
message(FATAL_ERROR "CMake step for SWIG failed: ${result}")
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} --build project_build --config ${CMAKE_BUILD_TYPE}
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SWIG)
if(result)
message(FATAL_ERROR "Build step for SWIG failed: ${result}")
endif()
set(SWIG_EXECUTABLE
${CMAKE_CURRENT_BINARY_DIR}/SWIG/source/swig.exe
CACHE INTERNAL "swig.exe location" FORCE)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
include(FetchContent)
set(FETCHCONTENT_QUIET OFF)
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(BUILD_TESTING OFF)
# ##############################################################################
# ZLIB
# ##############################################################################
if(BUILD_ZLIB)
message(CHECK_START "Fetching ZLIB")
list(APPEND CMAKE_MESSAGE_INDENT " ")
FetchContent_Declare(
zlib
GIT_REPOSITORY "https://github.com/madler/ZLIB.git"
GIT_TAG "v1.2.11"
PATCH_COMMAND git apply "${CMAKE_CURRENT_LIST_DIR}/../../patches/ZLIB.patch")
FetchContent_MakeAvailable(zlib)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
# ##############################################################################
# ABSEIL-CPP
# ##############################################################################
if(BUILD_absl)
message(CHECK_START "Fetching Abseil-cpp")
list(APPEND CMAKE_MESSAGE_INDENT " ")
set(ABSL_ENABLE_INSTALL ON)
FetchContent_Declare(
absl
GIT_REPOSITORY "https://github.com/abseil/abseil-cpp.git"
GIT_TAG "20210324.2"
PATCH_COMMAND git apply "${CMAKE_CURRENT_LIST_DIR}/../../patches/abseil-cpp-20210324.2.patch")
FetchContent_MakeAvailable(absl)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
# ##############################################################################
# SCIP
# ##############################################################################
if(BUILD_SCIP)
message(CHECK_START "Fetching SCIP")
list(APPEND CMAKE_MESSAGE_INDENT " ")
set(SHARED OFF)
set(READLINE OFF)
set(GMP OFF)
set(PAPILO OFF)
set(ZIMPL OFF)
set(IPOPT OFF)
set(AMPL OFF)
set(TPI "tny" CACHE STRING "Scip param")
set(EXPRINT "none" CACHE STRING "Scip param")
set(LPS "none" CACHE STRING "Scip param")
set(SYM "none" CACHE STRING "Scip param")
FetchContent_Declare(
scip
GIT_REPOSITORY https://github.com/scipopt/scip.git
GIT_TAG master
)
FetchContent_MakeAvailable(scip)
set(LPI_GLOP_SRC ${scip_SOURCE_DIR}/src/lpi/lpi_glop.cpp PARENT_SCOPE)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
# ##############################################################################
# Protobuf
# ##############################################################################
if(BUILD_Protobuf)
message(CHECK_START "Fetching Protobuf")
list(APPEND CMAKE_MESSAGE_INDENT " ")
set(protobuf_BUILD_TESTS OFF)
set(protobuf_BUILD_EXPORT OFF)
set(protobuf_MSVC_STATIC_RUNTIME OFF)
# FetchContent_Declare(SOURCE_SUBDIR) was introduced in 3.18
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18")
FetchContent_Declare(
protobuf
GIT_REPOSITORY "https://github.com/protocolbuffers/protobuf.git"
GIT_TAG "v3.18.0"
GIT_SUBMODULES ""
PATCH_COMMAND git apply "${CMAKE_CURRENT_LIST_DIR}/../../patches/protobuf-v3.18.0.patch"
SOURCE_SUBDIR cmake)
FetchContent_MakeAvailable(protobuf)
else()
fetch_git_dependency(
NAME Protobuf
REPOSITORY "https://github.com/protocolbuffers/protobuf.git"
TAG "v3.18.0"
PATCH_COMMAND "git apply \"${CMAKE_CURRENT_LIST_DIR}/../../patches/protobuf-v3.18.0.patch\""
SOURCE_SUBDIR cmake
)
endif()
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
# Coin-OR does not support C++17 (use of 'register' storage class specifier)
set(CMAKE_CXX_STANDARD 11)
# ##############################################################################
# Coinutils
# ##############################################################################
if(BUILD_CoinUtils)
message(CHECK_START "Fetching CoinUtils")
list(APPEND CMAKE_MESSAGE_INDENT " ")
FetchContent_Declare(
CoinUtils
GIT_REPOSITORY "https://github.com/Mizux/CoinUtils.git"
GIT_TAG "stable/2.11")
FetchContent_MakeAvailable(CoinUtils)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
# ##############################################################################
# Osi
# ##############################################################################
if(BUILD_Osi)
message(CHECK_START "Fetching Osi")
list(APPEND CMAKE_MESSAGE_INDENT " ")
FetchContent_Declare(
Osi
GIT_REPOSITORY "https://github.com/Mizux/Osi.git"
GIT_TAG "stable/0.108")
FetchContent_MakeAvailable(Osi)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
# ##############################################################################
# Clp
# ##############################################################################
if(BUILD_Clp)
message(CHECK_START "Fetching Clp")
list(APPEND CMAKE_MESSAGE_INDENT " ")
FetchContent_Declare(
Clp
GIT_REPOSITORY "https://github.com/Mizux/Clp.git"
GIT_TAG "stable/1.17.4")
FetchContent_MakeAvailable(Clp)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
# ##############################################################################
# Cgl
# ##############################################################################
if(BUILD_Cgl)
message(CHECK_START "Fetching Cgl")
list(APPEND CMAKE_MESSAGE_INDENT " ")
FetchContent_Declare(
Cgl
GIT_REPOSITORY "https://github.com/Mizux/Cgl.git"
GIT_TAG "stable/0.60")
FetchContent_MakeAvailable(Cgl)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
# ##############################################################################
# Cbc
# ##############################################################################
if(BUILD_Cbc)
message(CHECK_START "Fetching Cbc")
list(APPEND CMAKE_MESSAGE_INDENT " ")
FetchContent_Declare(
Cbc
GIT_REPOSITORY "https://github.com/Mizux/Cbc.git"
GIT_TAG "stable/2.10")
FetchContent_MakeAvailable(Cbc)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
set(CMAKE_CXX_STANDARD 17)