Skip to content

[stdlib] Only add Apple reflection test targets #5175

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

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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,12 @@ include_directories(BEFORE
# endif()
set(SWIFT_DARWIN_VARIANTS "^(macosx|iphoneos|iphonesimulator|appletvos|appletvsimulator|watchos|watchsimulator)")

# A convenient list to match Darwin SDKs. Example:
# if("${SWIFT_HOST_VARIANT_SDK}" IN_LIST SWIFT_APPLE_PLATFORMS)
# ...
# endif()
set(SWIFT_APPLE_PLATFORMS "IOS" "IOS_SIMULATOR" "TVOS" "TVOS_SIMULATOR" "WATCHOS" "WATCHOS_SIMULATOR" "OSX")

# Configuration flags passed to all of our invocations of gyb. Try to
# avoid making up new variable names here if you can find a CMake
# variable that will do the job.
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ function(add_swift_library name)
set(SWIFTLIB_TARGET_SDKS ${SWIFT_SDKS})
endif()
list_replace(SWIFTLIB_TARGET_SDKS ALL_POSIX_PLATFORMS "ALL_APPLE_PLATFORMS;ANDROID;CYGWIN;FREEBSD;LINUX")
list_replace(SWIFTLIB_TARGET_SDKS ALL_APPLE_PLATFORMS "IOS;IOS_SIMULATOR;TVOS;TVOS_SIMULATOR;WATCHOS;WATCHOS_SIMULATOR;OSX")
list_replace(SWIFTLIB_TARGET_SDKS ALL_APPLE_PLATFORMS "${SWIFT_APPLE_PLATFORMS}")

# All Swift code depends on the standard library, except for the standard
# library itself.
Expand Down
15 changes: 9 additions & 6 deletions stdlib/private/SwiftReflectionTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ if (SWIFT_INCLUDE_TESTS)
add_swift_library(swiftSwiftReflectionTest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
SwiftReflectionTest.swift
SWIFT_MODULE_DEPENDS Darwin
TARGET_SDKS ALL_APPLE_PLATFORMS
INSTALL_IN_COMPONENT stdlib-experimental)

foreach(SDK ${SWIFT_SDKS})
foreach(ARCH ${SWIFT_SDK_${SDK}_ARCHITECTURES})
set(VARIANT_SUFFIX "-${SWIFT_SDK_${SDK}_LIB_SUBDIR}-${ARCH}")
add_dependencies(
"swiftSwiftReflectionTest${VARIANT_SUFFIX}"
"swift-reflection-test${VARIANT_SUFFIX}")
endforeach()
if("${SDK}" IN_LIST SWIFT_APPLE_PLATFORMS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does SWIFT_APPLE_PLATFORMS come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, looks like I lost a line of source code when I split up #4972. I amended the commit with the missing CMake changes that add SWIFT_APPLE_PLATFORMS. 😨

foreach(ARCH ${SWIFT_SDK_${SDK}_ARCHITECTURES})
set(VARIANT_SUFFIX "-${SWIFT_SDK_${SDK}_LIB_SUBDIR}-${ARCH}")
add_dependencies(
"swiftSwiftReflectionTest${VARIANT_SUFFIX}"
"swift-reflection-test${VARIANT_SUFFIX}")
endforeach()
endif()
endforeach()
endif()