Skip to content

Commit fdc4b09

Browse files
committed
Add library evolution support
1 parent 1b22a21 commit fdc4b09

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

.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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,30 @@ 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: [

0 commit comments

Comments
 (0)