diff --git a/.github/workflows/compatibility_tests.yml b/.github/workflows/compatibility_tests.yml index 966da11..0d609bb 100644 --- a/.github/workflows/compatibility_tests.yml +++ b/.github/workflows/compatibility_tests.yml @@ -17,10 +17,10 @@ jobs: xcode-version: "16.4" # Swift 6.1.2 runs-on: ${{ matrix.os }} env: - OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 1 - OPENGRAPHICS_WERROR: 1 - OPENGRAPHICS_COREGRAPHICS: 1 - OPENGRAPHICS_LIBRARY_EVOLUTION: 0 + OPENCOREGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 1 + OPENCOREGRAPHICS_WERROR: 1 + OPENCOREGRAPHICS_COREGRAPHICS: 1 + OPENCOREGRAPHICS_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 6084da4..9cc2f5e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -16,10 +16,10 @@ jobs: xcode-version: [16.4] # Swift 6.1.2 runs-on: ${{ matrix.os }} env: - OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 1 - OPENGRAPHICS_WERROR: 1 - OPENGRAPHICS_COREGRAPHICS: 0 - OPENGRAPHICS_LIBRARY_EVOLUTION: 0 + OPENCOREGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 1 + OPENCOREGRAPHICS_WERROR: 1 + OPENCOREGRAPHICS_COREGRAPHICS: 0 + OPENCOREGRAPHICS_LIBRARY_EVOLUTION: 0 GH_TOKEN: ${{ github.token }} steps: - uses: actions/checkout@v4 @@ -37,7 +37,7 @@ jobs: --build-path .build-test-debug xcrun llvm-cov show \ -instr-profile=.build-test-debug/debug/codecov/default.profdata \ - .build-test-debug/debug/OpenGraphicsPackageTests.xctest/Contents/MacOS/OpenGraphicsPackageTests \ + .build-test-debug/debug/OpenCoreGraphicsPackageTests.xctest/Contents/MacOS/OpenCoreGraphicsPackageTests \ > coverage.txt - name: Build and run tests in release mode run: | diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 922194b..ea3e03b 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -15,10 +15,10 @@ jobs: swift_version: ["6.1.2"] runs-on: ubuntu-22.04 env: - OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 0 - OPENGRAPHICS_WERROR: 1 - OPENGRAPHICS_COREGRAPHICS: 0 - OPENGRAPHICS_LIBRARY_EVOLUTION: 0 + OPENCOREGRAPHICS_BUILD_FOR_DARWIN_PLATFORM: 0 + OPENCOREGRAPHICS_WERROR: 1 + OPENCOREGRAPHICS_COREGRAPHICS: 0 + OPENCOREGRAPHICS_LIBRARY_EVOLUTION: 0 container: swift:${{ matrix.swift_version }}-jammy steps: - uses: actions/checkout@v4 @@ -33,7 +33,7 @@ jobs: --build-path .build-test-debug llvm-cov show \ -instr-profile=.build-test-debug/debug/codecov/default.profdata \ - .build-test-debug/debug/OpenGraphicsPackageTests.xctest \ + .build-test-debug/debug/OpenCoreGraphicsPackageTests.xctest \ > coverage.txt - name: Building and running tests in release mode run: | diff --git a/Package.swift b/Package.swift index af55175..72ce9a2 100644 --- a/Package.swift +++ b/Package.swift @@ -22,44 +22,44 @@ var sharedSwiftSettings: [SwiftSetting] = [ #if os(macOS) // NOTE: #if os(macOS) check is not accurate if we are cross compiling for Linux platform. So we add an env key to specify it. -let buildForDarwinPlatform = envEnable("OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM", default: true) +let buildForDarwinPlatform = envEnable("OPENCOREGRAPHICS_BUILD_FOR_DARWIN_PLATFORM", default: true) #else -let buildForDarwinPlatform = envEnable("OPENGRAPHICS_BUILD_FOR_DARWIN_PLATFORM") +let buildForDarwinPlatform = envEnable("OPENCOREGRAPHICS_BUILD_FOR_DARWIN_PLATFORM") #endif let isXcodeEnv = Context.environment["__CFBundleIdentifier"] == "com.apple.dt.Xcode" -let development = envEnable("OPENGRAPHICS_DEVELOPMENT") +let development = envEnable("OPENCOREGRAPHICS_DEVELOPMENT") -// MARK: - [env] OPENGRAPHICS_COREGRAPHICS +// MARK: - [env] OPENCOREGRAPHICS_COREGRAPHICS -let coreGraphicsCondition = envEnable("OPENGRAPHICS_COREGRAPHICS", default: buildForDarwinPlatform) +let coreGraphicsCondition = envEnable("OPENCOREGRAPHICS_COREGRAPHICS", default: buildForDarwinPlatform) if coreGraphicsCondition { - sharedSwiftSettings.append(.define("OPENGRAPHICS_COREGRAPHICS")) + sharedSwiftSettings.append(.define("OPENCOREGRAPHICS_COREGRAPHICS")) } -// MARK: - [env] OPENGRAPHICS_WERROR +// MARK: - [env] OPENCOREGRAPHICS_WERROR -let warningsAsErrorsCondition = envEnable("OPENGRAPHICS_WERROR", default: isXcodeEnv && development) +let warningsAsErrorsCondition = envEnable("OPENCOREGRAPHICS_WERROR", default: isXcodeEnv && development) if warningsAsErrorsCondition { sharedSwiftSettings.append(.unsafeFlags(["-warnings-as-errors"])) } -// MARK: - [env] OPENGRAPHICS_LIBRARY_EVOLUTION +// MARK: - [env] OPENCOREGRAPHICS_LIBRARY_EVOLUTION -let libraryEvolutionCondition = envEnable("OPENGRAPHICS_LIBRARY_EVOLUTION", default: buildForDarwinPlatform) +let libraryEvolutionCondition = envEnable("OPENCOREGRAPHICS_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` + // Either set OPENCOREGRAPHICS_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", + name: "OpenCoreGraphics", products: [ - .library(name: "OpenGraphics", targets: ["OpenGraphics"]), - .library(name: "OpenGraphicsShims", targets: ["OpenGraphicsShims"]), + .library(name: "OpenCoreGraphics", targets: ["OpenCoreGraphics"]), + .library(name: "OpenCoreGraphicsShims", targets: ["OpenCoreGraphicsShims"]), .library(name: "OpenQuartzCore", targets: ["OpenQuartzCore"]), .library(name: "OpenQuartzCoreShims", targets: ["OpenQuartzCoreShims"]), ], @@ -68,21 +68,21 @@ let package = Package( ], targets: [ .target( - name: "OpenGraphics", + name: "OpenCoreGraphics", swiftSettings: sharedSwiftSettings ), .target( - name: "OpenGraphicsShims", - dependencies: ["OpenGraphics"], + name: "OpenCoreGraphicsShims", + dependencies: ["OpenCoreGraphics"], swiftSettings: sharedSwiftSettings, linkerSettings: [ .linkedFramework("CoreGraphics", .when(platforms: .darwinPlatforms)), ] ), .testTarget( - name: "OpenGraphicsShimsTests", + name: "OpenCoreGraphicsShimsTests", dependencies: [ - "OpenGraphicsShims", + "OpenCoreGraphicsShims", .product(name: "Numerics", package: "swift-numerics"), ], swiftSettings: sharedSwiftSettings @@ -90,7 +90,7 @@ let package = Package( .target( name: "OpenQuartzCore", - dependencies: ["OpenGraphics"], + dependencies: ["OpenCoreGraphics"], swiftSettings: sharedSwiftSettings ), .target( diff --git a/README.md b/README.md index 8c3ae39..4707c77 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# OpenGraphics +# OpenCoreGraphics -[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FOpenSwiftUIProject%2FOpenGraphics%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/OpenSwiftUIProject/OpenGraphics) +[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FOpenSwiftUIProject%2FOpenCoreGraphics%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/OpenSwiftUIProject/OpenCoreGraphics) -[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FOpenSwiftUIProject%2FOpenGraphics%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/OpenSwiftUIProject/OpenGraphics) +[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FOpenSwiftUIProject%2FOpenCoreGraphics%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/OpenSwiftUIProject/OpenCoreGraphics) -[![codecov](https://codecov.io/github/OpenSwiftUIProject/OpenGraphics/graph/badge.svg?token=1JKUXEZRCB)](https://codecov.io/github/OpenSwiftUIProject/OpenGraphics) +[![codecov](https://codecov.io/github/OpenSwiftUIProject/OpenCoreGraphics/graph/badge.svg?token=1JKUXEZRCB)](https://codecov.io/github/OpenSwiftUIProject/OpenCoreGraphics) -OpenGraphics provides an alternative implementation of Apple's CoreGraphics framework which is not available on non-Apple platforms. +OpenCoreGraphics provides an alternative implementation of Apple's CoreGraphics framework which is not available on non-Apple platforms. Currently, this project is in early development. @@ -27,9 +27,9 @@ Ref: | **CI Status** | |---| -|[![Compatibility tests](https://github.com/OpenSwiftUIProject/OpenGraphics/actions/workflows/compatibility_tests.yml/badge.svg)](https://github.com/OpenSwiftUIProject/OpenGraphics/actions/workflows/compatibility_tests.yml)| -|[![macOS](https://github.com/OpenSwiftUIProject/OpenGraphics/actions/workflows/macos.yml/badge.svg)](https://github.com/OpenSwiftUIProject/OpenGraphics/actions/workflows/macos.yml)| -|[![Ubuntu](https://github.com/OpenSwiftUIProject/OpenGraphics/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/OpenSwiftUIProject/OpenGraphics/actions/workflows/ubuntu.yml)| +|[![Compatibility tests](https://github.com/OpenSwiftUIProject/OpenCoreGraphics/actions/workflows/compatibility_tests.yml/badge.svg)](https://github.com/OpenSwiftUIProject/OpenCoreGraphics/actions/workflows/compatibility_tests.yml)| +|[![macOS](https://github.com/OpenSwiftUIProject/OpenCoreGraphics/actions/workflows/macos.yml/badge.svg)](https://github.com/OpenSwiftUIProject/OpenCoreGraphics/actions/workflows/macos.yml)| +|[![Ubuntu](https://github.com/OpenSwiftUIProject/OpenCoreGraphics/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/OpenSwiftUIProject/OpenCoreGraphics/actions/workflows/ubuntu.yml)| ## License diff --git a/Sources/OpenGraphics/CGAffineTransform.swift b/Sources/OpenCoreGraphics/CGAffineTransform.swift similarity index 99% rename from Sources/OpenGraphics/CGAffineTransform.swift rename to Sources/OpenCoreGraphics/CGAffineTransform.swift index dd040e8..876706b 100644 --- a/Sources/OpenGraphics/CGAffineTransform.swift +++ b/Sources/OpenCoreGraphics/CGAffineTransform.swift @@ -1,6 +1,6 @@ // // CGAffineTransform.swift -// OpenGraphics +// OpenCoreGraphics public import Foundation diff --git a/Sources/OpenGraphics/CGLine.swift b/Sources/OpenCoreGraphics/CGLine.swift similarity index 93% rename from Sources/OpenGraphics/CGLine.swift rename to Sources/OpenCoreGraphics/CGLine.swift index a0d164e..a986f5b 100644 --- a/Sources/OpenGraphics/CGLine.swift +++ b/Sources/OpenCoreGraphics/CGLine.swift @@ -1,6 +1,6 @@ // // CGLine.swift -// OpenGraphics +// OpenCoreGraphics /// Line join styles public enum CGLineJoin: Int32, @unchecked Sendable { diff --git a/Sources/OpenGraphics/CGPath.swift b/Sources/OpenCoreGraphics/CGPath.swift similarity index 99% rename from Sources/OpenGraphics/CGPath.swift rename to Sources/OpenCoreGraphics/CGPath.swift index 00b8acd..36b926c 100644 --- a/Sources/OpenGraphics/CGPath.swift +++ b/Sources/OpenCoreGraphics/CGPath.swift @@ -1,6 +1,6 @@ // // CGPath.swift -// OpenGraphics +// OpenCoreGraphics // // License: MIT // Modified from https://github.com/PureSwift/Silica/blob/22c72ff508c40ae5e673c16ad39f39235f6ddd01/Sources/Silica/CGPath.swift diff --git a/Sources/OpenGraphics/Shims.swift b/Sources/OpenCoreGraphics/Shims.swift similarity index 97% rename from Sources/OpenGraphics/Shims.swift rename to Sources/OpenCoreGraphics/Shims.swift index 1b21c80..7e55a63 100644 --- a/Sources/OpenGraphics/Shims.swift +++ b/Sources/OpenCoreGraphics/Shims.swift @@ -1,6 +1,6 @@ // // Shims.swift -// OpenGraphics +// OpenCoreGraphics #if canImport(Darwin) public import Foundation diff --git a/Sources/OpenGraphicsShims/Export.swift b/Sources/OpenCoreGraphicsShims/Export.swift similarity index 71% rename from Sources/OpenGraphicsShims/Export.swift rename to Sources/OpenCoreGraphicsShims/Export.swift index 9ae4330..755e4e3 100644 --- a/Sources/OpenGraphicsShims/Export.swift +++ b/Sources/OpenCoreGraphicsShims/Export.swift @@ -1,11 +1,11 @@ // // Export.swift -// OpenGraphicsShims +// OpenCoreGraphicsShims -#if OPENGRAPHICS_COREGRAPHICS +#if OPENCOREGRAPHICS_COREGRAPHICS @_exported import CoreGraphics #else -@_exported import OpenGraphics +@_exported import OpenCoreGraphics @_exported import CoreFoundation // CoreGraphics will export CoreFoundation @_exported import Foundation // For non-Darwin platforms, CG_TYPES is defined on Foundation #endif diff --git a/Sources/OpenQuartzCore/CATransform3D.swift b/Sources/OpenQuartzCore/CATransform3D.swift index 17eb50e..f9c5382 100644 --- a/Sources/OpenQuartzCore/CATransform3D.swift +++ b/Sources/OpenQuartzCore/CATransform3D.swift @@ -1,12 +1,12 @@ // // CATransform3D.swift -// OpenGraphics +// OpenCoreGraphics // // License: MIT // Modified from https://github.com/flowkey/UIKit-cross-platform/blob/7e28dc4c62d20afe03e55bbba660076ec06fd79a/Sources/CATransform3D.swift public import Foundation -public import struct OpenGraphics.CGAffineTransform +public import struct OpenCoreGraphics.CGAffineTransform public struct CATransform3D: Sendable { public init( diff --git a/Sources/OpenQuartzCoreShims/Export.swift b/Sources/OpenQuartzCoreShims/Export.swift index 0431722..68398a5 100644 --- a/Sources/OpenQuartzCoreShims/Export.swift +++ b/Sources/OpenQuartzCoreShims/Export.swift @@ -2,11 +2,11 @@ // Export.swift // OpenQuartzCoreShims -#if OPENGRAPHICS_COREGRAPHICS +#if OPENCOREGRAPHICS_COREGRAPHICS @_exported import QuartzCore #else @_exported import OpenQuartzCore -@_exported import OpenGraphics // QuartzCore will export CoreGraphics +@_exported import OpenCoreGraphics // QuartzCore will export CoreGraphics @_exported import CoreFoundation // CoreGraphics will export CoreFoundation @_exported import Foundation // For non-Darwin platforms, CG_TYPES is defined on Foundation #endif diff --git a/Tests/OpenGraphicsShimsTests/CGAffineTransformTests.swift b/Tests/OpenCoreGraphicsShimsTests/CGAffineTransformTests.swift similarity index 97% rename from Tests/OpenGraphicsShimsTests/CGAffineTransformTests.swift rename to Tests/OpenCoreGraphicsShimsTests/CGAffineTransformTests.swift index b2b80b8..029fc89 100644 --- a/Tests/OpenGraphicsShimsTests/CGAffineTransformTests.swift +++ b/Tests/OpenCoreGraphicsShimsTests/CGAffineTransformTests.swift @@ -1,9 +1,9 @@ // // CGAffineTransformTests.swift -// OpenGraphicsShimsTests +// OpenCoreGraphicsShimsTests import Testing -import OpenGraphicsShims +import OpenCoreGraphicsShims import Numerics @Suite diff --git a/Tests/OpenQuartzCoreShimsTests/CATransform3DTests.swift b/Tests/OpenQuartzCoreShimsTests/CATransform3DTests.swift index 580b089..c6ddc25 100644 --- a/Tests/OpenQuartzCoreShimsTests/CATransform3DTests.swift +++ b/Tests/OpenQuartzCoreShimsTests/CATransform3DTests.swift @@ -1,6 +1,6 @@ // // CATransform3DTests.swift -// OpenGraphicsShimsTests +// OpenQuartzCoreShimsTests import Testing import OpenQuartzCoreShims