Compare commits

..
13 Commits
Author SHA1 Message Date
tomer doron 5703dc2b4d update cmake setup so that the library can be used by SwiftPM cmake build (#73)
Update cmake setup so that the library can be used by SwiftPM cmake build

Motivation: integrate with SwiftPM

changes:
* rename the top level project to SwiftSystem instead of swift-system to align with other projects
* rename System to SystemPackage to align with SwifPM setup
* update architectures to include arm64
* Update cmake/modules/SwiftSystemConfig.cmake.in
* Update cmake/modules/SwiftSupport.cmake
2021-11-30 10:50:50 -07:00
Alex Martini 2fa26782e1 Merge pull request #69 from amartini51/docs/develop
Minor fixes in documentation comments
2021-11-09 10:11:05 -08:00
Alex Martini 0c291a65c2 Fix typo.
Fixes <rdar://problem/84559893>.
2021-11-08 19:43:49 -08:00
Alex Martini 0ac080ea56 Add missing period at end of abstract. 2021-11-08 19:43:30 -08:00
Alex Martini d2c4e4507a Fix spacing and indentation. 2021-11-08 19:43:30 -08:00
Alex Martini 78847afcd4 Remove stray word. 2021-11-08 19:43:30 -08:00
George Lyon 689390f50f Implement FileDescriptor.Pipe() (#58)
Adds support for pipe(2)
2021-09-27 16:02:52 -06:00
Michael Ilseman ce8b491073 Update README for 1.0 2021-09-01 09:26:18 -06:00
YR Chen 39774ef16a Simplify Package.swift 2021-08-05 10:05:06 -06:00
YR Chen 58a2725013 Fix building on Windows 2021-08-05 10:05:06 -06:00
Rauhul Varma e520e61616 Fix SystemChar isLetter logic
- Fixes range expression in isLetter logic and adds test coverage.
2021-08-05 10:03:53 -06:00
Rauhul Varma 4f36710d0b Expose O_DIRECTORY as api
- Adds a `directory` OpenOptions as a type-safe version of O_DIRECTORY.
  Allows clients to only open a FileDescriptor for FilePaths that refer
  to directories.
2021-07-14 18:24:52 -06:00
Alex Martini 591ff41944 Move TODO and FIXME markers to normal comments.
When they appear in triple-slash comments, that makes them part of the
actual documentation that gets published.

Fixes <rdar://problem/79071171>.
2021-06-10 16:34:32 -06:00
19 changed files with 229 additions and 93 deletions

No files matched your search

+2 -7
View File
@@ -8,7 +8,7 @@ See https://swift.org/LICENSE.txt for license information
#]]
cmake_minimum_required(VERSION 3.16.0)
project(swift-system
project(SwiftSystem
LANGUAGES C Swift)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
@@ -21,9 +21,4 @@ set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
include(SwiftSupport)
add_subdirectory(Sources)
get_property(SWIFT_SYSTEM_EXPORTS GLOBAL PROPERTY SWIFT_SYSTEM_EXPORTS)
export(TARGETS ${SWIFT_SYSTEM_EXPORTS}
NAMESPACE SwiftSystem::
FILE swift-system-config.cmake
EXPORT_LINK_INTERFACE_LIBRARIES)
add_subdirectory(cmake/modules)
+22 -21
View File
@@ -12,31 +12,32 @@
import PackageDescription
let targets: [PackageDescription.Target] = [
.target(
name: "SystemPackage",
dependencies: ["CSystem"],
path: "Sources/System",
swiftSettings: [
.define("SYSTEM_PACKAGE"),
.define("ENABLE_MOCKING", .when(configuration: .debug))
]),
.target(
name: "CSystem",
dependencies: []),
.testTarget(
name: "SystemTests",
dependencies: ["SystemPackage"],
swiftSettings: [
.define("SYSTEM_PACKAGE")
]),
]
let package = Package(
name: "swift-system",
products: [
.library(name: "SystemPackage", targets: ["SystemPackage"]),
],
dependencies: [],
targets: targets
targets: [
.target(
name: "CSystem",
dependencies: []),
.target(
name: "SystemPackage",
dependencies: ["CSystem"],
path: "Sources/System",
cSettings: [
.define("_CRT_SECURE_NO_WARNINGS")
],
swiftSettings: [
.define("SYSTEM_PACKAGE"),
.define("ENABLE_MOCKING", .when(configuration: .debug))
]),
.testTarget(
name: "SystemTests",
dependencies: ["SystemPackage"],
swiftSettings: [
.define("SYSTEM_PACKAGE")
]),
]
)
+8 -11
View File
@@ -28,16 +28,7 @@ To use the `SystemPackage` library in a SwiftPM project,
add the following line to the dependencies in your `Package.swift` file:
```swift
.package(url: "https://github.com/apple/swift-system", from: "0.0.1"),
```
Because `SystemPackage` is under active development,
source-stability is only guaranteed within minor versions (e.g. between `0.0.3` and `0.0.4`).
If you don't want potentially source-breaking package updates,
use this dependency specification instead:
```swift
.package(url: "https://github.com/apple/swift-system", .upToNextMinor(from: "0.0.1")),
.package(url: "https://github.com/apple/swift-system", from: "1.0.0"),
```
Finally, include `"SystemPackage"` as a dependency for your executable target:
@@ -46,7 +37,7 @@ Finally, include `"SystemPackage"` as a dependency for your executable target:
let package = Package(
// name, platforms, products, etc.
dependencies: [
.package(url: "https://github.com/apple/swift-system", from: "0.0.1"),
.package(url: "https://github.com/apple/swift-system", from: "1.0.0"),
// other dependencies
],
targets: [
@@ -58,6 +49,12 @@ let package = Package(
)
```
## Source Stability
The Swift System package is source stable. The version numbers follow [Semantic Versioning][semver] -- source breaking changes to public API can only land in a new major version.
[semver]: https://semver.org
## Contributing
Before contributing, please read [CONTRIBUTING.md](CONTRIBUTING.md).
+8 -6
View File
@@ -7,7 +7,7 @@ Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
#]]
add_library(System
add_library(SystemPackage
Errno.swift
FileDescriptor.swift
FileHelpers.swift
@@ -17,7 +17,9 @@ add_library(System
SystemString.swift
Util.swift
UtilConsumers.swift)
target_sources(System PRIVATE
set_target_properties(SystemPackage PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
target_sources(SystemPackage PRIVATE
FilePath/FilePath.swift
FilePath/FilePathComponents.swift
FilePath/FilePathComponentView.swift
@@ -25,16 +27,16 @@ target_sources(System PRIVATE
FilePath/FilePathString.swift
FilePath/FilePathSyntax.swift
FilePath/FilePathWindows.swift)
target_sources(System PRIVATE
target_sources(SystemPackage PRIVATE
Internals/CInterop.swift
Internals/Constants.swift
Internals/Exports.swift
Internals/Mocking.swift
Internals/Syscalls.swift
Internals/WindowsSyscallAdapters.swift)
target_link_libraries(System PRIVATE
target_link_libraries(SystemPackage PRIVATE
CSystem)
_install_target(System)
set_property(GLOBAL APPEND PROPERTY SWIFT_SYSTEM_EXPORTS System)
_install_target(SystemPackage)
set_property(GLOBAL APPEND PROPERTY SWIFT_SYSTEM_EXPORTS SystemPackage)
+14
View File
@@ -234,6 +234,20 @@ extension FileDescriptor {
@_alwaysEmitIntoClient
@available(*, unavailable, renamed: "noFollow")
public static var O_NOFOLLOW: OpenOptions { noFollow }
/// Indicates that opening the file only succeeds if the file is a directory.
///
/// If you specify this option and the file path you pass to
/// <doc:System/FileDescriptor/open(_:_:options:permissions:)-10dcs>
/// is a not a directory, then that open operation fails.
///
/// The corresponding C constant is `O_DIRECTORY`.
@_alwaysEmitIntoClient
public static var directory: OpenOptions { OpenOptions(_O_DIRECTORY) }
@_alwaysEmitIntoClient
@available(*, unavailable, renamed: "directory")
public static var O_DIRECTORY: OpenOptions { directory }
#endif
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
+23
View File
@@ -370,4 +370,27 @@ extension FileDescriptor {
public func dup2() throws -> FileDescriptor {
fatalError("Not implemented")
}
#if !os(Windows)
/// Create a pipe, a unidirectional data channel which can be used for interprocess communication.
///
/// - Returns: The pair of file descriptors.
///
/// The corresponding C function is `pipe`.
@_alwaysEmitIntoClient
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
public static func pipe() throws -> (readEnd: FileDescriptor, writeEnd: FileDescriptor) {
try _pipe().get()
}
@usableFromInline
internal static func _pipe() -> Result<(readEnd: FileDescriptor, writeEnd: FileDescriptor), Errno> {
var fds: (Int32, Int32) = (-1, -1)
return withUnsafeMutablePointer(to: &fds) { pointer in
valueOrErrno(retryOnInterrupt: false) {
system_pipe(UnsafeMutableRawPointer(pointer).assumingMemoryBound(to: Int32.self))
}
}.map { _ in (.init(rawValue: fds.0), .init(rawValue: fds.1)) }
}
#endif
}
+5 -5
View File
@@ -16,7 +16,7 @@
/// encoding.
///
/// On construction, `FilePath` will normalize separators by removing
/// reduncant intermediary separators and stripping any trailing separators.
/// redundant intermediary separators and stripping any trailing separators.
/// On Windows, `FilePath` will also normalize forward slashes `/` into
/// backslashes `\`, as preferred by the platform.
///
@@ -28,11 +28,8 @@
/// let fd = try FileDescriptor.open(path, .writeOnly, options: .append)
/// try fd.closeAfter { try fd.writeAll(message.utf8) }
///
/// TODO(docs): Section on all the new syntactic operations, lexical normalization, decomposition,
/// components, etc.
///
/// File paths conform to the
/// and <doc://com.apple.documentation/documentation/swift/equatable>
/// <doc://com.apple.documentation/documentation/swift/equatable>
/// and <doc://com.apple.documentation/documentation/swift/hashable> protocols
/// by performing the protocols' operations on their raw byte contents.
/// This conformance allows file paths to be used,
@@ -40,6 +37,9 @@
/// However, the rules for path equivalence
/// are file-system–specific and have additional considerations
/// like case insensitivity, Unicode normalization, and symbolic links.
///
// TODO(docs): Section on all the new syntactic operations, lexical normalization, decomposition,
// components, etc.
// @available(macOS 10.16, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
public struct FilePath {
internal var _storage: SystemString
+22 -32
View File
@@ -64,9 +64,8 @@ extension FilePath {
/// path.starts(with: "/usr/bin/ls///") // true
/// path.starts(with: "/us") // false
///
/// TODO(Windows docs): examples with roots, such as whether `\foo\bar`
/// starts with `C:\foo`
///
// TODO(Windows docs): examples with roots, such as whether `\foo\bar`
// starts with `C:\foo`
public func starts(with other: FilePath) -> Bool {
guard !other.isEmpty else { return true }
return self.root == other.root && components.starts(
@@ -85,9 +84,8 @@ extension FilePath {
/// path.ends(with: "/usr/bin/ls///") // true
/// path.ends(with: "/ls") // false
///
/// TODO(Windows docs): examples with roots, such as whether `C:\foo\bar`
/// ends with `C:bar`
///
// TODO(Windows docs): examples with roots, such as whether `C:\foo\bar`
// ends with `C:bar`
public func ends(with other: FilePath) -> Bool {
if other.root != nil {
// TODO: anything tricky here for Windows?
@@ -444,7 +442,7 @@ extension FilePath {
// @available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
extension FilePath {
/// If `prefix` is a prefix of `self`, removes it and returns `true`.
/// Otherwise returns `false`.
/// Otherwise returns `false`.
///
/// Example:
///
@@ -453,8 +451,7 @@ extension FilePath {
/// path.removePrefix("/us") // false
/// path.removePrefix("/usr/local") // true, path is "bin"
///
/// TODO(Windows docs): example with roots
///
// TODO(Windows docs): example with roots
public mutating func removePrefix(_ prefix: FilePath) -> Bool {
defer { _invariantCheck() }
// FIXME: Should Windows have more nuanced semantics?
@@ -476,8 +473,7 @@ extension FilePath {
/// }
/// // path is "/tmp/foo/bar/../baz"
///
/// TODO(Windows docs): example with roots
///
// TODO(Windows docs): example with roots
public mutating func append(_ component: __owned FilePath.Component) {
defer { _invariantCheck() }
_append(unchecked: component._slice)
@@ -492,8 +488,7 @@ extension FilePath {
/// let otherPath: FilePath = "/bin/ls"
/// path.append(otherPath.components) // path is "/usr/local/bin/ls"
///
/// TODO(Windows docs): example with roots
///
// TODO(Windows docs): example with roots
public mutating func append<C: Collection>(
_ components: __owned C
) where C.Element == FilePath.Component {
@@ -508,14 +503,14 @@ extension FilePath {
/// A leading separator is spurious if `self` is non-empty.
///
/// Example:
/// var path: FilePath = ""
/// path.append("/var/www/website") // "/var/www/website"
/// path.append("static/assets") // "/var/www/website/static/assets"
/// path.append("/main.css") // "/var/www/website/static/assets/main.css"
///
/// TODO(Windows docs): example with roots, should we rephrase this "spurious
/// roots"?
/// var path: FilePath = ""
/// path.append("/var/www/website") // "/var/www/website"
/// path.append("static/assets") // "/var/www/website/static/assets"
/// path.append("/main.css") // "/var/www/website/static/assets/main.css"
///
// TODO(Windows docs): example with roots, should we rephrase this "spurious
// roots"?
public mutating func append(_ other: __owned String) {
defer { _invariantCheck() }
guard !other.utf8.isEmpty else { return }
@@ -529,8 +524,7 @@ extension FilePath {
/// Non-mutating version of `append(_:Component)`.
///
/// TODO(Windows docs): example with roots
///
// TODO(Windows docs): example with roots
public __consuming func appending(_ other: __owned Component) -> FilePath {
var copy = self
copy.append(other)
@@ -539,8 +533,7 @@ extension FilePath {
/// Non-mutating version of `append(_:C)`.
///
/// TODO(Windows docs): example with roots
///
// TODO(Windows docs): example with roots
public __consuming func appending<C: Collection>(
_ components: __owned C
) -> FilePath where C.Element == FilePath.Component {
@@ -551,8 +544,7 @@ extension FilePath {
/// Non-mutating version of `append(_:String)`.
///
/// TODO(Windows docs): example with roots
///
// TODO(Windows docs): example with roots
public __consuming func appending(_ other: __owned String) -> FilePath {
var copy = self
copy.append(other)
@@ -573,23 +565,21 @@ extension FilePath {
/// path.push("dir/file.txt") // path is "/tmp/dir/file.txt"
/// path.push("/bin") // path is "/bin"
///
/// TODO(Windows docs): examples and docs with roots, update/generalize doc
/// comment
///
// TODO(Windows docs): examples and docs with roots, update/generalize doc
// comment
public mutating func push(_ other: __owned FilePath) {
defer { _invariantCheck() }
guard other.root == nil else {
self = other
return
}
/// FIXME: Windows drive-relative roots, etc?
// FIXME: Windows drive-relative roots, etc?
_append(unchecked: other._storage[...])
}
/// Non-mutating version of `push()`
///
/// TODO(Windows docs): examples and docs with roots
/// Non-mutating version of `push()`.
///
// TODO(Windows docs): examples and docs with roots
public __consuming func pushing(_ other: __owned FilePath) -> FilePath {
var copy = self
copy.push(other)
@@ -156,7 +156,7 @@ internal struct WindowsRootInfo {
/// * Device disk: `\\.\C:\`, `\\?\C:\`
/// * UNC: `\\server\e:\`, `\\?\UNC\server\e:\`
///
/// TODO: NT paths? Admin paths using `$`?
// TODO: NT paths? Admin paths using `$`?
case drive(Character)
/// A volume with a GUID in a non-traditional path
@@ -164,7 +164,7 @@ internal struct WindowsRootInfo {
/// * UNC: `\\host\Volume{0000-...}\`, `\\.\UNC\host\Volume{0000-...}\`
/// * Device roots: `\\.\Volume{0000-...}\`, `\\?\Volume{000-...}\`
///
/// TODO: GUID type?
// TODO: GUID type?
case guid(String)
// TODO: Legacy DOS devices, such as COM1?
-1
View File
@@ -498,7 +498,6 @@ internal var _O_EVTONLY: CInt { O_EVTONLY }
@_alwaysEmitIntoClient
internal var _O_NOCTTY: CInt { O_NOCTTY }
// TODO: API?
@_alwaysEmitIntoClient
internal var _O_DIRECTORY: CInt { O_DIRECTORY }
#endif
+4 -4
View File
@@ -146,7 +146,7 @@ private func originalSyscallName(_ function: String) -> String {
private func mockImpl(
name: String,
path: UnsafePointer<CChar>?,
path: UnsafePointer<CInterop.PlatformChar>?,
_ args: [AnyHashable]
) -> CInt {
precondition(mockingEnabled)
@@ -177,18 +177,18 @@ private func mockImpl(
}
internal func _mock(
name: String = #function, path: UnsafePointer<CChar>? = nil, _ args: AnyHashable...
name: String = #function, path: UnsafePointer<CInterop.PlatformChar>? = nil, _ args: AnyHashable...
) -> CInt {
return mockImpl(name: name, path: path, args)
}
internal func _mockInt(
name: String = #function, path: UnsafePointer<CChar>? = nil, _ args: AnyHashable...
name: String = #function, path: UnsafePointer<CInterop.PlatformChar>? = nil, _ args: AnyHashable...
) -> Int {
Int(mockImpl(name: name, path: path, args))
}
internal func _mockOffT(
name: String = #function, path: UnsafePointer<CChar>? = nil, _ args: AnyHashable...
name: String = #function, path: UnsafePointer<CInterop.PlatformChar>? = nil, _ args: AnyHashable...
) -> _COffT {
_COffT(mockImpl(name: name, path: path, args))
}
+8
View File
@@ -115,3 +115,11 @@ internal func system_dup2(_ fd: Int32, _ fd2: Int32) -> Int32 {
#endif
return dup2(fd, fd2)
}
#if !os(Windows)
internal func system_pipe(_ fds: UnsafeMutablePointer<Int32>) -> CInt {
#if ENABLE_MOCKING
if mockingEnabled { return _mock(fds) }
#endif
return pipe(fds)
}
#endif
+2 -2
View File
@@ -53,8 +53,8 @@ extension SystemChar {
internal var isLetter: Bool {
guard isASCII else { return false }
let asciiRaw: UInt8 = numericCast(rawValue)
return (UInt8(ascii: "a") ..< UInt8(ascii: "z")).contains(asciiRaw) ||
(UInt8(ascii: "A") ..< UInt8(ascii: "Z")).contains(asciiRaw)
return (UInt8(ascii: "a") ... UInt8(ascii: "z")).contains(asciiRaw) ||
(UInt8(ascii: "A") ... UInt8(ascii: "Z")).contains(asciiRaw)
}
}
@@ -89,6 +89,27 @@ final class FileOperationsTest: XCTestCase {
func testHelpers() {
// TODO: Test writeAll, writeAll(toAbsoluteOffset), closeAfter
}
#if !os(Windows)
func testAdHocPipe() throws {
// Ad-hoc test testing `Pipe` functionality.
// We cannot test `Pipe` using `MockTestCase` because it calls `pipe` with a pointer to an array local to the `Pipe`, the address of which we do not know prior to invoking `Pipe`.
let pipe = try FileDescriptor.pipe()
try pipe.readEnd.closeAfter {
try pipe.writeEnd.closeAfter {
var abc = "abc"
try abc.withUTF8 {
_ = try pipe.writeEnd.write(UnsafeRawBufferPointer($0))
}
let readLen = 3
let readBytes = try Array<UInt8>(unsafeUninitializedCapacity: readLen) { buf, count in
count = try pipe.readEnd.read(into: UnsafeMutableRawBufferPointer(buf))
}
XCTAssertEqual(readBytes, Array(abc.utf8))
}
}
}
#endif
func testAdHocOpen() {
// Ad-hoc test touching a file system.
+39
View File
@@ -0,0 +1,39 @@
/*
This source file is part of the Swift System open source project
Copyright (c) 2020 - 2021 Apple Inc. and the Swift System project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
*/
import XCTest
#if SYSTEM_PACKAGE
@testable import SystemPackage
#else
@testable import System
#endif
final class SystemCharTest: XCTestCase {
func testIsLetter() {
let valid = SystemString(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
for char in valid {
XCTAssertTrue(char.isLetter)
}
// non printable
for value in 0..<(UInt8(ascii: " ")) {
XCTAssertFalse(SystemChar(codeUnit: value).isLetter)
}
XCTAssertFalse(SystemChar(codeUnit: 0x7F).isLetter) // DEL
// misc other
let invalid = SystemString(
##" !"#$%&'()*+,-./0123456789:;<=>?@[\]^_`{|}~"##)
for char in invalid {
XCTAssertFalse(char.isLetter)
}
}
}
+10
View File
@@ -94,6 +94,15 @@ extension MockingTest {
]
}
extension SystemCharTest {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__SystemCharTest = [
("testIsLetter", testIsLetter),
]
}
extension SystemStringTest {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
@@ -115,6 +124,7 @@ public func __allTests() -> [XCTestCaseEntry] {
testCase(FilePathTest.__allTests__FilePathTest),
testCase(FilePermissionsTest.__allTests__FilePermissionsTest),
testCase(MockingTest.__allTests__MockingTest),
testCase(SystemCharTest.__allTests__SystemCharTest),
testCase(SystemStringTest.__allTests__SystemStringTest),
]
}
+19
View File
@@ -0,0 +1,19 @@
#[[
This source file is part of the Swift System open source Project
Copyright (c) 2021 Apple Inc. and the Swift System project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
#]]
set(SWIFT_SYSTEM_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/SwiftSystemExports.cmake)
configure_file(SwiftSystemConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/SwiftSystemConfig.cmake)
get_property(SWIFT_SYSTEM_EXPORTS GLOBAL PROPERTY SWIFT_SYSTEM_EXPORTS)
export(TARGETS ${SWIFT_SYSTEM_EXPORTS}
NAMESPACE SwiftSystem::
FILE ${SWIFT_SYSTEM_EXPORTS_FILE}
EXPORT_LINK_INTERFACE_LIBRARIES)
+8 -2
View File
@@ -17,8 +17,12 @@ See https://swift.org/LICENSE.txt for license information
function(get_swift_host_arch result_var_name)
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set("${result_var_name}" "x86_64" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
set("${result_var_name}" "aarch64" PARENT_SCOPE)
elseif ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "AArch64|aarch64|arm64")
if(CMAKE_SYSTEM_NAME MATCHES Darwin)
set("${result_var_name}" "arm64" PARENT_SCOPE)
else()
set("${result_var_name}" "aarch64" PARENT_SCOPE)
endif()
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64")
set("${result_var_name}" "powerpc64" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64le")
@@ -31,6 +35,8 @@ function(get_swift_host_arch result_var_name)
set("${result_var_name}" "armv7" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7-a")
set("${result_var_name}" "armv7" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "amd64")
set("${result_var_name}" "amd64" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
set("${result_var_name}" "x86_64" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "IA64")
+12
View File
@@ -0,0 +1,12 @@
#[[
This source file is part of the Swift System open source Project
Copyright (c) 2021 Apple Inc. and the Swift System project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
#]]
if(NOT TARGET SystemPackage)
include(@SWIFT_SYSTEM_EXPORTS_FILE@)
endif()