in your build system. In this case it's CMake, so adding the following lines to your CMakeLists.txt should do (and in ESP IDF, ${COMPONENT_LIB} is the CMake target with the Swift source code):
get_filename_component(compiler_bin_dir ${CMAKE_Swift_COMPILER} DIRECTORY)
target_link_directories(${COMPONENT_LIB} PUBLIC "${compiler_bin_dir}/../lib/swift/embedded/riscv32-none-none-eabi")
target_link_libraries(${COMPONENT_LIB} PUBLIC
-Wl,--whole-archive
swiftUnicodeDataTables
-Wl,--no-whole-archive
)
(For some reason that I don't fully understand, I had to use the --whole-archive/--no-whole-archive flags to get this to link. If someone has better insights into the semantics of ELF linking, I'd love to learn why )
As a note my homebrew installed version of swiftly doesn't let me create a valid location from ${compiler_bin_dir}/../lib/swift/embedded/riscv32-none-none-eabi" so I copied the needed library into my project directory for now.
I did not need to link the directory to make it compile, because I just put the full link to the library in.
target_link_libraries(${COMPONENT_LIB} PUBLIC
-Wl,--whole-archive
${CMAKE_SOURCE_DIR}/helpers/riscv32-none-none-eabi/libswiftUnicodeDataTables.a
-Wl,--no-whole-archive
)
I haven't made sure everything works, but it does compile.
UPDATE
This also compiles and uses the fancy swiftly detect from the Zephyr directions with some changes, including stripping whitespace from the variables.