From 2da3b0bea277e3458c33f4cde8afe22e68b25f5d Mon Sep 17 00:00:00 2001 From: carlynorama Date: Fri, 19 Sep 2025 09:03:34 -0700 Subject: [PATCH 1/3] Update Strings.md --- .../UsingEmbeddedSwift/Strings.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md b/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md index c4d7cdf8..21d83027 100644 --- a/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md +++ b/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md @@ -35,6 +35,33 @@ $ swiftc -target armv6m-none-none-eabi -enable-experimental-feature Emb $ ld ... -o binary output.o $(dirname `which swiftc`)/../lib/swift/embedded/armv6m-none-none-eabi/libswiftUnicodeDataTables.a ``` +Alternatively in a CMake build try something like the below which will check a Swiftly based install. + +Update the `COMPILER_TARGET` variable to the architecture desired. + +``` + +set(COMPILER_TARGET "riscv32-none-none-eabi") + +find_program(SWIFTLY "swiftly") +IF(SWIFTLY) + execute_process(COMMAND swiftly use --print-location OUTPUT_VARIABLE toolchain_path OUTPUT_STRIP_TRAILING_WHITESPACE) + cmake_path(SET additional_lib_path NORMALIZE "${toolchain_path}/usr/lib/swift/embedded/${COMPILER_TARGET}") +ELSE() + get_filename_component(compiler_bin_dir ${CMAKE_Swift_COMPILER} DIRECTORY) + cmake_path(SET additional_lib_path NORMALIZE "${compiler_bin_dir}/../lib/swift/embedded/${COMPILER_TARGET}") +ENDIF() + +target_link_directories(${COMPONENT_LIB} PUBLIC "${additional_lib_path}") +target_link_libraries(${COMPONENT_LIB} + -Wl,--whole-archive + swiftUnicodeDataTables + -Wl,--no-whole-archive + ) + +# message(" ----------::: ${additional_lib_path} :::---------- ") +``` + **Unicode data tables are required for (list not exhaustive):** - Comparing String objects for equality From 16e70e6310dfb32da220a1d106b3f8f7e3f4fa37 Mon Sep 17 00:00:00 2001 From: carlynorama Date: Sat, 20 Sep 2025 18:38:16 -0700 Subject: [PATCH 2/3] Update Strings.md --- .../Documentation.docc/UsingEmbeddedSwift/Strings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md b/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md index 21d83027..4e010a03 100644 --- a/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md +++ b/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md @@ -39,8 +39,7 @@ Alternatively in a CMake build try something like the below which will check a S Update the `COMPILER_TARGET` variable to the architecture desired. -``` - +```CMake set(COMPILER_TARGET "riscv32-none-none-eabi") find_program(SWIFTLY "swiftly") @@ -59,6 +58,7 @@ target_link_libraries(${COMPONENT_LIB} -Wl,--no-whole-archive ) +## decomment the below line to torubleshoot path issues if needed. # message(" ----------::: ${additional_lib_path} :::---------- ") ``` From 8669675292f57bb7a1c3cf872a1bcd734a4033c8 Mon Sep 17 00:00:00 2001 From: carlynorama Date: Mon, 22 Sep 2025 14:40:33 -0700 Subject: [PATCH 3/3] typo. --- .../Documentation.docc/UsingEmbeddedSwift/Strings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md b/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md index 4e010a03..e8b94dca 100644 --- a/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md +++ b/Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md @@ -58,7 +58,7 @@ target_link_libraries(${COMPONENT_LIB} -Wl,--no-whole-archive ) -## decomment the below line to torubleshoot path issues if needed. +## decomment the below line to troubleshoot path issues if needed. # message(" ----------::: ${additional_lib_path} :::---------- ") ```