Skip to content
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
19 changes: 6 additions & 13 deletions Runtimes/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,16 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
set(CMAKE_POSITION_INDEPENDENT_CODE YES)

set(SwiftCore_CMAKE_MODULES_DIR "${CMAKE_SOURCE_DIR}/cmake/modules")
list(APPEND CMAKE_MODULE_PATH ${SwiftCore_CMAKE_MODULES_DIR})
list(APPEND CMAKE_MODULE_PATH
${SwiftCore_CMAKE_MODULES_DIR}
"${CMAKE_SOURCE_DIR}/../cmake/modules")

include(CMakeWorkarounds)
# NOTE: always use the 3-component style as the expansion as
# `${PROJECT_VERSION}` will not extend this to the complete form and this can
# change the behaviour for comparison with non-SemVer compliant parsing. If
# possible, use the 4-version component as that is used to differentiate the
# builds of the runtime for Windows.
if($ENV{BUILD_NUMBER})
# NOTE: SxS modules have a limit on each component being [0-65535].
# https://learn.microsoft.com/en-us/windows/win32/sbscs/assembly-versions
math(EXPR BUILD_NUMBER "$ENV{BUILD_NUMBER} % 65535")
set(BUILD_NUMBER ".${BUILD_NUMBER}")
endif()

include(SwiftProjectVersion)
project(SwiftCore
LANGUAGES C CXX Swift
VERSION 6.3.0${BUILD_NUMBER})
VERSION ${SWIFT_RUNTIME_VERSION})

# The Swift standard library is not intended for use as a sub-library as part of
# another project. It is tightly coupled with the compiler version.
Expand Down
18 changes: 5 additions & 13 deletions Runtimes/Overlay/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,18 @@ set(CMAKE_C_VISIBILITY_PRESET "hidden")
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake/modules"
"${CMAKE_SOURCE_DIR}/../cmake/modules")

if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
cmake_policy(SET CMP0157 OLD)
endif()

# NOTE: always use the 3-component style as the expansion as
# `${PROJECT_VERSION}` will not extend this to the complete form and this can
# change the behaviour for comparison with non-SemVer compliant parsing. If
# possible, use the 4-version component as that is used to differentiate the
# builds of the runtime for Windows.
if($ENV{BUILD_NUMBER})
# NOTE: SxS modules have a limit on each component being [0-65535].
# https://learn.microsoft.com/en-us/windows/win32/sbscs/assembly-versions
math(EXPR BUILD_NUMBER "$ENV{BUILD_NUMBER} % 65535")
set(BUILD_NUMBER ".${BUILD_NUMBER}")
endif()
include(SwiftProjectVersion)
project(SwiftOverlay
LANGUAGES C CXX Swift
VERSION 6.3.0${BUILD_NUMBER})
VERSION ${SWIFT_RUNTIME_VERSION})

set(CMAKE_Swift_LANGUAGE_VERSION 5)

Expand Down
13 changes: 6 additions & 7 deletions Runtimes/Supplemental/Differentiation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
cmake_policy(SET CMP0157 OLD)
endif()

if($ENV{BUILD_NUMBER})
math(EXPR BUILD_NUMBER "$ENV{BUILD_NUMBER} % 65535")
set(BUILD_NUMBER ".${BUILD_NUMBER}")
endif()
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/../cmake/modules"
"${CMAKE_SOURCE_DIR}/../../cmake/modules")

include(SwiftProjectVersion)
project(SwiftDifferentiation
LANGUAGES Swift C
VERSION 6.3.0${BUILD_NUMBER})
VERSION ${SWIFT_RUNTIME_VERSION})

if(NOT PROJECT_IS_TOP_LEVEL)
message(SEND_ERROR "Swift Differentiation must build as a standalone project")
Expand All @@ -24,8 +25,6 @@ endif()
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
set(CMAKE_Swift_LANGUAGE_VERSION 5)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules")

set(${PROJECT_NAME}_SWIFTC_SOURCE_DIR
"${PROJECT_SOURCE_DIR}/../../../"
CACHE FILEPATH "Path to the root source directory of the Swift compiler")
Expand Down
13 changes: 6 additions & 7 deletions Runtimes/Supplemental/Distributed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
cmake_policy(SET CMP0157 OLD)
endif()

if($ENV{BUILD_NUMBER})
math(EXPR BUILD_NUMBER "$ENV{BUILD_NUMBER} % 65535")
set(BUILD_NUMBER ".${BUILD_NUMBER}")
endif()
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/../cmake/modules"
"${CMAKE_SOURCE_DIR}/../../cmake/modules")

include(SwiftProjectVersion)
project(SwiftDistributed
LANGUAGES C CXX Swift
VERSION 6.3.0${BUILD_NUMBER})
VERSION ${SWIFT_RUNTIME_VERSION})

if(NOT PROJECT_IS_TOP_LEVEL)
message(SEND_ERROR "Swift Distributed must build as a standalone project")
Expand All @@ -34,8 +35,6 @@ set(CMAKE_CXX_VISIBILITY_PRESET "hidden")

set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules")

set(${PROJECT_NAME}_SWIFTC_SOURCE_DIR
"${PROJECT_SOURCE_DIR}/../../../"
CACHE FILEPATH "Path to the root source directory of the Swift compiler")
Expand Down
13 changes: 6 additions & 7 deletions Runtimes/Supplemental/Observation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
cmake_policy(SET CMP0157 OLD)
endif()

