Skip to content

Commit 51c92f5

Browse files
[WASM] Add SWIFTWASM_DISABLE_REFLECTION_TEST to disable building swift-reflection-test
1 parent ce5f7e4 commit 51c92f5

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ option(SWIFT_REPORT_STATISTICS
369369
"Create json files which contain internal compilation statistics"
370370
FALSE)
371371

372+
# FIXME(wasm) Reflection tests are temporalily disabled due to lack of linker features
373+
option(SWIFTWASM_DISABLE_REFLECTION_TEST
374+
"Disable building swift-reflection-test for WebAssembly build"
375+
FALSE)
376+
372377
#
373378
# User-configurable experimental options. Do not use in production builds.
374379
#

stdlib/private/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if(SWIFT_BUILD_SDK_OVERLAY)
2727
endif()
2828
# Currently SwiftReflectionTest cannot be built on Windows, due to
2929
# dependencies on POSIX symbols
30-
if (SWIFT_INCLUDE_TESTS AND (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows"))
30+
if (SWIFT_INCLUDE_TESTS AND (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") AND NOT SWIFTWASM_DISABLE_REFLECTION_TEST)
3131
add_subdirectory(SwiftReflectionTest)
3232
endif()
3333
endif()

test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ foreach(SDK ${SWIFT_SDKS})
252252
set(test_dependencies)
253253
get_test_dependencies("${SDK}" test_dependencies)
254254

255-
if(SWIFT_BUILD_STDLIB AND SWIFT_INCLUDE_TESTS AND NOT ${SDK} STREQUAL "WASI")
255+
if(SWIFT_BUILD_STDLIB AND SWIFT_INCLUDE_TESTS AND NOT SWIFTWASM_DISABLE_REFLECTION_TEST)
256256
# NOTE create a stub BlocksRuntime library that can be used for the
257257
# reflection tests
258258
file(WRITE ${test_bin_dir}/Inputs/BlocksRuntime.c
@@ -288,7 +288,7 @@ _Block_release(void) { }\n")
288288

289289
endif()
290290

291-
if(NOT "${SDK}" STREQUAL "WASI")
291+
if(NOT SWIFTWASM_DISABLE_REFLECTION_TEST)
292292
# wasm: Avoid to build swift-reflection-test because it uses unsupported linker flags for wasm-ld
293293
list(APPEND test_dependencies
294294
"swift-reflection-test${VARIANT_SUFFIX}_signed")

utils/build-presets.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,6 +2534,7 @@ extra-cmake-options=
25342534
-DSWIFT_BUILD_SYNTAXPARSERLIB=FALSE
25352535
-DCMAKE_AR="%(SOURCE_PATH)s/wasi-sdk/bin/llvm-ar"
25362536
-DCMAKE_RANLIB="%(SOURCE_PATH)s/wasi-sdk/bin/llvm-ranlib"
2537+
-DSWIFTWASM_DISABLE_REFLECTION_TEST=TRUE
25372538

25382539
[preset: webassembly-macos-target]
25392540

@@ -2549,3 +2550,4 @@ extra-cmake-options=
25492550
-DSWIFT_BUILD_SYNTAXPARSERLIB=FALSE
25502551
-DCMAKE_AR='/usr/local/opt/llvm/bin/llvm-ar'
25512552
-DCMAKE_RANLIB='/usr/local/opt/llvm/bin/llvm-ranlib'
2553+
-DSWIFTWASM_DISABLE_REFLECTION_TEST=TRUE

0 commit comments

Comments
 (0)