-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
145 lines (132 loc) · 4.51 KB
/
Copy pathCMakeLists.txt
File metadata and controls
145 lines (132 loc) · 4.51 KB
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
cmake_minimum_required(VERSION 3.24...4.1)
set(CMAKE_CXX_SCAN_FOR_MODULES Off)
project(cyqlone
VERSION 0.0.1
DESCRIPTION "Fast, parallel and vectorized solver for linear systems with optimal control structure."
HOMEPAGE_URL "https://github.com/kul-optec/cyqlone"
LANGUAGES CXX
)
include(CTest)
include(CMakeDependentOption)
set(PY_VERSION_SUFFIX ".dev0")
# Options
option(CYQLONE_WITH_BLASFEO
"Benchmarks comparing to BLASFEO Riccati recursion" Off)
option(CYQLONE_WITH_QPALM
"Build the QPALM solver" On)
option(CYQLONE_COMPENSATE_SUM_LINE_SEARCH
"Use the Kahan–Babuška–Neumaier algorithm in the line search" Off)
option(CYQLONE_QUADRUPLE_SUM_LINE_SEARCH
"Use quadruple precision in the line search" Off)
cmake_dependent_option(CYQLONE_WITH_EXAMPLE_PROBLEMS
"Build the simple OCP example problems" ${BUILD_TESTING}
CYQLONE_WITH_QPALM Off)
# Enable/disable optional components
option(CYQLONE_WITH_TESTS
"Build the tests" ${BUILD_TESTING})
option(CYQLONE_WITH_EXAMPLES
"Build the examples" On)
option(CYQLONE_WITH_BENCHMARKS
"Build the benchmarks" Off)
option(CYQLONE_WITH_PYTHON
"Build the Python interface" Off)
option(CYQLONE_WITH_PYTHON_DISPATCH
"Build the AVX2/AVX-512 dispatch logic for the Python interface" Off)
option(CYQLONE_WITH_PYTHON_ARCH_SPECIFIC_ONLY
"Disable the common parts of the Python interface" Off)
option(CYQLONE_WITH_MATIO
"Use the matio library to save OCPs to .mat files" Off)
option(CYQLONE_WITH_ZLIB
"Use the zlib library to export compressed Chrome tracing files" Off)
option(CYQLONE_WITH_SKA_SORT
"Use the radix sort implementation provided by skarupke/ska_sort" Off)
# Developer options
option(CYQLONE_ONLY_DOCS
"Only build the documentation" Off)
option(CYQLONE_WARNINGS_AS_ERRORS
"Enable -Werror or /WX" Off)
option(CYQLONE_WITH_COVERAGE
"Generate coverage information" Off)
set(CYQLONE_DOXYFILE "${PROJECT_SOURCE_DIR}/docs/Doxyfile" CACHE FILEPATH
"The Doxyfile to use for the docs target")
option(CYQLONE_WITH_ACCURATE_BUILD_TIME
"Update the build time on every build" On)
option(CYQLONE_DEVELOPER_MODE
"Enable developer options such as sccache and colored compiler output" Off)
# Installation paths
include(GNUInstallDirs)
set(CYQLONE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}"
CACHE PATH "Installation directory for archives and libraries")
set(CYQLONE_INSTALL_CMAKEDIR "${CYQLONE_INSTALL_LIBDIR}/cmake/cyqlone"
CACHE PATH "Installation directory for CMake configuration files")
set(CYQLONE_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}"
CACHE PATH "Installation directory for binaries and DLLs")
set(CYQLONE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}"
CACHE PATH "Installation directory for headers")
set(CYQLONE_INSTALL_PYSTUBSDIR ""
CACHE PATH "Installation directory for Python stubs (relative to Python package)")
option(CYQLONE_STANDALONE
"Install with relative RPATH to locate its own shared libraries" On)
# Development
if (PROJECT_IS_TOP_LEVEL)
set(CMAKE_EXPORT_COMPILE_COMMANDS On)
endif()
if (CYQLONE_DEVELOPER_MODE)
include(cmake/Develop.cmake)
endif()
# Compiler warnings
include(cmake/Warnings.cmake)
add_warnings_target(warnings ${CYQLONE_WARNINGS_AS_ERRORS})
add_library(cyqlone::warnings ALIAS warnings)
# Compiler options
if (MSVC)
add_compile_options("/bigobj")
endif()
if (NOT DEFINED CMAKE_RELEASE_POSTFIX)
set(CMAKE_RELEASE_POSTFIX "")
endif()
if (NOT DEFINED CMAKE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX "_d")
endif()
if (NOT DEFINED CMAKE_RELWITHDEBINFO_POSTFIX)
set(CMAKE_RELWITHDEBINFO_POSTFIX "_rd")
endif()
if (NOT DEFINED CMAKE_MINSIZEREL_POSTFIX)
set(CMAKE_MINSIZEREL_POSTFIX "_rs")
endif()
# Coverage
if (CYQLONE_WITH_COVERAGE)
add_custom_target(coverage
${CMAKE_CURRENT_LIST_DIR}/scripts/coverage.sh
${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
USES_TERMINAL)
add_compile_options("--coverage")
add_link_options("--coverage")
add_dependencies(coverage cyqlone::tests)
endif()
# Documentation only
if (CYQLONE_ONLY_DOCS)
add_subdirectory(docs)
return()
endif()
# Libraries
add_subdirectory(src)
# Tests
if (CYQLONE_WITH_TESTS)
enable_testing()
add_subdirectory(test)
endif()
# Examples
if (CYQLONE_WITH_EXAMPLES)
add_subdirectory(examples)
endif()
# Benchmarks
if (CYQLONE_WITH_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
add_subdirectory(interfaces)
# Documentation
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/docs/CMakeLists.txt")
add_subdirectory(docs)
endif()