-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cmake] add Synchronization library to Supplemental build #81310
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
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
cmake_minimum_required(VERSION 3.29) | ||
|
||
if($ENV{BUILD_NUMBER}) | ||
math(EXPR BUILD_NUMBER "$ENV{BUILD_NUMBER} % 65535") | ||
set(BUILD_NUMBER ".${BUILD_NUMBER}") | ||
endif() | ||
|
||
project(SwiftSynchronization | ||
LANGUAGES Swift | ||
VERSION 6.1.0${BUILD_NUMBER}) | ||
|
||
if(NOT PROJECT_IS_TOP_LEVEL) | ||
message(SEND_ERROR "Swift Synchronization must build as a standalone project") | ||
endif() | ||
|
||
set(CMAKE_POSITION_INDEPENDENT_CODE YES) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules") | ||
|
||
set(CMAKE_Swift_LANGUAGE_VERSION 5) | ||
|
||
include(GNUInstallDirs) | ||
|
||
set(${PROJECT_NAME}_SWIFTC_SOURCE_DIR | ||
"${PROJECT_SOURCE_DIR}/../../../" | ||
CACHE FILEPATH "Path to the root source directory of the Swift compiler") | ||
|
||
set(${PROJECT_NAME}_VENDOR_MODULE_DIR "${CMAKE_SOURCE_DIR}/../cmake/modules/vendor" | ||
CACHE FILEPATH "Location for private build system extension") | ||
|
||
find_package(SwiftCore QUIET REQUIRED) | ||
|
||
include(gyb) | ||
include(ResourceEmbedding) | ||
include(AvailabilityMacros) | ||
include(PlatformInfo) | ||
|
||
include("${${PROJECT_NAME}_VENDOR_MODULE_DIR}/Settings.cmake" OPTIONAL) | ||
|
||
option(${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION "Generate ABI resilient runtime libraries" | ||
${SwiftCore_ENABLE_LIBRARY_EVOLUTION}) | ||
|
||
option(${PROJECT_NAME}_ENABLE_PRESPECIALIZATION "Enable generic metadata prespecialization" | ||
${SwiftCore_ENABLE_PRESPECIALIZATION}) | ||
|
||
include(CatalystSupport) | ||
include(EmitSwiftInterface) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We likely need to import
|
||
include(InstallSwiftInterface) | ||
|
||
add_compile_options( | ||
"$<$<COMPILE_LANGUAGE:Swift>:-nostdlibimport>" | ||
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>" | ||
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>" | ||
$<$<COMPILE_LANGUAGE:Swift>:-explicit-module-build> | ||
$<$<COMPILE_LANGUAGE:Swift>:-enable-builtin-module> | ||
$<$<COMPILE_LANGUAGE:Swift>:-strict-memory-safety> | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature RawLayout>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature StaticExclusiveOnly>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature Extern>") | ||
|
||
gyb_expand(Atomics/AtomicIntegers.swift.gyb Atomics/AtomicIntegers.swift) | ||
gyb_expand(Atomics/AtomicStorage.swift.gyb Atomics/AtomicStorage.swift) | ||
|
||
add_library(swiftSynchronization | ||
Atomics/Atomic.swift | ||
Atomics/AtomicBool.swift | ||
Atomics/AtomicFloats.swift | ||
Atomics/AtomicLazyReference.swift | ||
Atomics/AtomicMemoryOrderings.swift | ||
Atomics/AtomicOptional.swift | ||
Atomics/AtomicPointers.swift | ||
Atomics/AtomicRepresentable.swift | ||
Atomics/WordPair.swift | ||
Atomics/AtomicStorage.swift | ||
Atomics/AtomicIntegers.swift | ||
Cell.swift | ||
Mutex/Mutex.swift | ||
$<$<PLATFORM_ID:Darwin>:Mutex/DarwinImpl.swift> | ||
$<$<PLATFORM_ID:Linux>:Mutex/LinuxImpl.swift> | ||
$<$<PLATFORM_ID:WASI>:Mutex/SpinLoopHint.swift> | ||
$<$<PLATFORM_ID:WINDOWS>:Mutex/WindowsImpl.swift>) | ||
compnerd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
set_target_properties(swiftSynchronization PROPERTIES | ||
Swift_MODULE_NAME Synchronization) | ||
|
||
target_link_libraries(swiftSynchronization | ||
PRIVATE | ||
swiftCore | ||
$<$<PLATFORM_ID:Darwin>:swiftDarwin>) | ||
|
||
set(${PROJECT_NAME}_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>$<$<BOOL:${Supplemental_INSTALL_NESTED_SUBDIR}>:/${Supplemental_PLATFORM_SUBDIR}/${Supplemental_ARCH_SUBDIR}>" CACHE STRING "") | ||
set(${PROJECT_NAME}_INSTALL_SWIFTMODULEDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>$<$<BOOL:${Supplemental_INSTALL_NESTED_SUBDIR}>:/${Supplemental_PLATFORM_SUBDIR}>" CACHE STRING "") | ||
|
||
install(TARGETS swiftSynchronization | ||
EXPORT SwiftSynchronizationTargets | ||
COMPONENT ${PROJECT_NAME}_runtime | ||
ARCHIVE DESTINATION "${${PROJECT_NAME}_INSTALL_LIBDIR}" | ||
LIBRARY DESTINATION "${${PROJECT_NAME}_INSTALL_LIBDIR}" | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") | ||
emit_swift_interface(swiftSynchronization) | ||
install_swift_interface(swiftSynchronization) | ||
|
||
# Configure plist creation for Darwin platforms. | ||
generate_plist("${CMAKE_PROJECT_NAME}" "${CMAKE_PROJECT_VERSION}" swiftSynchronization) | ||
embed_manifest(swiftSynchronization) | ||
|
||
include("${${PROJECT_NAME}_VENDOR_MODULE_DIR}/swiftSynchronization.cmake" OPTIONAL) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should likely hoist this to right after the
project
call