Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,6 @@ jobs:
cmake -G Ninja -B build -S . \
-DWASI_SDK_INCLUDE_TESTS=ON \
-DWASI_SDK_TEST_HOST_TOOLCHAIN=ON \
-DCMAKE_TOOLCHAIN_FILE=$(ls ./wasi-sdk-*/share/cmake/wasi-sdk.cmake)
-DCMAKE_TOOLCHAIN_FILE=$(ls ./wasi-sdk-*/share/cmake/wasi-sdk-p1.cmake)
- run: ninja -C build build-tests
- run: ctest --output-on-failure --parallel 10 --test-dir build/tests
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project(wasi-sdk)
include(ExternalProject)

set(WASI_SDK_TARGETS "wasm32-wasi;wasm32-wasip1;wasm32-wasip2;wasm32-wasip1-threads;wasm32-wasi-threads"
set(WASI_SDK_TARGETS "wasm32-wasip1;wasm32-wasip2;wasm32-wasip1-threads"
CACHE STRING "List of WASI targets to build")
option(WASI_SDK_BUILD_TOOLCHAIN "Build a toolchain instead of the sysroot" OFF)

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ is to build the sysroot:
```shell script
cmake -G Ninja -B build/sysroot -S . \
-DCMAKE_INSTALL_PREFIX=build/install \
-DCMAKE_TOOLCHAIN_FILE=build/install/share/cmake/wasi-sdk.cmake \
-DCMAKE_TOOLCHAIN_FILE=build/install/share/cmake/wasi-sdk-p1.cmake \
-DCMAKE_C_COMPILER_WORKS=ON \
-DCMAKE_CXX_COMPILER_WORKS=ON
cmake --build build/sysroot --target install
Expand Down Expand Up @@ -159,16 +159,16 @@ includes/libraries/etc. The `--sysroot=...` option is not necessary if

### Integrating with a CMake build system

Use a toolchain file to setup the *wasi-sdk* platform.
Use a toolchain file to setup the *wasi-sdk-p1* platform.

```
$ cmake -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk.cmake ...
$ cmake -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p1.cmake ...
```

or the *wasi-sdk-thread* platform
or the *wasi-sdk-p1-pthread* platform

```
$ cmake -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-pthread.cmake ...
$ cmake -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p1-pthread.cmake ...
```

## Notes for Autoconf
Expand Down
2 changes: 1 addition & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fi
# Use the just-built toolchain and its `CMAKE_TOOLCHAIN_FILE` to build a
# sysroot.
cmake -G Ninja -B $build_dir/sysroot -S . \
"-DCMAKE_TOOLCHAIN_FILE=$build_dir/install/share/cmake/wasi-sdk.cmake" \
"-DCMAKE_TOOLCHAIN_FILE=$build_dir/install/share/cmake/wasi-sdk-p1.cmake" \
-DCMAKE_C_COMPILER_WORKS=ON \
-DCMAKE_CXX_COMPILER_WORKS=ON \
-DWASI_SDK_INCLUDE_TESTS=ON \
Expand Down
14 changes: 5 additions & 9 deletions cmake/wasi-sdk-sysroot.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function(define_compiler_rt target)
add_dependencies(compiler-rt-build compiler-rt-build-${target})
endfunction()

define_compiler_rt(wasm32-wasi)
define_compiler_rt(wasm32-wasip1)
define_compiler_rt(wasm32-wasip1-threads)

# In addition to the default installation of `compiler-rt` itself also copy
Expand All @@ -115,15 +115,11 @@ add_custom_target(compiler-rt-post-build
COMMAND ${CMAKE_COMMAND} -E copy_directory
${clang_resource_dir}/include ${wasi_resource_dir}/include

# Copy the `lib/wasm32-unknown-wasi` folder to `lib/wasm32-unknown-wasi{p1,p2}` to ensure that those
# OS-strings also work for looking up the compiler-rt.a file.
# Copy the `lib/wasm32-unknown-wasip1` folder to `lib/wasm32-unknown-wasip2`
# to ensure that those OS-strings also work for looking up the compiler-rt.a
# file.
COMMAND ${CMAKE_COMMAND} -E copy_directory
${wasi_resource_dir}/lib/wasm32-unknown-wasi ${wasi_resource_dir}/lib/wasm32-unknown-wasip1
COMMAND ${CMAKE_COMMAND} -E copy_directory
${wasi_resource_dir}/lib/wasm32-unknown-wasi ${wasi_resource_dir}/lib/wasm32-unknown-wasip2
# Copy the `lib/wasm32-unknown-wasip1-threads` folder to `lib/wasm32-unknown-wasi-threads`
COMMAND ${CMAKE_COMMAND} -E copy_directory
${wasi_resource_dir}/lib/wasm32-unknown-wasip1-threads ${wasi_resource_dir}/lib/wasm32-unknown-wasi-threads
${wasi_resource_dir}/lib/wasm32-unknown-wasip1 ${wasi_resource_dir}/lib/wasm32-unknown-wasip2

COMMENT "finalizing compiler-rt installation"
)
Expand Down
5 changes: 2 additions & 3 deletions cmake/wasi-sdk-toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ExternalProject_Add(llvm-build
-DLLVM_INCLUDE_BENCHMARKS=OFF
-DLLVM_INCLUDE_EXAMPLES=OFF
-DLLVM_TARGETS_TO_BUILD=WebAssembly
-DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-wasi
-DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-wasip1
-DLLVM_INSTALL_BINUTILS_SYMLINKS=TRUE
-DLLVM_ENABLE_LIBXML2=OFF
# Pass `-s` to strip symbols by default and shrink the size of the
Expand Down Expand Up @@ -152,8 +152,7 @@ endfunction()

copy_misc_file(src/config/config.sub misc)
copy_misc_file(src/config/config.guess misc)
copy_misc_file(wasi-sdk.cmake cmake)
copy_misc_file(wasi-sdk-pthread.cmake cmake)
copy_misc_file(wasi-sdk-p1-pthread.cmake cmake)
copy_misc_file(wasi-sdk-p1.cmake cmake)
copy_misc_file(wasi-sdk-p2.cmake cmake)
copy_misc_file(cmake/Platform/WASI.cmake cmake/Platform)
Expand Down
2 changes: 1 addition & 1 deletion wasi-sdk-pthread.cmake → wasi-sdk-p1-pthread.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set(CMAKE_SYSTEM_NAME WASI)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR wasm32)
set(triple wasm32-wasi-threads)
set(triple wasm32-wasip1-threads)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
# wasi-threads requires --import-memory.
Expand Down
37 changes: 0 additions & 37 deletions wasi-sdk.cmake

This file was deleted.

Loading