mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stubs] Update CMake to use TARGET_SDKS (NFC)
The `add_swift_library` CMake function takes an optional `TARGET_SDKS` parameter. When used, only CMake targets for the specified SDKs are added. Refactor `stdlib/public/stubs` to use this parameter. This also eliminates logic that determines additional flags or source files to include based on `SWIFT_HOST_VARIANT`, which makes it easier for hosts to add targets for different platforms.
This commit is contained in:
@@ -1,32 +1,40 @@
|
|||||||
set(swift_stubs_objc_sources)
|
set(swift_stubs_sources
|
||||||
set(swift_stubs_unicode_normalization_sources)
|
Assert.cpp
|
||||||
|
CommandLine.cpp
|
||||||
if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")
|
GlobalObjects.cpp
|
||||||
set(swift_stubs_objc_sources
|
LibcShims.cpp
|
||||||
|
Stubs.cpp
|
||||||
|
UnicodeExtendedGraphemeClusters.cpp.gyb)
|
||||||
|
set(swift_stubs_objc_sources
|
||||||
Availability.mm
|
Availability.mm
|
||||||
DispatchShims.mm
|
DispatchShims.mm
|
||||||
FoundationHelpers.mm
|
FoundationHelpers.mm
|
||||||
OptionalBridgingHelper.mm
|
OptionalBridgingHelper.mm
|
||||||
Reflection.mm
|
Reflection.mm
|
||||||
SwiftNativeNSXXXBase.mm.gyb)
|
SwiftNativeNSXXXBase.mm.gyb)
|
||||||
set(LLVM_OPTIONAL_SOURCES
|
set(swift_stubs_unicode_normalization_sources
|
||||||
UnicodeNormalization.cpp)
|
UnicodeNormalization.cpp)
|
||||||
else()
|
set(LLVM_OPTIONAL_SOURCES
|
||||||
find_package(ICU REQUIRED COMPONENTS uc i18n)
|
${swift_stubs_objc_sources}
|
||||||
set(swift_stubs_unicode_normalization_sources
|
${swift_stubs_unicode_normalization_sources})
|
||||||
UnicodeNormalization.cpp)
|
|
||||||
endif()
|
set(swift_stubs_c_compile_flags ${SWIFT_RUNTIME_CORE_CXX_FLAGS})
|
||||||
|
list(APPEND swift_stubs_c_compile_flags -DswiftCore_EXPORTS)
|
||||||
|
|
||||||
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
|
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
|
||||||
Assert.cpp
|
${swift_stubs_sources}
|
||||||
CommandLine.cpp
|
|
||||||
GlobalObjects.cpp
|
|
||||||
LibcShims.cpp
|
|
||||||
Stubs.cpp
|
|
||||||
UnicodeExtendedGraphemeClusters.cpp.gyb
|
|
||||||
${swift_stubs_objc_sources}
|
${swift_stubs_objc_sources}
|
||||||
${swift_stubs_unicode_normalization_sources}
|
C_COMPILE_FLAGS ${swift_stubs_c_compile_flags}
|
||||||
C_COMPILE_FLAGS ${SWIFT_RUNTIME_CORE_CXX_FLAGS} -DswiftCore_EXPORTS
|
|
||||||
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
|
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
|
||||||
|
TARGET_SDKS ALL_APPLE_PLATFORMS
|
||||||
|
INSTALL_IN_COMPONENT stdlib)
|
||||||
|
|
||||||
|
add_swift_library(swiftStdlibStubs OBJECT_LIBRARY TARGET_LIBRARY
|
||||||
|
${swift_stubs_sources}
|
||||||
|
${swift_stubs_unicode_normalization_sources}
|
||||||
|
C_COMPILE_FLAGS ${swift_stubs_c_compile_flags}
|
||||||
|
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
|
||||||
|
LINK_LIBRARIES ${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
|
||||||
|
TARGET_SDKS ANDROID CYGWIN FREEBSD LINUX
|
||||||
INSTALL_IN_COMPONENT stdlib)
|
INSTALL_IN_COMPONENT stdlib)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user