From fdc4b09fe4d3ca49e1c0e36c36b931a4337912a8 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 30 Aug 2025 00:07:43 +0800 Subject: [PATCH 1/3] Add library evolution support --- .github/workflows/compatibility_tests.yml | 1 + .github/workflows/macos.yml | 1 + .github/workflows/ubuntu.yml | 1 + Package.swift | 14 ++++++++++++++ 4 files changed, 17 insertions(+) diff --git a/.github/workflows/compatibility_tests.yml b/.github/workflows/compatibility_tests.yml index 951fcd5..966da11 100644 --- a/.github/workflows/compatibility_tests.yml +++ b/.github/workflows/compatibility_tests.yml @@ -20,6 +20,7 @@ jobs: OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 1 OPENGRAPHICS_WERROR: 1 OPENGRAPHICS_COREGRAPHICS: 1 + OPENGRAPHICS_LIBRARY_EVOLUTION: 0 GH_TOKEN: ${{ github.token }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6d43509..6084da4 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -19,6 +19,7 @@ jobs: OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 1 OPENGRAPHICS_WERROR: 1 OPENGRAPHICS_COREGRAPHICS: 0 + OPENGRAPHICS_LIBRARY_EVOLUTION: 0 GH_TOKEN: ${{ github.token }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 2c22783..922194b 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -18,6 +18,7 @@ jobs: OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 0 OPENGRAPHICS_WERROR: 1 OPENGRAPHICS_COREGRAPHICS: 0 + OPENGRAPHICS_LIBRARY_EVOLUTION: 0 container: swift:${{ matrix.swift_version }}-jammy steps: - uses: actions/checkout@v4 diff --git a/Package.swift b/Package.swift index d6a2dfa..70c1632 100644 --- a/Package.swift +++ b/Package.swift @@ -31,16 +31,30 @@ let isXcodeEnv = Context.environment["__CFBundleIdentifier"] == "com.apple.dt.Xc let development = envEnable("OPENGRAPHICS_DEVELOPMENT") +// MARK: - [env] OPENGRAPHICS_COREGRAPHICS + let coreGraphicsCondition = envEnable("OPENGRAPHICS_COREGRAPHICS", default: buildForDarwinPlatform) if coreGraphicsCondition { sharedSwiftSettings.append(.define("OPENGRAPHICS_COREGRAPHICS")) } +// MARK: - [env] OPENGRAPHICS_WERROR + let warningsAsErrorsCondition = envEnable("OPENGRAPHICS_WERROR", default: isXcodeEnv && development) if warningsAsErrorsCondition { sharedSwiftSettings.append(.unsafeFlags(["-warnings-as-errors"])) } +// MARK: - [env] OPENGRAPHICS_LIBRARY_EVOLUTION + +let libraryEvolutionCondition = envEnable("OPENGRAPHICS_LIBRARY_EVOLUTION", default: buildForDarwinPlatform) + +if libraryEvolutionCondition { + // NOTE: -enable-library-evolution will cause module verify failure for `swift build`. + // Either set OPENGRAPHICS_LIBRARY_EVOLUTION=0 or add `-Xswiftc -no-verify-emitted-module-interface` after `swift build` + sharedSwiftSettings.append(.unsafeFlags(["-enable-library-evolution", "-no-verify-emitted-module-interface"])) +} + let package = Package( name: "OpenGraphics", products: [ From 9c449c7211f0c5dcebf2a72fcc1970b28c89241f Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 30 Aug 2025 00:07:56 +0800 Subject: [PATCH 2/3] Add gnustep ref --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a86f07b..8c3ae39 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,10 @@ The current suggested toolchain to build the project is Swift 6.1.2 / Xcode 16.4 - [ ] Add more API and types. -Ref: https://github.com/PureSwift/Silicae +Ref: + +- https://github.com/PureSwift/Silicae +- https://github.com/gnustep/libs-quartzcore ## Supported platforms From b495c2f188de408660532cffaa60584771171dd5 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 30 Aug 2025 00:08:40 +0800 Subject: [PATCH 3/3] Add OpenQuarzCore target --- Package.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Package.swift b/Package.swift index 70c1632..af55175 100644 --- a/Package.swift +++ b/Package.swift @@ -60,6 +60,8 @@ let package = Package( products: [ .library(name: "OpenGraphics", targets: ["OpenGraphics"]), .library(name: "OpenGraphicsShims", targets: ["OpenGraphicsShims"]), + .library(name: "OpenQuartzCore", targets: ["OpenQuartzCore"]), + .library(name: "OpenQuartzCoreShims", targets: ["OpenQuartzCoreShims"]), ], dependencies: [ .package(url: "https://github.com/apple/swift-numerics", from: "1.0.3"),