Skip to content

Commit

Permalink
Retire clang_version
Browse files Browse the repository at this point in the history
Note: this makes the "install" target install the compiler rt
into the compiler's runtime directory.  IMO, it's what "install" is
supposed to do.  If you want to avoid modifing the runtime directory
for some reasons, you can still do "dist" without "install".
  • Loading branch information
yamt committed Jul 18, 2024
1 parent 08be2d4 commit 56f4092
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,11 @@ find_program(PYTHON python3 python REQUIRED)

# Set some variables based on the `version.py` script
set(version_script ${CMAKE_CURRENT_SOURCE_DIR}/version.py)
execute_process(
COMMAND ${PYTHON} ${version_script} llvm-major --llvm-dir=${llvm_proj_dir}
OUTPUT_VARIABLE clang_version
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${PYTHON} ${version_script}
OUTPUT_VARIABLE wasi_sdk_version
OUTPUT_STRIP_TRAILING_WHITESPACE)

message(STATUS "wasi-sdk toolchain LLVM version is ${clang_version}")
message(STATUS "wasi-sdk version is ${wasi_sdk_version}")

# Only include one version of the build logic as pulling in both isn't
Expand Down
9 changes: 6 additions & 3 deletions cmake/wasi-sdk-sysroot.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ option(WASI_SDK_INCLUDE_TESTS "Whether or not to build tests by default" OFF)

set(wasi_tmp_install ${CMAKE_CURRENT_BINARY_DIR}/install)
set(wasi_sysroot ${wasi_tmp_install}/share/wasi-sysroot)
set(wasi_resource_dir ${wasi_tmp_install}/lib/clang/${clang_version})
set(wasi_resource_dir ${wasi_tmp_install}/wasi-resource-dir)

# Force usage of the custom-built resource-dir and sysroot for the rest of the
# wasi compiles.
Expand Down Expand Up @@ -243,9 +243,12 @@ endforeach()
# misc build logic
# =============================================================================

install(DIRECTORY ${wasi_tmp_install}/lib ${wasi_tmp_install}/share
install(DIRECTORY ${wasi_tmp_install}/share
USE_SOURCE_PERMISSIONS
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${wasi_resource_dir}/lib
USE_SOURCE_PERMISSIONS
DESTINATION ${clang_resource_dir})

# Add a top-level `build` target as well as `build-$target` targets.
add_custom_target(build ALL)
Expand Down Expand Up @@ -279,7 +282,7 @@ set(dist_dir ${CMAKE_CURRENT_BINARY_DIR}/dist)
# Tarball with just `compiler-rt` builtins within it
wasi_sdk_add_tarball(dist-compiler-rt
${dist_dir}/libclang_rt.builtins-wasm32-wasi-${wasi_sdk_version}.tar.gz
${wasi_tmp_install}/lib/clang/${clang_version}/lib/wasi)
${wasi_resource_dir}/lib/wasi)
add_dependencies(dist-compiler-rt compiler-rt)

# Tarball with the whole sysroot
Expand Down

0 comments on commit 56f4092

Please sign in to comment.