Fix building on Windows

This commit is contained in:
YR Chen authored and Michael Ilseman committed 2021-08-05 10:05:06 -06:00
1 parent e520e61616
commit 58a2725013
2 files changed
+13 -5

No files matched your search

+9 -1
View File
@@ -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))
+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))
}