diff --git a/Makefile b/Makefile index fe227f4..4168519 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ build/compiler-rt.BUILT: build/llvm.BUILT -DCOMPILER_RT_INCLUDE_TESTS=OFF \ -DCOMPILER_RT_ENABLE_IOS=OFF \ -DCOMPILER_RT_DEFAULT_TARGET_ONLY=On \ - -DWASM_SDK_PREFIX=$(PREFIX) \ + -DWASI_SDK_PREFIX=$(PREFIX) \ -DCMAKE_C_FLAGS="-O1 $(DEBUG_PREFIX_MAP)" \ -DLLVM_CONFIG_PATH=$(ROOT_DIR)/build/llvm/bin/llvm-config \ -DCOMPILER_RT_OS_DIR=wasi \ @@ -81,7 +81,7 @@ build/libcxx.BUILT: build/llvm.BUILT build/compiler-rt.BUILT build/reference-sys -DLIBCXX_CXX_ABI_INCLUDE_PATHS=$(ROOT_DIR)/src/llvm-project/libcxxabi/include \ -DLIBCXX_HAS_MUSL_LIBC:BOOL=ON \ -DLIBCXX_ABI_VERSION=2 \ - -DWASM_SDK_PREFIX=$(PREFIX) \ + -DWASI_SDK_PREFIX=$(PREFIX) \ -DCMAKE_C_FLAGS="$(DEBUG_PREFIX_MAP)" \ -DCMAKE_CXX_FLAGS="$(DEBUG_PREFIX_MAP)" \ --debug-trycompile \ @@ -107,7 +107,7 @@ build/libcxxabi.BUILT: build/libcxx.BUILT build/llvm.BUILT -DLIBCXXABI_LIBCXX_INCLUDES=$(PREFIX)/share/sysroot/include/c++/v1 \ -DLLVM_CONFIG_PATH=$(ROOT_DIR)/build/llvm/bin/llvm-config \ -DCMAKE_TOOLCHAIN_FILE=$(ROOT_DIR)/wasi-sdk.cmake \ - -DWASM_SDK_PREFIX=$(PREFIX) \ + -DWASI_SDK_PREFIX=$(PREFIX) \ -DCMAKE_C_FLAGS="$(DEBUG_PREFIX_MAP)" \ -DCMAKE_CXX_FLAGS="$(DEBUG_PREFIX_MAP)" \ -DUNIX:BOOL=ON \ diff --git a/README.md b/README.md new file mode 100644 index 0000000..3d30624 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# WASI SDK + +## Quick Start + +[Download SDK packages here.](https://github.com/CraneStation/wasi-sdk/releases) + +## About this repository + +This repository contains no compiler or library code itself; it uses +git submodules to pull in the upstream Clang and LLVM tree, as well as the +WASI reference-sysroot tree. + +The Sysroot portion of this SDK is the +[WASI reference-sysroot](https://github.com/CraneStation/reference-sysroot). + +Upstream Clang and LLVM 8.0 can compile for WASI out of the box, and WebAssembly +support is included in them by default. So, all that's done here is to provide +builds configured to set the default target and sysroot for convenience. + +One could also use a standard Clang 8.0, build a sysroot from the sources +mentioned above, and compile with +"--target=wasm32-unknown-wasi --sysroot=/path/to/sysroot". diff --git a/wasi-sdk.cmake b/wasi-sdk.cmake index 6ec193b..2153185 100644 --- a/wasi-sdk.cmake +++ b/wasi-sdk.cmake @@ -8,18 +8,18 @@ set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_PROCESSOR wasm32) set(triple wasm32-unknown-wasi) -set(CMAKE_C_COMPILER ${WASM_SDK_PREFIX}/bin/clang) -set(CMAKE_CXX_COMPILER ${WASM_SDK_PREFIX}/bin/clang++) -set(CMAKE_AR ${WASM_SDK_PREFIX}/bin/llvm-ar CACHE STRING "wasi-sdk build") -set(CMAKE_RANLIB ${WASM_SDK_PREFIX}/bin/llvm-ranlib CACHE STRING "wasi-sdk build") +set(CMAKE_C_COMPILER ${WASI_SDK_PREFIX}/bin/clang) +set(CMAKE_CXX_COMPILER ${WASI_SDK_PREFIX}/bin/clang++) +set(CMAKE_AR ${WASI_SDK_PREFIX}/bin/llvm-ar CACHE STRING "wasi-sdk build") +set(CMAKE_RANLIB ${WASI_SDK_PREFIX}/bin/llvm-ranlib CACHE STRING "wasi-sdk build") set(CMAKE_C_COMPILER_TARGET ${triple} CACHE STRING "wasi-sdk build") set(CMAKE_CXX_COMPILER_TARGET ${triple} CACHE STRING "wasi-sdk build") set(CMAKE_C_FLAGS "-v" CACHE STRING "wasi-sdk build") set(CMAKE_CXX_FLAGS "-v -std=c++11" CACHE STRING "wasi-sdk build") set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-threads" CACHE STRING "wasi-sdk build") -set(CMAKE_SYSROOT ${WASM_SDK_PREFIX}/share/sysroot CACHE STRING "wasi-sdk build") -set(CMAKE_STAGING_PREFIX ${WASM_SDK_PREFIX}/share/sysroot CACHE STRING "wasi-sdk build") +set(CMAKE_SYSROOT ${WASI_SDK_PREFIX}/share/sysroot CACHE STRING "wasi-sdk build") +set(CMAKE_STAGING_PREFIX ${WASI_SDK_PREFIX}/share/sysroot CACHE STRING "wasi-sdk build") # Don't look in the sysroot for executables to run during the build set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)