if($ENV{BUILD_NUMBER})
math(EXPR BUILD_NUMBER "$ENV{BUILD_NUMBER} % 65535")
set(BUILD_NUMBER ".${BUILD_NUMBER}")
endif()
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/../cmake/modules"
"${CMAKE_SOURCE_DIR}/../../cmake/modules")

include(SwiftProjectVersion)
project(SwiftObservation
LANGUAGES Swift CXX
VERSION 6.3.0${BUILD_NUMBER})
VERSION ${SWIFT_RUNTIME_VERSION})

if(NOT PROJECT_IS_TOP_LEVEL)
message(SEND_ERROR "Swift Observation must build as a standalone project")
Expand All @@ -26,8 +27,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
set(CMAKE_POSITION_INDEPENDENT_CODE YES)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules")

set(${PROJECT_NAME}_SWIFTC_SOURCE_DIR
"${PROJECT_SOURCE_DIR}/../../../"
CACHE FILEPATH "Path to the root source directory of the Swift compiler")
Expand Down
14 changes: 7 additions & 7 deletions Runtimes/Supplemental/StringProcessing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
cmake_policy(SET CMP0157 OLD)
endif()

if($ENV{BUILD_NUMBER})
math(EXPR BUILD_NUMBER "$ENV{BUILD_NUMBER} % 65535")
set(BUILD_NUMBER ".${BUILD_NUMBER}")
endif()

list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/../cmake/modules"
"${CMAKE_SOURCE_DIR}/../../cmake/modules")

include(SwiftProjectVersion)
project(SwiftStringProcessing
LANGUAGES Swift C
VERSION 6.3.0${BUILD_NUMBER})
VERSION ${SWIFT_RUNTIME_VERSION})

if(NOT PROJECT_IS_TOP_LEVEL)
message(FATAL_ERROR "Swift StringProcessing must build as a standalone project")
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE YES)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules")

set(${PROJECT_NAME}_SWIFTC_SOURCE_DIR
"${PROJECT_SOURCE_DIR}/../../../"
CACHE FILEPATH "Path to the root source directory of the Swift compiler")
Expand Down
14 changes: 7 additions & 7 deletions Runtimes/Supplemental/Synchronization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
cmake_policy(SET CMP0157 OLD)
endif()

if($ENV{BUILD_NUMBER})
math(EXPR BUILD_NUMBER "$ENV{BUILD_NUMBER} % 65535")
set(BUILD_NUMBER ".${BUILD_NUMBER}")
endif()
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/../cmake/modules"
"${CMAKE_SOURCE_DIR}/../../cmake/modules")

include(SwiftProjectVersion)
project(SwiftSynchronization
LANGUAGES Swift
VERSION 6.3.0${BUILD_NUMBER})
VERSION ${SWIFT_RUNTIME_VERSION})

# FIXME(compnerd) this is a workaround for `GNUInstallDirs` which cannot be used
# with a pure Swift project.
enable_language(C)
Expand All @@ -26,8 +28,6 @@ endif()

set(CMAKE_POSITION_INDEPENDENT_CODE YES)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules")

set(${PROJECT_NAME}_SWIFTC_SOURCE_DIR
"${PROJECT_SOURCE_DIR}/../../../"
CACHE FILEPATH "Path to the root source directory of the Swift compiler")
Expand Down
14 changes: 7 additions & 7 deletions Runtimes/Supplemental/Volatile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ if(POLICY CMP0157 AND CMAKE_Swift_COMPILER_USE_OLD_DRIVER)
cmake_policy(SET CMP0157 OLD)
endif()

if($ENV{BUILD_NUMBER})
math(EXPR BUILD_NUMBER "$ENV{BUILD_NUMBER} % 65535")
set(BUILD_NUMBER ".${BUILD_NUMBER}")
endif()
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/../cmake/modules"
"${CMAKE_SOURCE_DIR}/../../cmake/modules")

include(SwiftProjectVersion)
project(SwiftVolatile
LANGUAGES Swift
VERSION 6.3.0${BUILD_NUMBER})
VERSION ${SWIFT_RUNTIME_VERSION})

# FIXME(compnerd) this is a workaround for `GNUInstallDirs` which cannot be used
# with a pure Swift project.
enable_language(C)
Expand All @@ -24,8 +26,6 @@ if(NOT PROJECT_IS_TOP_LEVEL)
message(SEND_ERROR "Swift Observation must build as a standalone project")
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/modules")

set(${PROJECT_NAME}_SWIFTC_SOURCE_DIR
"${PROJECT_SOURCE_DIR}/../../../"
CACHE FILEPATH "Path to the root source directory of the Swift compiler")
Expand Down
23 changes: 23 additions & 0 deletions Runtimes/cmake/modules/SwiftProjectVersion.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This module sets the Swift version number variable consistently across the
# Swift runtime projects.

## Result Variable
#
# ``SWIFT_RUNTIME_VERSION``
# The computed version number applied to apply to the project.
# If ``SWIFT_RUNTIME_VERSION`` is set prior to entering the module, the version
# is not modified.

block(PROPAGATE SWIFT_RUNTIME_VERSION)
if(SWIFT_RUNTIME_VERSION)
return()
endif()

if($ENV{BUILD_NUMBER})
# Microsoft build numbers limit each version number component to [0 - 65535]
# https://learn.microsoft.com/en-us/windows/win32/sbscs/assembly-versions
math(EXPR BUILD_NUMBER "$ENV{BUILD_NUMBER} % 65535")
set(BUILD_NUMBER ".${BUILD_NUMBER}")
endif()
set(SWIFT_RUNTIME_VERSION 6.3.0${BUILD_NUMBER})
endblock()