Skip to content

Commit 3134ab4

Browse files
authored
Update Strings.md (#175)
1 parent e346934 commit 3134ab4

File tree

1 file changed

+27
-0
lines changed
  • Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift

1 file changed

+27
-0
lines changed

Sources/EmbeddedSwift/Documentation.docc/UsingEmbeddedSwift/Strings.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,33 @@ $ swiftc <inputs> -target armv6m-none-none-eabi -enable-experimental-feature Emb
3535
$ ld ... -o binary output.o $(dirname `which swiftc`)/../lib/swift/embedded/armv6m-none-none-eabi/libswiftUnicodeDataTables.a
3636
```
3737

38+
Alternatively in a CMake build try something like the below which will check a Swiftly based install.
39+
40+
Update the `COMPILER_TARGET` variable to the architecture desired.
41+
42+
```CMake
43+
set(COMPILER_TARGET "riscv32-none-none-eabi")
44+
45+
find_program(SWIFTLY "swiftly")
46+
IF(SWIFTLY)
47+
execute_process(COMMAND swiftly use --print-location OUTPUT_VARIABLE toolchain_path OUTPUT_STRIP_TRAILING_WHITESPACE)
48+
cmake_path(SET additional_lib_path NORMALIZE "${toolchain_path}/usr/lib/swift/embedded/${COMPILER_TARGET}")
49+
ELSE()
50+
get_filename_component(compiler_bin_dir ${CMAKE_Swift_COMPILER} DIRECTORY)
51+
cmake_path(SET additional_lib_path NORMALIZE "${compiler_bin_dir}/../lib/swift/embedded/${COMPILER_TARGET}")
52+
ENDIF()
53+
54+
target_link_directories(${COMPONENT_LIB} PUBLIC "${additional_lib_path}")
55+
target_link_libraries(${COMPONENT_LIB}
56+
-Wl,--whole-archive
57+
swiftUnicodeDataTables
58+
-Wl,--no-whole-archive
59+
)
60+
61+
## decomment the below line to troubleshoot path issues if needed.
62+
# message(" ----------::: ${additional_lib_path} :::---------- ")
63+
```
64+
3865
**Unicode data tables are required for (list not exhaustive):**
3966

4067
- Comparing String objects for equality

0 commit comments

Comments
 (0)