Skip to content
Merged
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ option(BUILD_TESTS "Whether or not to build tests" OFF)
option(SIMD "Whether or not to build simd-enabled intrinsics into wasi-libc" OFF)
option(BUILD_SHARED "Whether or not to build shared libraries" ON)
option(CHECK_SYMBOLS "Whether or not to check the exported symbols of libc.a" OFF)
set(WASI_SDK_VERSION "" CACHE STRING "Version information for wasi-sdk to embed in headers")

if(TARGET_TRIPLE MATCHES "-threads$")
set(WASI p1)
Expand Down
6 changes: 6 additions & 0 deletions libc-bottom-half/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ add_subdirectory(signal)
# =============================================================================
# sysroot headers from the bottom half
#
if(WASI_SDK_VERSION)
set(__wasi_sdk_version__ ${WASI_SDK_VERSION})
if (WASI_SDK_VERSION MATCHES "([0-9]+)\\..*")
set(__wasi_sdk_major__ ${CMAKE_MATCH_1})
endif()
endif()
configure_file(headers/public/wasi/version.h.in ${SYSROOT_INC}/wasi/version.h)
add_custom_target(sysroot-wasi-snapshot-header DEPENDS ${SYSROOT_INC}/wasi/version.h)
add_dependencies(sysroot_inc sysroot-wasi-snapshot-header)
Expand Down
3 changes: 3 additions & 0 deletions libc-bottom-half/headers/public/wasi/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
#cmakedefine __wasip2__
#cmakedefine __wasip3__

#cmakedefine __wasi_sdk_major__ @__wasi_sdk_major__@
#cmakedefine __wasi_sdk_version__ "@__wasi_sdk_version__@"

#endif /* __WASI_VERSION_H */