forked from MiniZinc/libminizinc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
111 lines (88 loc) · 3.79 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
cmake_minimum_required(VERSION 3.4.0)
# -------------------------------------------------------------------------------------------------------------------
# -- Project information and versioning.
project(libminizinc
VERSION 2.3.1
LANGUAGES CXX C)
if(NOT BUILD_REF)
set(BUILD_REF "")
endif()
# -------------------------------------------------------------------------------------------------------------------
# -- Project build options
# Driver compilation selection
option(USE_CPLEX "Enable the CPLEX solving target" TRUE)
option(USE_GEAS "Enable the Geas solving target" TRUE)
option(USE_GECODE "Enable the Gecode solving target" TRUE)
option(USE_GUROBI "Enable the Gurobi solving target" TRUE)
option(USE_OSICBC "Enable the Osi CBC solving target" TRUE)
option(USE_SCIP "Enable the SCIP solving target" TRUE)
option(USE_XPRESS "Enable the Xpress solving target" TRUE)
# Static vs. Dynamic linking
option(CPLEX_PLUGIN "Build CPLEX binding as a plugin" ON)
option(GUROBI_PLUGIN "Build Gurobi binding as a plugin" ON)
# Enforce non proprietary build
option(USE_PROPRIETARY "Enable static linking of proprietary solvers" OFF)
if(NOT USE_PROPRIETARY)
set(CPLEX_PLUGIN ON)
set(GUROBI_PLUGIN ON)
set(USE_SCIP OFF)
endif()
# Export compile commands (useful when working with visual studio code)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# -------------------------------------------------------------------------------------------------------------------
# -- CMake initialisation
# Fix library suffixes for Web Assembly platform
include(cmake/support/emscripten_setup.cmake)
# Try to find possible dependencies
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif(POLICY CMP0074)
find_package(CPlex)
find_package(Geas)
find_package(Gecode 6.0 COMPONENTS Driver Float Int Kernel Minimodel Search Set Support)
find_package(Gurobi)
find_package(OsiCBC)
find_package(SCIP CONFIG)
find_package(Xpress)
# Set build type when none is selected
set(DEFAULT_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug"
"Release"
"MinSizeRel"
"RelWithDebInfo")
endif()
# -------------------------------------------------------------------------------------------------------------------
# -- Compiler configuration
include(cmake/support/ccache_setup.cmake)
include(cmake/support/compiler_setup.cmake)
configure_file(
${PROJECT_SOURCE_DIR}/include/minizinc/config.hh.in
${PROJECT_BINARY_DIR}/include/minizinc/config.hh
)
install(
FILES ${PROJECT_BINARY_DIR}/include/minizinc/config.hh
DESTINATION include/minizinc
)
# -------------------------------------------------------------------------------------------------------------------
# -- MiniZinc compilation targets.
find_package(Threads REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_BINARY_DIR}/include)
# Libraries
include(cmake/targets/libmzn.cmake)
# Executables
include(cmake/targets/minizinc.cmake)
include(cmake/targets/mzn2doc.cmake)
# -------------------------------------------------------------------------------------------------------------------
# -- Platform Specific configuration
include(cmake/support/config_emscripten.cmake)
# -------------------------------------------------------------------------------------------------------------------
# -- CMake configuration generation
include(cmake/support/config_export.cmake)
include(cmake/support/config_output.cmake)