Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] Enable wasi-libc emulations for Foundation #4914

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions Sources/Foundation/CMakeLists.txt
Expand Up @@ -225,6 +225,18 @@ elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
target_link_options(Foundation PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
endif()

if(CMAKE_SYSTEM_NAME STREQUAL WASI)
target_compile_options(Foundation PRIVATE
"SHELL:-Xcc -D_WASI_EMULATED_MMAN
-Xcc -D_WASI_EMULATED_SIGNAL
-Xcc -D_WASI_EMULATED_PROCESS_CLOCKS
-Xcc -D_WASI_EMULATED_GETPID")
# Link wasi-libc emulation libraries. Other emulation libs are also used in stdlib
target_compile_options(Foundation
PRIVATE
"SHELL:-Xfrontend -public-autolink-library -Xfrontend wasi-emulated-getpid")
endif()


set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS Foundation)
_install_target(Foundation)
6 changes: 6 additions & 0 deletions Sources/FoundationXML/CMakeLists.txt
Expand Up @@ -43,6 +43,12 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
target_link_options(FoundationXML PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
endif()

if(CMAKE_SYSTEM_NAME STREQUAL WASI)
target_compile_options(FoundationXML PRIVATE
"SHELL:-Xcc -D_WASI_EMULATED_SIGNAL
-Xcc -D_WASI_EMULATED_PROCESS_CLOCKS
-Xcc -D_WASI_EMULATED_MMAN")
endif()

set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS FoundationXML)
_install_target(FoundationXML)