Skip to content

Commit

Permalink
Attempt to resolve windows ci issues
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLeif committed Nov 3, 2024
1 parent fba0ca1 commit 79c7016
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Package.resolved
45 changes: 38 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,43 @@
import PackageDescription
import CompilerPluginSupport

#if os(Windows)
let GUISwiftSettings: [SwiftSetting] = [
// Instruct the compiler to generate the entry point as `wWinMain`
// rather than `main` to ensure that the application is correctly
// marked as a GUI application (Windows subsystem). This is done
// by the linker based upon the main entry point. Simply marking
// the subsystem is insufficient as the compiler will materialize
// the entry point as `main`, resulting in an undefined symbol.
.unsafeFlags([
"-Xfrontend", "-entry-point-function-name",
"-Xfrontend", "wWinMain",
]),
]
let GUILinkerSettings: [LinkerSetting] = [
]
#endif

#if os(Windows)
let macroTarget: Target = Target.macro(
name: "MockedMacros",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax")
],
swiftSettings: GUISwiftSettings,
linkerSettings: GUILinkerSettings
)
#else
let macroTarget: Target = Target.macro(
name: "MockedMacros",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax")
]
)
#endif

let package = Package(
name: "Mocked",
platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .macCatalyst(.v13)],
Expand All @@ -25,13 +62,7 @@ let package = Package(
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
// Macro implementation that performs the source transformation of a macro.
.macro(
name: "MockedMacros",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax")
]
),
macroTarget,

// Library that exposes a macro as part of its API, which is used in client programs.
.target(name: "Mocked", dependencies: ["MockedMacros"]),
Expand Down

0 comments on commit 79c7016

Please sign in to comment.