-
Notifications
You must be signed in to change notification settings - Fork 24
/
CMakeLists.txt
110 lines (90 loc) · 3.23 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
# Large parts of this build system are based on Jason Turner's C++ Starter
# Project (https://github.com/lefticus/cpp_starter_project) and CMake Template
# (https://github.com/cpp-best-practices/cmake_template)
cmake_minimum_required(VERSION 3.21...3.29)
# Only set the CMAKE_CXX_STANDARD if it is not set by someone else
if(NOT DEFINED CMAKE_CXX_STANDARD)
# Set C++ standard; at least C++17 is required
set(CMAKE_CXX_STANDARD 17)
endif()
# strongly encouraged to enable this globally to avoid conflicts between
# -Wpedantic being enabled and -std=c++20 and -std=gnu++20 for example when
# compiling with PCH enabled
set(CMAKE_CXX_EXTENSIONS OFF)
# Set the project name and version
project(
fiction
VERSION 0.6.6
DESCRIPTION
"An open-source design automation framework for Field-coupled Nanotechnologies"
HOMEPAGE_URL "https://github.com/cda-tum/fiction"
LANGUAGES CXX C)
include(cmake/PreventInSourceBuilds.cmake)
include(cmake/ProjectOptions.cmake)
include(cmake/Utilities.cmake)
fiction_setup_options()
fiction_global_options()
fiction_local_options()
# don't know if this should be set globally from here or not...
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(GIT_SHA
"Unknown"
CACHE STRING "SHA this build was generated from")
string(SUBSTRING "${GIT_SHA}" 0 8 GIT_SHORT_SHA)
target_compile_features(fiction_options INTERFACE cxx_std_${CMAKE_CXX_STANDARD})
# Alias for the options target
add_library(fiction::fiction_options ALIAS fiction_options)
# Alias for the warnings target
add_library(fiction::fiction_warnings ALIAS fiction_warnings)
# Include header files
add_subdirectory(include)
# Include libraries
add_subdirectory(libs)
# Enable progress bars
if(NOT WIN32)
option(FICTION_PROGRESS_BARS "Enable animated progress bars in command line"
ON)
if(FICTION_PROGRESS_BARS)
target_compile_definitions(fiction_options INTERFACE PROGRESS_BARS)
endif()
endif()
# CLI
option(FICTION_CLI "Build fiction CLI" ON)
if(FICTION_CLI)
message(STATUS "Building fiction CLI")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cli)
endif()
# Experiments
option(FICTION_EXPERIMENTS "Build fiction experiments" OFF)
if(FICTION_EXPERIMENTS)
message(STATUS "Building fiction experiments")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/experiments)
endif()
# Python Bindings
option(FICTION_PYTHON_BINDINGS "Build fiction Python bindings" OFF)
if(FICTION_PYTHON_BINDINGS)
message(STATUS "Building fiction Python bindings")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/bindings/)
endif()
# Testing
option(FICTION_TEST "Build fiction tests" OFF)
if(FICTION_TEST)
enable_testing()
message(STATUS "Building fiction tests")
add_subdirectory(test)
endif()
# If MSVC is being used, and ASAN is enabled, we need to set the debugger
# environment so that it behaves well with MSVC's debugger, and we can run the
# target from visual studio
if(MSVC)
get_all_installable_targets(all_targets)
message("all_targets=${all_targets}")
set_target_properties(
${all_targets} PROPERTIES VS_DEBUGGER_ENVIRONMENT
"PATH=$(VC_ExecutablePath_x64);%PATH%")
endif()
# set the startup project for the "play" button in MSVC
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT intro)
if(CMAKE_SKIP_INSTALL_RULES)
return()
endif()