diff --git a/clang.cfg b/clang.cfg new file mode 100644 index 0000000..38ddf54 --- /dev/null +++ b/clang.cfg @@ -0,0 +1 @@ +--sysroot=/../share/wasi-sysroot diff --git a/cmake/wasi-sdk-toolchain.cmake b/cmake/wasi-sdk-toolchain.cmake index 4c45abf..cba9c63 100644 --- a/cmake/wasi-sdk-toolchain.cmake +++ b/cmake/wasi-sdk-toolchain.cmake @@ -90,7 +90,6 @@ ExternalProject_Add(llvm-build -DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-wasi -DLLVM_INSTALL_BINUTILS_SYMLINKS=TRUE -DLLVM_ENABLE_LIBXML2=OFF - -DDEFAULT_SYSROOT=../share/wasi-sysroot # Pass `-s` to strip symbols by default and shrink the size of the # distribution -DCMAKE_EXE_LINKER_FLAGS=-s @@ -159,6 +158,18 @@ 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) +function(copy_cfg_file compiler) + set(dst ${wasi_tmp_install}/bin/${compiler}.cfg) + add_custom_command( + OUTPUT ${dst} + COMMAND cmake -E copy ${CMAKE_CURRENT_SOURCE_DIR}/clang.cfg ${dst}) + add_custom_target(copy-${compiler} DEPENDS ${dst}) + add_dependencies(misc-files copy-${compiler}) +endfunction() + +copy_cfg_file(clang) +copy_cfg_file(clang++) + include(wasi-sdk-dist) # Figure out the name of the artifact which is either explicitly specified or