-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
35 lines (28 loc) · 1.27 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
cmake_minimum_required(VERSION 3.5)
set(common "libnmea/src/nmea/nmea.c"
"libnmea/src/nmea/parser_static.c"
"libnmea/src/parsers/parse.c"
)
idf_component_register(INCLUDE_DIRS "libnmea/src/nmea" "libnmea/src/parsers"
SRCS ${common})
set(parsers gpgga gpgll gprmc gpgsa gpgsv gptxt gpvtg)
foreach(parser ${parsers})
# add source file
set(src_file "libnmea/src/parsers/${parser}.c")
target_sources(${COMPONENT_TARGET} PRIVATE ${src_file})
# add some preprocessor definitions to rename the interface functions
set(prefix nmea_${parser}_)
set(defs "allocate_data=${prefix}allocate_data"
"free_data=${prefix}free_data"
"init=${prefix}init"
"parse=${prefix}parse"
"set_default=${prefix}set_default"
)
set_source_files_properties(${src_file} PROPERTIES COMPILE_DEFINITIONS "${defs}")
# Enable the parser
string(TOUPPER ${parser} parser_uppercase)
target_compile_definitions(${COMPONENT_TARGET} PRIVATE "ENABLE_${parser_uppercase}=1")
endforeach()
list(LENGTH parsers parsers_count)
target_compile_definitions(${COMPONENT_TARGET} PRIVATE PARSER_COUNT=${parsers_count})
target_compile_options(${COMPONENT_TARGET} PRIVATE "-Wno-strict-prototypes")