-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindFkModule.cmake
More file actions
89 lines (65 loc) · 2.56 KB
/
FindFkModule.cmake
File metadata and controls
89 lines (65 loc) · 2.56 KB
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
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%H
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions("-DFIRMWARE_GIT_HASH=\"${GIT_COMMIT_HASH}\"")
add_definitions("-DFIRMWARE_GIT_BRANCH=\"${GIT_BRANCH}\"")
add_definitions("-DFIRMWARE_BUILD=\"$ENV{BUILD_TAG}\"")
if (NOT TARGET firmware-common)
if(NOT DEFINED EXTERNAL_DEPENDENCIES)
include(${CMAKE_CURRENT_SOURCE_DIR}/dependencies.cmake)
endif()
set(_module_sources_path ${firmware-common_PATH})
file(GLOB _module_sources ${_module_sources_path}/src/common/*.cpp ${_module_sources_path}/src/modules/*.cpp)
add_arduino_library(firmware-common "${_module_sources}")
target_compile_options(firmware-common PRIVATE -Wall -Werror)
target_include_directories(firmware-common
PUBLIC
${_module_sources_path}/src/common
${_module_sources_path}/src/modules
PRIVATE
${_module_sources_path}/src/common
${_module_sources_path}/src/modules
)
find_package(nanopb)
target_link_libraries(firmware-common nanopb)
find_package(RTCZero)
target_link_libraries(firmware-common RTCZero)
find_package(RTClib)
target_link_libraries(firmware-common RTClib)
find_package(phylum)
target_compile_options(phylum PUBLIC -DPHYLUM_ENABLE_SERIAL_FLASH -DPHYLUM_ENABLE_SD)
target_link_libraries(firmware-common phylum)
find_package(module-protocol)
target_link_libraries(firmware-common module-protocol)
find_package(lwstreams)
target_link_libraries(firmware-common lwstreams)
find_package(Adafruit_ASFcore)
target_link_libraries(firmware-common Adafruit_ASFcore)
find_package(AtSamd)
target_link_libraries(firmware-common AtSamd)
find_package(arduino-logging)
target_link_libraries(firmware-common arduino-logging)
find_package(SerialFlash)
target_link_libraries(firmware-common SerialFlash)
find_package(Adafruit_NeoPixel)
target_link_libraries(firmware-common Adafruit_NeoPixel)
find_package(Wire)
target_link_libraries(firmware-common Wire)
find_package(SPI)
target_link_libraries(firmware-common SPI)
endif()
function(fk_configure_module target_name)
message(STATUS "Configuring FkModule: ${target_name}")
target_link_libraries(${target_name} firmware-common)
target_include_directories(${target_name} PRIVATE ./)
endfunction()