File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -28,13 +28,24 @@ add_compile_options(
2828 # Disable PIC
2929 "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -fno-pic>"
3030
31- # Assortment of defines for Zephyr
32- "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -DKERNEL -Xcc -DNRF52840_XXAA -Xcc -DPICOLIBC_INTEGER_PRINTF_SCANF -Xcc -D_FORTIFY_SOURCE=1 -Xcc -D_POSIX_C_SOURCE=200809 -Xcc -D__LINUX_ERRNO_EXTENSIONS__ -Xcc -D__PROGRAM_START -Xcc -D__ZEPHYR__=1>"
33-
3431 # Add Libc include paths
3532 "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -I -Xcc ${ZEPHYR_SDK_INSTALL_DIR} /arm-zephyr-eabi/picolibc/include>"
3633)
3734
35+ # Add definitions from Zephyr to -Xcc flags
36+ get_target_property (ZEPHYR_DEFINES zephyr_interface INTERFACE_COMPILE_DEFINITIONS )
37+ if (ZEPHYR_DEFINES)
38+ foreach (flag ${ZEPHYR_DEFINES} )
39+ # Ignore expressions like "$<SOMETHING>"
40+ string (FIND "${flag} " "$<" start_of_expression)
41+ if (NOT start_of_expression EQUAL -1)
42+ continue ()
43+ endif ()
44+
45+ add_compile_options ("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -D${flag} >" )
46+ endforeach ()
47+ endif ()
48+
3849target_sources (app PRIVATE Stubs.c)
3950
4051# The Swift code providing "main" needs to be in an OBJECT library (instead of STATIC library) to make sure it actually gets linker.
You can’t perform that action at this time.
0 commit comments