Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
40 changes: 20 additions & 20 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"]),
],
Expand All @@ -68,29 +68,29 @@ 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
),

.target(
name: "OpenQuartzCore",
dependencies: ["OpenGraphics"],
dependencies: ["OpenCoreGraphics"],
swiftSettings: sharedSwiftSettings
),
.target(
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// CGAffineTransform.swift
// OpenGraphics
// OpenCoreGraphics

public import Foundation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// CGLine.swift
// OpenGraphics
// OpenCoreGraphics

/// Line join styles
public enum CGLineJoin: Int32, @unchecked Sendable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// CGPath.swift
// OpenGraphics
// OpenCoreGraphics
//
// License: MIT
// Modified from https://github.com/PureSwift/Silica/blob/22c72ff508c40ae5e673c16ad39f39235f6ddd01/Sources/Silica/CGPath.swift
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Shims.swift
// OpenGraphics
// OpenCoreGraphics

#if canImport(Darwin)
public import Foundation
Expand Down
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions Sources/OpenQuartzCore/CATransform3D.swift
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenQuartzCoreShims/Export.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// CGAffineTransformTests.swift
// OpenGraphicsShimsTests
// OpenCoreGraphicsShimsTests

import Testing
import OpenGraphicsShims
import OpenCoreGraphicsShims
import Numerics

@Suite
Expand Down
2 changes: 1 addition & 1 deletion Tests/OpenQuartzCoreShimsTests/CATransform3DTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// CATransform3DTests.swift
// OpenGraphicsShimsTests
// OpenQuartzCoreShimsTests

import Testing
import OpenQuartzCoreShims
Expand Down