In order to support ability to use Swift programming language with Embedded platform support, I've adjusted CMakeLists according to Example at https://github.com/apple/swift-embedded-examples/tree/main/esp32-led-strip-sdk
and installed dev snapshot of swift toolchain that supports embedded platforms.
Project structure:
src/
Main.swift
Dummy.c
BridgingHeader.h
CMakeLists.txt
platform.ini
[env:esp32-c6-devkitc-1]
platform = espressif32 @ 6.7.0
board = esp32-c6-devkitc-1
framework = espidf
Main idea of approach is to build Swift sources and link to main target.
It's being achieved by next steps:
- creating of custom command (add_custom_command) that produces library.o object.
- creating of custom target that depends on library.o (add_custom_target)
- linking of _idf_main with library.o
- setting dependency of _idf_main on custom target (add_dependencies)
This works fine from terminal by idf.py build BUT looks like custom command and target are not being built in VS Code with PlatformIO, I've tried to replace swift build command with test one and it's net being executed.
Build fails because of missing implementation for app_main function that is declared in Main.swift, so because of library wasn't built.
Please advice what can cause an ignoring of custom target and command by build system.
I see that build.ninja contains build commands for custom target and command based on CMakeLists.txt but looks they are not executed.
CMakeLists.txt
In order to support ability to use Swift programming language with Embedded platform support, I've adjusted CMakeLists according to Example at https://github.com/apple/swift-embedded-examples/tree/main/esp32-led-strip-sdk
and installed dev snapshot of swift toolchain that supports embedded platforms.
Project structure:
src/
Main.swift
Dummy.c
BridgingHeader.h
CMakeLists.txt
platform.ini
[env:esp32-c6-devkitc-1]
platform = espressif32 @ 6.7.0
board = esp32-c6-devkitc-1
framework = espidf
Main idea of approach is to build Swift sources and link to main target.
It's being achieved by next steps:
This works fine from terminal by idf.py build BUT looks like custom command and target are not being built in VS Code with PlatformIO, I've tried to replace swift build command with test one and it's net being executed.
Build fails because of missing implementation for app_main function that is declared in Main.swift, so because of library wasn't built.
Please advice what can cause an ignoring of custom target and command by build system.
I see that build.ninja contains build commands for custom target and command based on CMakeLists.txt but looks they are not executed.
CMakeLists.txt