File tree 6 files changed +17
-21
lines changed
6 files changed +17
-21
lines changed Original file line number Diff line number Diff line change @@ -822,13 +822,9 @@ endif()
822
822
# Should we cross-compile the standard library for WebAssembly (WASI)?
823
823
is_sdk_requested(WASI swift_build_wasm)
824
824
if (swift_build_wasm AND NOT "${SWIFT_HOST_VARIANT_SDK} " STREQUAL "WASI" )
825
- #if ("${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
826
- # message(FATAL_ERROR "You must set SWIFT_ANDROID_NDK_PATH to cross-compile the Swift runtime for Android")
827
- #endif()
828
- #if (NOT ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Darwin" OR "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux"))
829
- # message(FATAL_ERROR "A Darwin or Linux host is required to build the Swift runtime for Android")
830
- #endif()
831
-
825
+ if (SWIFT_BUILD_DYNAMIC_SDK_OVERLAY OR SWIFT_BUILD_DYNAMIC_STDLIB)
826
+ message (FATAL_ERROR "Unable to build dynamic overlay/stdlib for WASI. WASM does not support dynamic linking." )
827
+ endif ()
832
828
if ("${SWIFT_SDK_WASI_ARCHITECTURES} " STREQUAL "" )
833
829
set (SWIFT_SDK_WASI_ARCHITECTURES wasm32)
834
830
endif ()
Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ export sourcedir=$PWD/..
12
12
-DCMAKE_RANLIB='$sourcedir /wasi-sdk/bin/llvm-ranlib' \
13
13
" \
14
14
--build-stdlib-deployment-targets " wasi-wasm32" \
15
+ --build-swift-dynamic-sdk-overlay false \
16
+ --build-swift-dynamic-stdlib false \
17
+ --build-swift-static-sdk-overlay \
15
18
--build-swift-static-stdlib \
16
19
--install-destdir=" $sourcedir /install" \
17
20
--install-prefix=" /opt/swiftwasm-sdk" \
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ export sourcedir=$PWD/..
15
15
" \
16
16
--build-stdlib-deployment-targets " wasi-wasm32" \
17
17
--build-swift-dynamic-sdk-overlay false \
18
- --build-swift-static-sdk-overlay false \
18
+ --build-swift-dynamic-stdlib false \
19
+ --build-swift-static-sdk-overlay \
19
20
--build-swift-static-stdlib \
20
21
--llvm-targets-to-build " X86;WebAssembly" \
21
22
--stdlib-deployment-targets " wasi-wasm32" \
Original file line number Diff line number Diff line change @@ -531,9 +531,7 @@ function(_add_variant_link_flags)
531
531
if (NOT SWIFT_COMPILER_IS_MSVC_LIKE)
532
532
# FIXME: On Apple platforms, find_program needs to look for "ld64.lld"
533
533
find_program (LDLLD_PATH "ld.lld" )
534
- if ("${SWIFT_SDK_${LFLAGS_SDK} _OBJECT_FORMAT}" STREQUAL "WASM" )
535
- list (APPEND result "-fuse-ld=${CMAKE_SOURCE_DIR} /fakeld" )
536
- elseif ((SWIFT_ENABLE_LLD_LINKER AND LDLLD_PATH AND NOT APPLE ) OR
534
+ if ((SWIFT_ENABLE_LLD_LINKER AND LDLLD_PATH AND NOT APPLE ) OR
537
535
("${LFLAGS_SDK} " STREQUAL "WINDOWS" AND
538
536
NOT "${CMAKE_SYSTEM_NAME} " STREQUAL "WINDOWS" ))
539
537
list (APPEND result "-fuse-ld=lld" )
@@ -1320,6 +1318,12 @@ function(_add_swift_library_single target name)
1320
1318
list (APPEND c_compile_flags -D_WINDLL)
1321
1319
endif ()
1322
1320
endif ()
1321
+ # Double-check that we're not trying to build a dynamic library for WASM.
1322
+ if (SWIFTLIB_SINGLE_SDK MATCHES WASM)
1323
+ if (libkind STREQUAL SHARED)
1324
+ message (FATAL_ERROR "WASM does not support shared libraries." )
1325
+ endif ()
1326
+ endif ()
1323
1327
_add_variant_link_flags(
1324
1328
SDK "${SWIFTLIB_SINGLE_SDK} "
1325
1329
ARCH "${SWIFTLIB_SINGLE_ARCHITECTURE} "
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ if(SWIFT_BUILD_SDK_OVERLAY)
18
18
19
19
add_subdirectory (OSLog)
20
20
21
- if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
21
+ list_intersect("${SWIFT_APPLE_PLATFORMS} " "${SWIFT_SDKS} " building_darwin_sdks)
22
+ if (building_darwin_sdks)
22
23
add_subdirectory (StdlibUnittestFoundationExtras)
23
24
if (SWIFT_INCLUDE_TESTS)
24
25
add_subdirectory (SwiftReflectionTest)
You can’t perform that action at this time.
0 commit comments