Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] Compile BlocksRuntimeStub with stdlib compiler settings #34859

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions stdlib/private/BlocksRuntimeStubs/BlocksRuntime.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void
#if defined(_WIN32)
__declspec(dllexport)
#endif
_Block_release(void) { }

31 changes: 31 additions & 0 deletions stdlib/private/BlocksRuntimeStubs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/cmake/modules")

include(SwiftTestUtils)

foreach(SDK ${SWIFT_SDKS})
foreach(ARCH ${SWIFT_SDK_${SDK}_ARCHITECTURES})
get_swift_test_build_flavors(build_flavors "${SDK}")

foreach(BUILD_FLAVOR build_flavors)
get_swift_test_variant_suffix(VARIANT_SUFFIX "${SDK}" "${ARCH}" "${BUILD_FLAVOR}")

set(test_bin_dir "${CMAKE_BINARY_DIR}/test${VARIANT_SUFFIX}")

_add_swift_target_library_single(
BlocksRuntimeStub${VARIANT_SUFFIX}
BlocksRuntimeStub
SHARED
ARCHITECTURE ${ARCH}
SDK ${SDK}
INSTALL_IN_COMPONENT dev
BlocksRuntime.c
)
set_target_properties(BlocksRuntimeStub${VARIANT_SUFFIX} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${test_bin_dir}
LIBRARY_OUTPUT_DIRECTORY ${test_bin_dir}
RUNTIME_OUTPUT_DIRECTORY ${test_bin_dir}
OUTPUT_NAME BlocksRuntime)
endforeach()
endforeach()
endforeach()

13 changes: 11 additions & 2 deletions stdlib/private/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@ if(SWIFT_BUILD_SDK_OVERLAY)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_subdirectory(StdlibUnittestFoundationExtras)
endif()
# Currently SwiftReflectionTest cannot be built on Windows, due to
# dependencies on POSIX symbols
# Currently SwiftReflectionTest cannot be built on Windows, due to
# dependencies on POSIX symbols
if (SWIFT_INCLUDE_TESTS AND (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows"))
add_subdirectory(SwiftReflectionTest)
endif()
endif()

# Keep in sync with stdlib/tools/CMakeLists.txt: swift-reflection-test is
# only used when testing dynamic stdlib.
if(SWIFT_BUILD_DYNAMIC_STDLIB AND SWIFT_INCLUDE_TESTS)
# NOTE create a stub BlocksRuntime library that can be used for the
# reflection tests
add_subdirectory(BlocksRuntimeStubs)
endif()

Loading