From 68cd5281e4c5ea638e3853124c6b5c663de7878b Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Tue, 16 Jul 2024 00:19:24 -0400 Subject: [PATCH] WASI: Add platform modules Add minimal platform modules to support toolchain files like those in * https://github.com/WebAssembly/wasi-sdk or direct use of `-DCMAKE_SYSTEM_NAME="WASI"` Fixes: #19223 --- Help/manual/cmake-variables.7.rst | 1 + Help/variable/CMAKE_SYSTEM_NAME.rst | 1 + Help/variable/WASI.rst | 7 +++++++ Modules/Platform/WASI-Initialize.cmake | 1 + Modules/Platform/WASI.cmake | 1 + 5 files changed, 11 insertions(+) create mode 100644 Help/variable/WASI.rst create mode 100644 Modules/Platform/WASI-Initialize.cmake create mode 100644 Modules/Platform/WASI.cmake diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 1abdd626e8..780ec9f4bf 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -346,6 +346,7 @@ Variables that Describe the System /variable/MSVC_VERSION /variable/MSYS /variable/UNIX + /variable/WASI /variable/WIN32 /variable/WINCE /variable/WINDOWS_PHONE diff --git a/Help/variable/CMAKE_SYSTEM_NAME.rst b/Help/variable/CMAKE_SYSTEM_NAME.rst index e9ffec47bf..681ee03c58 100644 --- a/Help/variable/CMAKE_SYSTEM_NAME.rst +++ b/Help/variable/CMAKE_SYSTEM_NAME.rst @@ -85,6 +85,7 @@ Value Name ``UNIX_SV`` SCO UnixWare (pre release 7) ``UnixWare`` SCO UnixWare 7 ``visionOS`` Apple mixed reality operating system +``WASI`` WebAssembly System Interface ``watchOS`` Apple watch operating system ``Windows`` Windows stationary operating systems ``WindowsCE`` Windows Embedded Compact diff --git a/Help/variable/WASI.rst b/Help/variable/WASI.rst new file mode 100644 index 0000000000..eacfc3f9fd --- /dev/null +++ b/Help/variable/WASI.rst @@ -0,0 +1,7 @@ +WASI +---- + +.. versionadded:: 3.31 + +Set to ``1`` when the target system is WebAssembly System Interface +(:variable:`CMAKE_SYSTEM_NAME` is ``WASI``). diff --git a/Modules/Platform/WASI-Initialize.cmake b/Modules/Platform/WASI-Initialize.cmake new file mode 100644 index 0000000000..b49713f1bb --- /dev/null +++ b/Modules/Platform/WASI-Initialize.cmake @@ -0,0 +1 @@ +set(WASI 1) diff --git a/Modules/Platform/WASI.cmake b/Modules/Platform/WASI.cmake new file mode 100644 index 0000000000..8e4a05bac7 --- /dev/null +++ b/Modules/Platform/WASI.cmake @@ -0,0 +1 @@ +# WASI Platform