[PATCH] D60812: Don't error on CMAKE_SYSTEM_NAME=Wasi

Matthew Bauer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 22:18:25 PDT 2019


matthewbauer created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, mgorny, dschuff.
Herald added a project: LLVM.

When CMAKE_SYSTEM_NAME=Wasi, we are not targeting UNIX or WIN32 but Wasi:

https://wasi.dev

In this case, LLVM should recognize that this is a supported platform even though it is not UNIX or WIN32. Unlike Wasm, Wasi has a set ABI that provides some stability. The casing of "Wasi" is used instead of "WASI" to mirror that of the commonly used value of CMAKE_SYSTEM_NAME=Wasm for generic WebAssembly.

You can build libcxx and libcxxabi for Wasi given that you disable:

- threads
- exceptions
- shared linking

This patch makes it possible to avoid lying to LLVM about Wasi being "UNIX" when it isn't. HandleLLVMOptions.cmake is included by libcxxabi any time you set an LLVM_* flag like  LLVM_COMPILER_CHECKED, LLVM_PATH, or LLVM_ENABLE_LIBCXX.


Repository:
  rL LLVM

https://reviews.llvm.org/D60812

Files:
  llvm/cmake/modules/HandleLLVMOptions.cmake


Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -127,7 +127,10 @@
       set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
     endif()
   else(FUCHSIA OR UNIX)
-    MESSAGE(SEND_ERROR "Unable to determine platform")
+    if(${CMAKE_SYSTEM_NAME} MATCHES "Wasi")
+    else()
+      MESSAGE(SEND_ERROR "Unable to determine platform")
+    endif()
   endif(FUCHSIA OR UNIX)
 endif(WIN32)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60812.195510.patch
Type: text/x-patch
Size: 541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190417/7afe2f96/attachment.bin>


More information about the llvm-commits mailing list