-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
77 lines (65 loc) · 2.66 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
cmake_minimum_required(VERSION 3.10)
project(FlightComputer)
find_package(Protobuf REQUIRED)
include_directories(${Protobuf_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif (NOT CMAKE_BUILD_TYPE)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic -Werror -mtune=native -march=native")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(ASAN_FLAG "-static-libsan")
else ()
set(ASAN_FLAG "-static-libasan")
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 ${ASAN_FLAG} -DDEBUG")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG")
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-but-set-parameter")
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS GroundStation.proto)
set(SOURCES
main.cpp
Devices/rcLib/RadioControlProtocolCpp/rcLib.cpp
Devices/rcLib/RadioControlProtocolCpp/RadioControlProtocolC/rc_lib.c
Devices/rcLib/PackageUtil.cpp
Devices/rcLib/RcLibSimulator.cpp
Devices/GPS/Sim/GpsSimulator.cpp
Devices/GPS/Node/Gps.cpp
Devices/GPS/Type/GpsMeasurement_t.cpp
Devices/Network/Network.cpp
Devices/Serial/SerialPosix.cpp
Devices/SRF02/Node/SRF02.cpp
Devices/SRF02/Sim/SRF02Sim.cpp
Filters/Fusion/Node/Fusion.cpp
Filters/Fusion/Lib/StateEstimateParticleFilter.cpp
Filters/Fusion/Lib/system.c
Filters/Fusion/Lib/random_util.c
Filters/Fusion/Lib/Calibration.cpp
Filters/Navigation/Node/Navigation.cpp
Filters/Navigation/Type/Waypoint_t.cpp
Filters/MeshManager/MeshManager.cpp
Filters/OutputFilter/OutputFilter.cpp
Filters/FeedbackControl/Node/FeedbackControl.cpp
Utilities/Recording/NameProvider.cpp
Utilities/time.cpp
${PROTO_SRCS} ${PROTO_HDRS})
set(SOURCES_PI ${SOURCES}
Devices/LoRa/LoRa.cpp)
set(SOURCES_NO_PI ${SOURCES})
set(LIBS gps pthread stdc++fs SI ${Protobuf_LIBRARIES})
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") # libstdc++6 is kind of fucked in Raspbian with GCC 10
add_definitions(-DRASPBERRY_PI)
add_executable(${PROJECT_NAME} ${SOURCES_PI})
target_link_libraries(${PROJECT_NAME} ${LIBS} wiringPi)
else ()
add_executable(${PROJECT_NAME} ${SOURCES_NO_PI})
target_link_libraries(${PROJECT_NAME} ${LIBS})
endif ()
add_definitions(-DSI_DEFAULT_TYPE=float)
target_include_directories(${PROJECT_NAME} PUBLIC Utilities/SI)
add_subdirectory(Utilities/SI)