-
Notifications
You must be signed in to change notification settings - Fork 81
/
CMakeLists.txt
105 lines (83 loc) · 3.68 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
cmake_minimum_required(VERSION 3.5.0)
# -------------------------------------------------------------------------------------------------------------------
# -- Project information and versioning.
project(libminizinc
VERSION 2.8.7
LANGUAGES CXX C)
if(NOT BUILD_REF)
set(BUILD_REF "")
endif()
# -------------------------------------------------------------------------------------------------------------------
# -- Project build options
# Static vs. Dynamic linking
option(CPLEX_PLUGIN "Build CPLEX binding as a plugin" ON)
option(HIGHS_PLUGIN "Build HiGHS binding as a plugin" ON)
# CMake options default value
option(CMAKE_POSITION_INDEPENDENT_CODE "Default value for POSITION_INDEPENDENT_CODE of targets" TRUE)
# -------------------------------------------------------------------------------------------------------------------
# -- CMake initialisation
include(GNUInstallDirs)
# 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)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/vendor/highs/lib/cmake/highs)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/vendor/highs/lib64/cmake/highs)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/vendor/chuffed/lib/cmake/chuffed)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif(POLICY CMP0074)
find_package(Geas)
find_package(Gecode 6.2 COMPONENTS Driver Float Int Kernel Minimodel Search Set Support)
find_package(atlantis)
find_package(chuffed)
if(NOT HIGHS_PLUGIN)
find_package(HIGHS REQUIRED)
endif()
find_package(OsiCBC)
if(NOT CPLEX_PLUGIN)
find_package(CPlex REQUIRED)
endif()
# 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/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)
# -------------------------------------------------------------------------------------------------------------------
# -- Support Actions
include(cmake/support/format.cmake)