diff --git a/Package.swift b/Package.swift index 01415971..acfbbf71 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.7 +// swift-tools-version:5.9 import PackageDescription @@ -38,6 +38,9 @@ let SwiftWin32: Package = ], path: "Sources/SwiftWin32", exclude: ["CoreAnimation", "CMakeLists.txt"], + swiftSettings: [ + .enableExperimentalFeature("AccessLevelOnImport"), + ], linkerSettings: [ .linkedLibrary("User32"), .linkedLibrary("ComCtl32"), diff --git a/Package@swift-5.7.swift b/Package@swift-5.7.swift new file mode 100644 index 00000000..01415971 --- /dev/null +++ b/Package@swift-5.7.swift @@ -0,0 +1,80 @@ +// swift-tools-version:5.7 + +import PackageDescription + +let SwiftWin32: Package = + Package(name: "SwiftWin32", + products: [ + .library(name: "SwiftWin32", + type: .dynamic, + targets: ["SwiftWin32"]), + .library(name: "SwiftWin32UI", + type: .dynamic, + targets: ["SwiftWin32UI"]), + .executable(name: "UICatalog", targets: ["UICatalog"]), + .executable(name: "Calculator", targets: ["Calculator"]), + ], + dependencies: [ + .package(url: "https://github.com/apple/swift-log.git", + .upToNextMajor(from: "1.4.3")), + .package(url: "https://github.com/apple/swift-collections.git", + .upToNextMinor(from: "1.0.0")), + .package(url: "https://github.com/compnerd/cassowary.git", + branch: "main"), + .package(url: "https://github.com/compnerd/swift-com.git", + revision: "ebbc617d3b7ba3a2023988a74bebd118deea4cc5"), + ], + targets: [ + .target(name: "CoreAnimation", + path: "Sources/SwiftWin32/CoreAnimation"), + .target(name: "SwiftWin32", + dependencies: [ + "CoreAnimation", + .product(name: "Logging", package: "swift-log"), + .product(name: "OrderedCollections", + package: "swift-collections"), + .product(name: "cassowary", package: "cassowary"), + .product(name: "SwiftCOM", package: "swift-com"), + ], + path: "Sources/SwiftWin32", + exclude: ["CoreAnimation", "CMakeLists.txt"], + linkerSettings: [ + .linkedLibrary("User32"), + .linkedLibrary("ComCtl32"), + ]), + .target(name: "SwiftWin32UI", + dependencies: ["SwiftWin32"], + path: "Sources/SwiftWin32UI", + exclude: ["CMakeLists.txt"]), + .executableTarget(name: "Calculator", + dependencies: ["SwiftWin32"], + path: "Examples/Calculator", + exclude: [ + "CMakeLists.txt", + "Calculator.exe.manifest", + "Info.plist", + ], + swiftSettings: [ + .unsafeFlags(["-parse-as-library"]) + ]), + .executableTarget(name: "UICatalog", + dependencies: ["SwiftWin32"], + path: "Examples/UICatalog", + exclude: [ + "CMakeLists.txt", + "Info.plist", + "UICatalog.exe.manifest", + ], + resources: [ + .copy("Assets/CoffeeCup.jpg") + ], + swiftSettings: [ + .unsafeFlags(["-parse-as-library"]) + ]), + .target(name: "TestUtilities", path: "Tests/Utilities"), + .testTarget(name: "AutoLayoutTests", dependencies: ["SwiftWin32"]), + .testTarget(name: "CoreGraphicsTests", dependencies: ["SwiftWin32"]), + .testTarget(name: "SupportTests", dependencies: ["SwiftWin32"]), + .testTarget(name: "UICoreTests", + dependencies: ["SwiftWin32", "TestUtilities"]) + ]) diff --git a/Sources/SwiftWin32/Platform/Win32+Menu.swift b/Sources/SwiftWin32/Platform/Win32+Menu.swift index 4251125f..a4cd19b3 100644 --- a/Sources/SwiftWin32/Platform/Win32+Menu.swift +++ b/Sources/SwiftWin32/Platform/Win32+Menu.swift @@ -3,8 +3,12 @@ import WinSDK +#if swift(>=5.9) +internal import OrderedCollections +#else @_implementationOnly import OrderedCollections +#endif internal final class _MenuBuilder: MenuSystem { internal private(set) var hMenu: MenuHandle diff --git a/Sources/SwiftWin32/Support/Logging.swift b/Sources/SwiftWin32/Support/Logging.swift index 7a15d125..51d88fde 100644 --- a/Sources/SwiftWin32/Support/Logging.swift +++ b/Sources/SwiftWin32/Support/Logging.swift @@ -1,7 +1,11 @@ // Copyright © 2020 Saleem Abdulrasool // SPDX-License-Identifier: BSD-3-Clause +#if swift(>=5.9) +internal import Logging +#else @_implementationOnly import Logging +#endif internal let log: Logger = Logger(label: "org.compnerd.swift-win32")