forked from SlideRuleEarth/sliderule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject-config.cmake
142 lines (114 loc) · 4.88 KB
/
project-config.cmake
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
#################
# CMake Options #
#################
# Squelch a warning when building on Win32/Cygwin
set (CMAKE_LEGACY_CYGWIN_WIN32 0)
# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(default_build_type "Release")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(default_build_type "Debug")
endif()
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)
endif()
# Set a default platform
if(NOT CMAKE_BUILD_PLATFORM)
set(CMAKE_BUILD_PLATFORM "Linux" CACHE STRING "Choose the target platform." FORCE)
endif()
# Configure static analysis
if(CMAKE_BUILD_TYPE MATCHES "Debug")
message(STATUS "Enabling static analysis")
# clang-tidy
set (CLANG_TIDY_CHECKS
clang-analyzer-*
concurrency-*
misc-*
performance-*
portability-*
readability-*
-readability-braces-around-statements
-readability-implicit-bool-conversion
-readability-magic-numbers
-misc-non-private-member-variables-in-classes
)
list(JOIN CLANG_TIDY_CHECKS_PARM "," CLANG_TIDY_CHECKS)
set (CMAKE_CXX_CLANG_TIDY
clang-tidy;
-header-filter=.;
-checks=${CLANG_TIDY_CHECKS_PARM};
-warnings-as-errors=*;
)
# cppcheck
find_program (CMAKE_CXX_CPPCHECK NAMES cppcheck)
list (APPEND CMAKE_CXX_CPPCHECK
"--quiet"
"--enable=all"
"--suppress=unmatchedSuppression"
"--suppress=unusedFunction"
"--suppress=missingInclude"
"--suppress=noOperatorEq"
"--suppress=noCopyConstructor"
"--suppress=unusedPrivateFunction"
"--suppress=memsetClassFloat"
"--suppress=useStlAlgorithm"
"--suppress=constParameter:*/Table.h"
"--suppress=constParameter:*/Ordering.h"
"--suppress=constParameter:*/List.h"
"--suppress=constParameter:*/Dictionary.h"
"--suppress=unreadVariable:*/TimeLib.cpp"
"--suppress=invalidPointerCast:*/H5Array.h"
"--suppress=copyCtorPointerCopying:*/MsgQ.cpp"
"--suppress=knownConditionTrueFalse:*/packages/legacy/UT_*"
"--suppress=uninitStructMember:*/plugins/icesat2/plugin/Atl06Dispatch.cpp"
"--error-exitcode=1"
"-DLLONG_MAX"
)
endif()
###################
# Project Options #
###################
# Project Options #
option (SHARED_LIBRARY "Create shared library instead of sliderule binary" OFF)
option (SERVER_APP "Create sliderule server binary" ON)
# Library Options #
option (ENABLE_ADDRESS_SANITIZER "Instrument code with AddressSanitizer for memory error detection" OFF)
option (ENABLE_TIME_HEARTBEAT "Instruct TimeLib to use a 1KHz heart beat timer to set millisecond time resolution" OFF)
option (ENABLE_CUSTOM_ALLOCATOR "Override new and delete operators globally for debug purposes" OFF)
option (ENABLE_H5CORO_ATTRIBUTE_SUPPORT "H5Coro will read and process attribute messages" OFF)
option (ENABLE_APACHE_ARROW_10_COMPAT "Use Apache Arrow 11 interface" OFF)
option (ENABLE_BEST_EFFORT_CONDA_ENV "Attempt to alleviate some issues with running in a conda environment")
# Package Options #
option (USE_ARROW_PACKAGE "Include the Apache Arrow package" OFF)
option (USE_AWS_PACKAGE "Include the AWS package" OFF)
option (USE_CCSDS_PACKAGE "Include the CCSDS package" ON)
option (USE_GEO_PACKAGE "Include the GEO package" OFF)
option (USE_H5_PACKAGE "Include the HDF5 package" ON)
option (USE_LEGACY_PACKAGE "Include the Legacy package" ON)
option (USE_NETSVC_PACKAGE "Include the Network Services package" OFF)
option (USE_PISTACHE_PACKAGE "Include the Pistache package" OFF)
# Platform Options #
option (ENABLE_TRACING "Instantiate trace points" OFF)
option (ENABLE_TERMINAL "Instantiate terminal messages" ON)
# Version Information #
file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/version.txt TGTVER)
string(REPLACE "v" "" LIBVER ${TGTVER})
# C++ Version #
set(CXX_VERSION 17) # required if using pistache package
# Platform #
set_property(GLOBAL PROPERTY platform "")
if(CMAKE_BUILD_PLATFORM MATCHES "Linux")
# Prefer libraries installed in /usr/local
INCLUDE_DIRECTORIES(/usr/local/include)
LINK_DIRECTORIES(/usr/local/lib /usr/local/lib64)
# Set Environment Variables
set (INSTALLDIR /usr/local CACHE STRING "Installation directory for library and executables")
set (CONFDIR ${INSTALLDIR}/etc/sliderule)
set (INCDIR ${INSTALLDIR}/include/sliderule)
elseif(CMAKE_BUILD_PLATFORM MATCHES "Windows")
# Set Environment Variables
set (INSTALLDIR "C:\\Program Files\\SlideRule" CACHE STRING "Installation directory for library and executables")
set (CONFDIR ${INSTALLDIR}\etc\sliderule)
set (INCDIR ${INSTALLDIR}\include\sliderule)
endif()
set (RUNTIMEDIR ${CONFDIR} CACHE STRING "Runtime directory for plugins and configuration scripts")