-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
95 lines (75 loc) · 3.12 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
cmake_minimum_required(VERSION 3.23)
project(
AetherX6100Control
VERSION 0.15.0
LANGUAGES C CXX)
# Options ------------------------------------------------------------------------------------------
option(BUILD_SHARED_LIBS "Build libraries as shared libraries." ON) # CMake option name
option(AETHER_X6100CTRL_DEVELOPER_MODE "Enable developer helpers." OFF)
option(AETHER_X6100CTRL_USE_LTO "Enable link-time optimization when possible." ON)
option(AETHER_X6100CTRL_USE_FAST_MATH "Use fast math when possible (-ffast-math or /fp:fast)." OFF)
option(AETHER_X6100CTRL_SET_CXX_STANDARD "Set the C++ standard directly." ON)
option(AETHER_X6100CTRL_USE_CXX_ISO_FLAGS
"Add extra compiler flags to make C++ compilers more compliant." ON)
# --------------------------------------------------------------------------------------------------
# Global variables
set(AETHER_X6100CTRL_VENDOR_NAME "AetherRadio")
set(AETHER_X6100CTRL_INCLUDE_DIR "include/aether_radio")
# Global modules
include(GenerateExportHeader)
include(CheckCXXCompilerFlag)
# Local modules
include(cmake/output_structure.cmake)
include(cmake/install_structure.cmake)
include(cmake/default_visibility.cmake)
include(cmake/compiler_flags/cxx_standard.cmake)
include(cmake/compiler_flags/fast_math.cmake)
include(cmake/compiler_flags/ipo_support.cmake)
include(cmake/compiler_flags/cxx_iso_flags.cmake)
include(cmake/dependencies/openmp.cmake)
include(cmake/developer_mode.cmake)
# Sanity checks
if(UNIX AND NOT APPLE)
set(AETHER_X6100CTRL_LINUX TRUE)
else()
message(FATAL_ERROR "${PROJECT_NAME} is not compatible with non-Linux systems.")
endif()
# Aether X6100 Control library
add_library(aether_x6100_control)
set_target_properties(
aether_x6100_control
PROPERTIES EXPORT_NAME "aether_x6100_control" #
OUTPUT_NAME "aether_x6100_control" #
DEFINE_SYMBOL "AETHER_X6100CTRL_EXPORTING" #
VERSION "${PROJECT_VERSION}" #
SOVERSION "${PROJECT_VERSION_MAJOR}")
# Export header
set(AETHER_X6100CTRL_EXPORT_HEADER_FILE "${AETHER_X6100CTRL_INCLUDE_DIR}/x6100_control/api.h")
generate_export_header(
aether_x6100_control
BASE_NAME
"AETHER_X6100CTRL"
EXPORT_MACRO_NAME
"AETHER_X6100CTRL_API"
EXPORT_FILE_NAME
${AETHER_X6100CTRL_EXPORT_HEADER_FILE})
target_sources(
aether_x6100_control
PUBLIC #
FILE_SET HEADERS #
BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/include)
target_sources(
aether_x6100_control #
PUBLIC #
FILE_SET HEADERS #
FILES ${CMAKE_CURRENT_BINARY_DIR}/${AETHER_X6100CTRL_EXPORT_HEADER_FILE})
# Code for the library
add_subdirectory(include)
add_subdirectory(src)
# Install and packaging code
include(cmake/installation.cmake)
include(cmake/packaging.cmake)
#target_compile_options(aether_x6100_control PRIVATE -g -fno-omit-frame-pointer -fasynchronous-unwind-tables)
#target_link_options(aether_x6100_control PRIVATE -g -rdynamic)
#target_compile_options(aether_x6100_control PRIVATE -fsanitize=address -fsanitize=undefined -fno-sanitize-recover)
#target_link_options(aether_x6100_control PRIVATE -fsanitize=address -fsanitize=undefined -fno-sanitize-recover -static-libasan -static-libubsan)