-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
75 lines (62 loc) · 1.77 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
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(rid-transmitter VERSION 0.1 LANGUAGES C CXX)
add_compile_options(-Wall -Werror -Wunused -Wextra -Wno-address-of-packed-member)
string(ASCII 27 Esc)
set(White "${Esc}[m")
set(Red "${Esc}[31m")
set(Green "${Esc}[32m")
set(Yellow "${Esc}[33m")
set(Blue "${Esc}[34m")
set(BoldGreen "${Esc}[1;32m")
# Determine git version
exec_program(
"git"
${CMAKE_CURRENT_SOURCE_DIR}
ARGS "describe"
OUTPUT_VARIABLE GIT_TAG
)
#...if not found get the SHA1 hash instead
if(${GIT_TAG} MATCHES "fatal:.*")
exec_program(
"git"
${CMAKE_CURRENT_SOURCE_DIR}
ARGS "rev-parse HEAD"
OUTPUT_VARIABLE GIT_VERSION
)
else()
set(GIT_VERSION ${GIT_TAG})
endif()
add_definitions(-DAPP_GIT_VERSION="${GIT_VERSION}")
message("-- Version: ${BoldGreen}${GIT_VERSION}${White}")
##### Build mavlink-cpp
add_subdirectory(libraries/mavlink-cpp)
# Include bluez
find_package(PkgConfig REQUIRED)
pkg_check_modules(BLUEZ REQUIRED bluez)
include_directories(${BLUEZ_INCLUDE_DIRS})
link_directories(${BLUEZ_LIBRARY_DIRS})
include_directories(
src/misc
src/Bluetooth
src/Transmitter
src/Transmitter/parameters
libraries/tomlplusplus/
libraries/opendroneid-core-c/libopendroneid
${BLUEZ_INCLUDE_DIRS}
)
# Create executable
add_executable(${PROJECT_NAME}
libraries/opendroneid-core-c/libopendroneid/opendroneid.c
src/Bluetooth/Bluetooth.cpp
src/Bluetooth/BluetoothLegacy.cpp
src/Bluetooth/print_bt_features.c
src/Transmitter/Transmitter.cpp
src/Transmitter/parameters/parameters.cpp
src/main.cpp
)
target_link_libraries(${PROJECT_NAME}
mavlink-cpp
${BLUEZ_LIBRARIES}
)