File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,20 @@ includes/libraries/etc. The `--sysroot=...` option is not necessary if
84
84
` WASI_SDK_PATH ` is ` /opt/wasi-sdk ` . For troubleshooting, one can replace the
85
85
` --sysroot ` path with a manual build of [ wasi-libc] .
86
86
87
+ ### Integrating with a CMake build system
88
+
89
+ Use a toolchain file to setup the * wasi-sdk* platform.
90
+
91
+ ```
92
+ $ cmake -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk.cmake ...
93
+ ```
94
+
95
+ or the * wasi-sdk-thread* platform
96
+
97
+ ```
98
+ $ cmake -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-pthread.cmake ...
99
+ ```
100
+
87
101
## Notes for Autoconf
88
102
89
103
[ Autoconf] 2.70 now [ recognizes WASI] .
Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ else()
21
21
set (WASI_HOST_EXE_SUFFIX "" )
22
22
endif ()
23
23
24
+ # When building from source, WASI_SDK_PREFIX represents the generated directory
25
+ if (NOT WASI_SDK_PREFIX)
26
+ set (WASI_SDK_PREFIX ${CMAKE_CURRENT_LIST_DIR} /../../)
27
+ endif ()
28
+
24
29
set (CMAKE_C_COMPILER ${WASI_SDK_PREFIX} /bin/clang${WASI_HOST_EXE_SUFFIX} )
25
30
set (CMAKE_CXX_COMPILER ${WASI_SDK_PREFIX} /bin/clang++${WASI_HOST_EXE_SUFFIX} )
26
31
set (CMAKE_ASM_COMPILER ${WASI_SDK_PREFIX} /bin/clang${WASI_HOST_EXE_SUFFIX} )
Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ else()
18
18
set (WASI_HOST_EXE_SUFFIX "" )
19
19
endif ()
20
20
21
+ # When building from source, WASI_SDK_PREFIX represents the generated directory
22
+ if (NOT WASI_SDK_PREFIX)
23
+ set (WASI_SDK_PREFIX ${CMAKE_CURRENT_LIST_DIR} /../../)
24
+ endif ()
25
+
21
26
set (CMAKE_C_COMPILER ${WASI_SDK_PREFIX} /bin/clang${WASI_HOST_EXE_SUFFIX} )
22
27
set (CMAKE_CXX_COMPILER ${WASI_SDK_PREFIX} /bin/clang++${WASI_HOST_EXE_SUFFIX} )
23
28
set (CMAKE_ASM_COMPILER ${WASI_SDK_PREFIX} /bin/clang${WASI_HOST_EXE_SUFFIX} )
You can’t perform that action at this time.
0 commit comments