@@ -8,18 +8,6 @@ include(ensure_ctags)
88project ("Arduino_Core_STM32" CXX C ASM)
99
1010
11- set (FEAT_NANOC ON CACHE BOOL "Use nano libc?" )
12- set (FEAT_FPF OFF CACHE BOOL "nanolibc: enable %f in printf?" )
13- set (FEAT_FSF OFF CACHE BOOL "nanolibc: enable %f in scanf?" )
14- set (FEAT_TIMER ON CACHE BOOL "Timer support" )
15-
16- set (BUILD_OPT "s" CACHE STRING "Optimization level" )
17- set (BUILD_DBG OFF CACHE BOOL "Enable debug symbols" )
18- set (BUILD_LTO OFF CACHE BOOL "Enable Link-Time-Optimisations" )
19- set (BUILD_RELPATH ON CACHE BOOL "make __FILE__ be relative instead of absolute" )
20- set (BUILD_NDEBUG ON CACHE BOOL "define the NDEBUG macro?" )
21-
22-
2311set (BUILD_CORE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cores/arduino" )
2412set (BUILD_SYSTEM_PATH "${CMAKE_CURRENT_SOURCE_DIR} /system" )
2513set (BUILD_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR} /libraries" )
@@ -34,67 +22,11 @@ ensure_ctags(${CTAGS_PATH} ${AUTODL_CTAGS})
3422
3523add_library (base_config INTERFACE )
3624
37- if (${BUILD_RELPATH} )
38- # $<TARGET_PROPERTY:SOURCE_DIR> is evaluated by the final consumer, no base_config
39- target_compile_options (base_config INTERFACE
40- "-fmacro-prefix-map=$<TARGET_PROPERTY:SOURCE_DIR>=."
41- )
42- endif ()
43-
44- if (${BUILD_NDEBUG} )
45- add_compile_definitions (base_config INTERFACE NDEBUG)
46- endif ()
47-
48-
49- if (${FEAT_NANOC} )
50- target_link_options (base_config INTERFACE
51- "--specs=nano.specs"
52- )
53- if (${FEAT_FPF} )
54- target_link_options (base_config INTERFACE
55- "SHELL:-u _printf_float"
56- )
57- endif ()
58- if (${FEAT_FSF} )
59- target_link_options (base_config INTERFACE
60- "SHELL:-u _scanf_float"
61- )
62- endif ()
63- endif ()
64-
65- if (${FEAT_TIMER} )
66- target_compile_definitions (base_config INTERFACE
67- HAL_TIM_MODULE_ENABLE
68- )
69- else ()
70- # triggers a user-directed warning
71- target_compile_definitions (base_config INTERFACE
72- HAL_TIM_MODULE_DISABLED
73- )
74- endif ()
75-
76- if (${BUILD_OPT} MATCHES "^[0-3gs]$" )
77- target_compile_options (base_config INTERFACE
78- -O${BUILD_OPT}
79- )
80- else ()
81- message (SEND_ERROR "Bad value for BUILD_OPT: got `${BUILD_OPT} `, expected one of 0123gs." )
82- endif ()
83-
84- if (${BUILD_DBG} )
85- target_compile_options (base_config INTERFACE
86- -g
87- )
88- endif ()
89-
90- if (${BUILD_LTO} )
91- target_compile_options (base_config INTERFACE
92- -flto
93- )
94- target_link_options (base_config INTERFACE
95- -flto
96- )
97- endif ()
25+ # better than an if/else because these may be defined later
26+ target_link_libraries (base_config INTERFACE
27+ $<TARGET_NAME_IF_EXISTS:user_settings>
28+ $<TARGET_NAME_IF_EXISTS:board>
29+ )
9830
9931# generic compilation options
10032target_link_libraries (base_config INTERFACE board)
@@ -145,8 +77,6 @@ target_include_directories(base_config INTERFACE
14577 "${BUILD_SYSTEM_PATH} /Middlewares/OpenAMP/open-amp/lib/include"
14678 "${BUILD_SYSTEM_PATH} /Middlewares/OpenAMP/libmetal/lib/include"
14779 "${BUILD_SYSTEM_PATH} /Middlewares/OpenAMP/virtual_driver"
148-
149- "${BUILD_LIB_PATH} /SrcWrapper/src"
15080)
15181
15282add_subdirectory (${BUILD_CORE_PATH} )
@@ -156,11 +86,6 @@ add_subdirectory(${BUILD_LIB_PATH})
15686
15787add_library (stm32_runtime INTERFACE )
15888target_link_libraries (stm32_runtime INTERFACE
159- # note: there may be recursive dependencies between core and SrcWrapper (v. <= 2.2.0)
160- # this would require some --Wl,--start-group / -Wl,--end-group
161- # but SrcWrapper is an object library, not an archive, so it isn't necessary
162- # (this means the linker takes all the object unconditionally, as opposed to an archive where it picks what it needs)
163- # note: SrcWrapper in particular MUST be an object library, due to possible weak+strong symbols (cf. library.properties)
16489 base_config
16590
16691 SrcWrapper
0 commit comments