forked from blues/note-zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
80 lines (70 loc) · 2.07 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
78
79
80
# Copyright 2022 Blues Inc. All rights reserved.
# Use of this source code is governed by licenses granted by the
# copyright holder including that found in the LICENSE file.
# SPDX-License-Identifier: MIT
# Set CMake policy behavior
cmake_minimum_required(VERSION 3.20.0)
# Load Zephyr Package
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
# Basic Project Configuration
project(note-zephyr
VERSION 1.0.0
LANGUAGES C ASM
)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON) # required for inline asm
# Create variables to alias path names
set(NOTE_C ${CMAKE_CURRENT_LIST_DIR}/note-c)
set(SRC ${CMAKE_CURRENT_LIST_DIR}/src)
# Set global compile settings
zephyr_get_compile_options_for_lang_as_string(C zephyr_options)
message(STATUS ${zephyr_options})
message(STATUS) # Insert blank line for readability
zephyr_compile_options(
-ggdb
-Og
-Wall
# -Wextra
-Wno-unused-parameter
# -Wpedantic
)
zephyr_get_compile_options_for_lang_as_string(C zephyr_options)
message(STATUS ${zephyr_options})
message(STATUS) # Insert blank line for readability
# Zephyr Example Application
target_sources(app
PRIVATE ${SRC}/main.c
PRIVATE ${SRC}/note_c_hooks.c
)
# Build additional 3rd party libs (e.g. `note-c`) with `app`
target_sources(app
PRIVATE ${NOTE_C}/n_atof.c
PRIVATE ${NOTE_C}/n_b64.c
PRIVATE ${NOTE_C}/n_cjson.c
PRIVATE ${NOTE_C}/n_cjson_helpers.c
PRIVATE ${NOTE_C}/n_const.c
PRIVATE ${NOTE_C}/n_ftoa.c
PRIVATE ${NOTE_C}/n_helpers.c
PRIVATE ${NOTE_C}/n_hooks.c
PRIVATE ${NOTE_C}/n_i2c.c
PRIVATE ${NOTE_C}/n_md5.c
PRIVATE ${NOTE_C}/n_printf.c
PRIVATE ${NOTE_C}/n_request.c
PRIVATE ${NOTE_C}/n_serial.c
PRIVATE ${NOTE_C}/n_str.c
PRIVATE ${NOTE_C}/n_ua.c
)
target_include_directories(app
PRIVATE ${NOTE_C}
)
# WARNING: These options are overriden by `zephyr_compile_options()`
target_compile_options(app
PRIVATE -ggdb
PRIVATE -Og
PRIVATE -Wall
PRIVATE -Wextra
# PRIVATE -Wpedantic
PRIVATE -Wimplicit-fallthrough=2
PRIVATE -Wunused-parameter
)