forked from stm32duino/Arduino_Core_STM32
/
easy_cmake.cmake
105 lines (87 loc) · 3.04 KB
/
easy_cmake.cmake
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# This file was autogenerated by {{scriptfile}}.
# Use it in your CMake configuration by `include()`'ing it.
# You can also copy it in your sketch's folder and edit it to fit your project.
cmake_minimum_required(VERSION 3.21)
# STEP 1: set up bases of environment
# -----------------------------------------------------------------------------
file(REAL_PATH "{{corepath}}" CORE_PATH EXPAND_TILDE)
file(TO_CMAKE_PATH "{{"${CORE_PATH}"}}" CORE_PATH)
file(REAL_PATH "{{userlibs}}" USER_LIBS EXPAND_TILDE)
file(TO_CMAKE_PATH "{{"${USER_LIBS}"}}" USER_LIBS)
set(BOARDNAME "{{boardname or "@board_name_here@"}}")
list(APPEND CMAKE_MODULE_PATH {{"${CORE_PATH}"}}/cmake)
set(CMAKE_TOOLCHAIN_FILE toolchain)
# You may remove this block when using this file as the sketch's CMakeLists.txt
if (NOT ${CMAKE_PARENT_LIST_FILE} STREQUAL ${CMAKE_CURRENT_LIST_FILE})
# When we are imported from the main CMakeLists.txt, we should stop here
# not to interfere with the true build config.
return()
endif()
project("{{tgtname+"_project" if tgtname else "@project_name_here@"}}")
# STEP 2: configure the build
# -----------------------------------------------------------------------------
# Uncomment and pick the relevant value for each keyword!
# The first value listed is the default (when the feature is supported by the board)
# This means that leaving everything commented out yields the default config
include(set_board)
set_board("{{"${BOARDNAME}"}}"
# SERIAL generic / disabled / none
# USB none / CDCgen / CDC / HID
# XUSB FS / HS / HSFS
# VIRTIO disable / generic / enabled
# BOOTLOADER dfuo / dfu2 / hid
)
include(overall_settings)
overall_settings(
# STANDARD_LIBC
# PRINTF_FLOAT
# SCANF_FLOAT
# DEBUG_SYMBOLS
# LTO
# NO_RELATIVE_MACRO
# UNDEF_NDEBUG
# OPTIMIZATION "s"
# BUILD_OPT ./build.opt
# DISABLE_HAL_MODULES ADC I2C RTC SPI TIM DAC EXTI ETH SD QSPI
# CORE_CALLBACK
)
# STEP 3: configure your sketch
# -----------------------------------------------------------------------------
include(external_library)
# I cannot tell the dependencies of the library ahead-of-time
# Please write them in using the DEPENDS ... clause
# The same directives apply as for `build_sketch()` just below.
{% for libdir in libs | sort %}
external_library(PATH "{{"${USER_LIBS}"}}/{{libdir}}")
{% endfor %}
include(build_sketch)
build_sketch(TARGET "{{tgtname or "@binary_name_here@"}}"
SOURCES
{% for file in scrcfiles | sort %}
{{file}}
{% else %}
./file1.ino
./file2.ino
./file3.cpp
./file4.c
./file5.S
{% endfor %}
# Uncomment the lines below to bind libraries to your sketch
# Legitimate names after the DEPENDS keywords are:
# - libraries declared with external_library
# - libraries from the libraries/ folder of Arduino_Core_STM32
# DEPENDS
# SD
# Wire
# SPI
)
# STEP 4: optional features
# -----------------------------------------------------------------------------
include(insights)
insights(TARGET "{{tgtname or "@binary_name_here@"}}"
# DIRECT_INCLUDES
# TRANSITIVE_INCLUDES
# SYMBOLS
# ARCHIVES
# LOGIC_STRUCTURE
)