Skip to content

Commit 46ba350

Browse files
committed
Merge remote-tracking branch 'upstream/main' into windows-executable
2 parents c85e6ef + 363e3c5 commit 46ba350

21 files changed

+780
-136
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ xcuserdata/
66
.swiftpm
77
build
88
.vscode
9+
Package.resolved

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ else()
2121
endif()
2222
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
2323

24+
set(CMAKE_DISABLE_IN_SOURCE_BUILD YES)
25+
2426
option(BUILD_SHARED_LIBS "Build shared libraries by default" YES)
2527

2628
find_package(dispatch QUIET)
2729
find_package(Foundation QUIET)
2830
find_package(Threads QUIET)
2931
find_package(SQLite3 REQUIRED)
32+
find_package(SwiftSystem CONFIG REQUIRED)
3033

3134
add_subdirectory(Sources)
3235
add_subdirectory(cmake/modules)

Package.swift

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
/*
44
This source file is part of the Swift.org open source project
5-
5+
66
Copyright (c) 2019 - 2021 Apple Inc. and the Swift project authors
77
Licensed under Apache License v2.0 with Runtime Library Exception
8-
8+
99
See http://swift.org/LICENSE.txt for license information
1010
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
1111
*/
@@ -21,7 +21,7 @@ if let deploymentTarget = ProcessInfo.processInfo.environment["SWIFTTSC_MACOS_DE
2121
macOSPlatform = .macOS(.v10_10)
2222
}
2323

24-
let CMakeFiles = ["cmake_install.cmake", "CMakeLists.txt", "CMakeFiles"]
24+
let CMakeFiles = ["CMakeLists.txt"]
2525

2626
let package = Package(
2727
name: "swift-tools-support-core",
@@ -46,9 +46,9 @@ let package = Package(
4646
],
4747
dependencies: [],
4848
targets: [
49-
49+
5050
// MARK: Tools support core targets
51-
51+
5252
.target(
5353
/** Shim target to import missing C headers in Darwin and Glibc modulemap. */
5454
name: "TSCclibc",
@@ -62,24 +62,28 @@ let package = Package(
6262
.target(
6363
/** TSCBasic support library */
6464
name: "TSCBasic",
65-
dependencies: ["TSCLibc", "TSCclibc"],
65+
dependencies: [
66+
"TSCLibc",
67+
"TSCclibc",
68+
.product(name: "SystemPackage", package: "swift-system"),
69+
],
6670
exclude: CMakeFiles + ["README.md"]),
6771
.target(
6872
/** Abstractions for common operations, should migrate to TSCBasic */
6973
name: "TSCUtility",
7074
dependencies: ["TSCBasic", "TSCclibc"],
7175
exclude: CMakeFiles),
72-
76+
7377
// MARK: Additional Test Dependencies
74-
78+
7579
.target(
7680
/** Generic test support library */
7781
name: "TSCTestSupport",
7882
dependencies: ["TSCBasic", "TSCUtility"]),
79-
80-
83+
84+
8185
// MARK: Tools support core tests
82-
86+
8387
.testTarget(
8488
name: "TSCBasicTests",
8589
dependencies: ["TSCTestSupport", "TSCclibc"],
@@ -97,6 +101,19 @@ let package = Package(
97101
]
98102
)
99103

104+
/// When not using local dependencies, the branch to use for llbuild and TSC repositories.
105+
let relatedDependenciesBranch = "main"
106+
107+
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
108+
package.dependencies += [
109+
.package(url: "https://github.com/apple/swift-system.git", .upToNextMinor(from: "1.1.1")),
110+
]
111+
} else {
112+
package.dependencies += [
113+
.package(path: "../swift-system"),
114+
]
115+
}
116+
100117
// FIXME: conditionalise these flags since SwiftPM 5.3 and earlier will crash
101118
// for platforms they don't know about.
102119
#if os(Windows)

Sources/TSCBasic/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ add_library(TSCBasic
5050
Thread.swift
5151
Tuple.swift
5252
misc.swift)
53-
53+
5454
target_compile_options(TSCBasic PUBLIC
5555
# Don't use GNU strerror_r on Android.
5656
"$<$<PLATFORM_ID:Android>:SHELL:-Xcc -U_GNU_SOURCE>"
5757
# Ignore secure function warnings on Windows.
5858
"$<$<PLATFORM_ID:Windows>:SHELL:-Xcc -D_CRT_SECURE_NO_WARNINGS>")
5959
target_link_libraries(TSCBasic PUBLIC
60+
SwiftSystem::SystemPackage
6061
TSCLibc)
6162
target_link_libraries(TSCBasic PRIVATE
6263
TSCclibc)

0 commit comments

Comments
 (0)