Skip to content

Commit efed655

Browse files
committed
Adapt the build system for WASI.
1 parent 9bebf25 commit efed655

File tree

6 files changed

+15
-3
lines changed

6 files changed

+15
-3
lines changed

clang/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ CMAKE_DEPENDENT_OPTION(CLANG_PLUGIN_SUPPORT
427427
# If libstdc++ is statically linked, clang-repl needs to statically link libstdc++
428428
# itself, which is not possible in many platforms because of current limitations in
429429
# JIT stack. (more platforms need to be supported by JITLink)
430-
if(NOT LLVM_STATIC_LINK_CXX_STDLIB)
430+
if(NOT LLVM_STATIC_LINK_CXX_STDLIB AND NOT WASI)
431431
set(HAVE_CLANG_REPL_SUPPORT ON)
432432
endif()
433433

libcxxabi/src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ else()
3636
)
3737
endif()
3838

39-
if (LIBCXXABI_ENABLE_THREADS AND (UNIX OR FUCHSIA) AND NOT (APPLE OR CYGWIN)
40-
AND NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX"))
39+
if (LIBCXXABI_ENABLE_THREADS AND (UNIX OR FUCHSIA OR WASI) AND NOT
40+
(APPLE OR CYGWIN) AND NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX"))
4141
list(APPEND LIBCXXABI_SOURCES
4242
cxa_thread_atexit.cpp
4343
)

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ elseif(FUCHSIA OR UNIX)
217217
else()
218218
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
219219
endif()
220+
elseif(WASI)
221+
set(LLVM_ON_WIN32 0)
222+
set(LLVM_ON_UNIX 1)
223+
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
220224
elseif(CMAKE_SYSTEM_NAME STREQUAL "Generic")
221225
set(LLVM_ON_WIN32 0)
222226
set(LLVM_ON_UNIX 0)

llvm/lib/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ add_subdirectory(Remarks)
3131
add_subdirectory(Debuginfod)
3232
add_subdirectory(DebugInfo)
3333
add_subdirectory(DWP)
34+
if (NOT WASI)
3435
add_subdirectory(ExecutionEngine)
36+
endif ()
3537
add_subdirectory(Target)
3638
add_subdirectory(AsmParser)
3739
add_subdirectory(LineEditor)

llvm/lib/Transforms/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ add_subdirectory(InstCombine)
55
add_subdirectory(Scalar)
66
add_subdirectory(IPO)
77
add_subdirectory(Vectorize)
8+
if (NOT WASI)
89
add_subdirectory(Hello)
10+
endif ()
911
add_subdirectory(ObjCARC)
1012
add_subdirectory(Coroutines)
1113
add_subdirectory(CFGuard)

llvm/tools/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ endif()
2828
# Add LTO, llvm-ar, llvm-config, and llvm-profdata before clang, ExternalProject
2929
# requires targets specified in DEPENDS to exist before the call to
3030
# ExternalProject_Add.
31+
if (NOT WASI)
3132
add_llvm_tool_subdirectory(lto)
3233
add_llvm_tool_subdirectory(gold)
3334
add_llvm_tool_subdirectory(llvm-ar)
3435
add_llvm_tool_subdirectory(llvm-config)
3536
add_llvm_tool_subdirectory(llvm-lto)
3637
add_llvm_tool_subdirectory(llvm-profdata)
38+
endif ()
3739

3840
# Projects supported via LLVM_EXTERNAL_*_SOURCE_DIR need to be explicitly
3941
# specified.
@@ -43,6 +45,7 @@ add_llvm_external_project(mlir)
4345
# accordingly so place them afterwards
4446
add_llvm_external_project(clang)
4547
add_llvm_external_project(flang)
48+
if (NOT WASI)
4649
add_llvm_external_project(lldb)
4750
add_llvm_external_project(bolt)
4851

@@ -54,6 +57,7 @@ add_llvm_external_project(polly)
5457

5558
# libclc depends on clang
5659
add_llvm_external_project(libclc)
60+
endif ()
5761

5862
# Add subprojects specified using LLVM_EXTERNAL_PROJECTS
5963
foreach(p ${LLVM_EXTERNAL_PROJECTS})

0 commit comments

Comments
 (0)