Skip to content

Commit 5ce8130

Browse files
authored
Add library evolution support (#2)
1 parent 1b22a21 commit 5ce8130

5 files changed

Lines changed: 23 additions & 1 deletion

File tree

.github/workflows/compatibility_tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 1
2121
OPENGRAPHICS_WERROR: 1
2222
OPENGRAPHICS_COREGRAPHICS: 1
23+
OPENGRAPHICS_LIBRARY_EVOLUTION: 0
2324
GH_TOKEN: ${{ github.token }}
2425
steps:
2526
- uses: actions/checkout@v4

.github/workflows/macos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 1
2020
OPENGRAPHICS_WERROR: 1
2121
OPENGRAPHICS_COREGRAPHICS: 0
22+
OPENGRAPHICS_LIBRARY_EVOLUTION: 0
2223
GH_TOKEN: ${{ github.token }}
2324
steps:
2425
- uses: actions/checkout@v4

.github/workflows/ubuntu.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 0
1919
OPENGRAPHICS_WERROR: 1
2020
OPENGRAPHICS_COREGRAPHICS: 0
21+
OPENGRAPHICS_LIBRARY_EVOLUTION: 0
2122
container: swift:${{ matrix.swift_version }}-jammy
2223
steps:
2324
- uses: actions/checkout@v4

Package.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,37 @@ let isXcodeEnv = Context.environment["__CFBundleIdentifier"] == "com.apple.dt.Xc
3131

3232
let development = envEnable("OPENGRAPHICS_DEVELOPMENT")
3333

34+
// MARK: - [env] OPENGRAPHICS_COREGRAPHICS
35+
3436
let coreGraphicsCondition = envEnable("OPENGRAPHICS_COREGRAPHICS", default: buildForDarwinPlatform)
3537
if coreGraphicsCondition {
3638
sharedSwiftSettings.append(.define("OPENGRAPHICS_COREGRAPHICS"))
3739
}
3840

41+
// MARK: - [env] OPENGRAPHICS_WERROR
42+
3943
let warningsAsErrorsCondition = envEnable("OPENGRAPHICS_WERROR", default: isXcodeEnv && development)
4044
if warningsAsErrorsCondition {
4145
sharedSwiftSettings.append(.unsafeFlags(["-warnings-as-errors"]))
4246
}
4347

48+
// MARK: - [env] OPENGRAPHICS_LIBRARY_EVOLUTION
49+
50+
let libraryEvolutionCondition = envEnable("OPENGRAPHICS_LIBRARY_EVOLUTION", default: buildForDarwinPlatform)
51+
52+
if libraryEvolutionCondition {
53+
// NOTE: -enable-library-evolution will cause module verify failure for `swift build`.
54+
// Either set OPENGRAPHICS_LIBRARY_EVOLUTION=0 or add `-Xswiftc -no-verify-emitted-module-interface` after `swift build`
55+
sharedSwiftSettings.append(.unsafeFlags(["-enable-library-evolution", "-no-verify-emitted-module-interface"]))
56+
}
57+
4458
let package = Package(
4559
name: "OpenGraphics",
4660
products: [
4761
.library(name: "OpenGraphics", targets: ["OpenGraphics"]),
4862
.library(name: "OpenGraphicsShims", targets: ["OpenGraphicsShims"]),
63+
.library(name: "OpenQuartzCore", targets: ["OpenQuartzCore"]),
64+
.library(name: "OpenQuartzCoreShims", targets: ["OpenQuartzCoreShims"]),
4965
],
5066
dependencies: [
5167
.package(url: "https://github.com/apple/swift-numerics", from: "1.0.3"),

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ The current suggested toolchain to build the project is Swift 6.1.2 / Xcode 16.4
1818

1919
- [ ] Add more API and types.
2020

21-
Ref: https://github.com/PureSwift/Silicae
21+
Ref:
22+
23+
- https://github.com/PureSwift/Silicae
24+
- https://github.com/gnustep/libs-quartzcore
2225

2326
## Supported platforms
2427

0 commit comments

Comments
 (0)