mirror of
https://github.com/apple/swift-system
synced 2026-11-29 05:24:25 +00:00
Fix building on Windows
This commit is contained in:
1 parent
e520e61616
commit
58a2725013
2 files changed
+13
-5
No files matched your search
+9
-1
@@ -12,11 +12,19 @@
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let targets: [PackageDescription.Target] = [
|
||||
var windowsPlatform: [Platform] = []
|
||||
#if os(Windows)
|
||||
windowsPlatform.append(.windows)
|
||||
#endif
|
||||
|
||||
let targets: [Target] = [
|
||||
.target(
|
||||
name: "SystemPackage",
|
||||
dependencies: ["CSystem"],
|
||||
path: "Sources/System",
|
||||
cSettings: [
|
||||
.define("_CRT_SECURE_NO_WARNINGS", .when(platforms: windowsPlatform)),
|
||||
],
|
||||
swiftSettings: [
|
||||
.define("SYSTEM_PACKAGE"),
|
||||
.define("ENABLE_MOCKING", .when(configuration: .debug))
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user