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
2 changes: 1 addition & 1 deletion Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 16 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ extension Target {
dependencies.append(
.product(name: "RenderBox", package: "DarwinPrivateFrameworks")
)
var swiftSettings = swiftSettings ?? []
swiftSettings.append(.define("OPENRENDERBOX_RENDERBOX"))
self.swiftSettings = swiftSettings
cSettings = (cSettings ?? []) + [.define("OPENRENDERBOX_RENDERBOX")]
cxxSettings = (cxxSettings ?? []) + [.define("OPENRENDERBOX_RENDERBOX")]
swiftSettings = (swiftSettings ?? []) + [.define("OPENRENDERBOX_RENDERBOX")]
}
}

Expand Down Expand Up @@ -231,8 +231,19 @@ let openRenderBoxCxxTarget = Target.target(
)
let openRenderBoxShimsTarget = Target.target(
name: "OpenRenderBoxShims",
dependencies: ["OpenRenderBoxShimsCxx"],
swiftSettings: sharedSwiftSettings
)
let openRenderBoxShimsCxxTarget = Target.target(
name: "OpenRenderBoxShimsCxx",
dependencies: renderBoxCondtion
? [.product(name: "RenderBox", package: "DarwinPrivateFrameworks")]
: ["OpenRenderBox"],
sources: ["OpenRenderBoxShimsCxx.c"],
publicHeadersPath: renderBoxCondtion ? "include/RenderBox" : "include/OpenRenderBox",
cSettings: sharedCSettings,
cxxSettings: sharedCxxSettings
)
let openRenderBoxTestsTarget = Target.testTarget(
name: "OpenRenderBoxTests",
dependencies: [
Expand Down Expand Up @@ -270,7 +281,7 @@ let package = Package(
name: "OpenRenderBox",
products: [
.library(name: "OpenRenderBox", type: libraryType, targets: ["OpenRenderBox", "OpenRenderBoxCxx"]),
.library(name: "OpenRenderBoxShims", type: libraryType, targets: ["OpenRenderBoxShims"]),
.library(name: "OpenRenderBoxShims", type: libraryType, targets: ["OpenRenderBoxShims", "OpenRenderBoxShimsCxx"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-numerics", from: "1.1.1"),
Expand All @@ -279,6 +290,7 @@ let package = Package(
openRenderBoxTarget,
openRenderBoxCxxTarget,
openRenderBoxShimsTarget,
openRenderBoxShimsCxxTarget,
openRenderBoxTestsTarget,
openRenderBoxCompatibilityTestTarget,
],
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@ Currently, this project is in early development.

The current suggested toolchain to build the project is Swift 6.3.3 / Xcode 26.6.

## Shims

The `OpenRenderBoxShims` product provides Swift aliases and a C header for path APIs.
Swift clients use:

```swift
import OpenRenderBoxShims
```

C, C++, and Objective-C clients use:

```c
#include <OpenRenderBoxShims/OpenRenderBoxShims.h>
```

The C module is `OpenRenderBoxShimsCxx`; its public header uses the product name.

The package selects the public header directory for the configured backend.
Clients use `ORB` names with either backend and do not need to define
`OPENRENDERBOX_RENDERBOX` in their preprocessor settings.

## Supported platforms

| **CI Status** |
Expand Down
1 change: 1 addition & 0 deletions Sources/OpenRenderBoxShimsCxx/OpenRenderBoxShimsCxx.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Empty file to make SwiftPM happy :)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// OpenRenderBoxShims.h
// OpenRenderBoxShims

#pragma once

#include <OpenRenderBox/ORBPath.h>
#include <OpenRenderBox/ORBPathCallbacks.h>
#include <OpenRenderBox/ORBPathStorage.h>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module OpenRenderBoxShimsCxx {
umbrella header "OpenRenderBoxShims/OpenRenderBoxShims.h"
export *
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// OpenRenderBoxShims.h
// OpenRenderBoxShims

#pragma once

#include <RenderBox/RBPath.h>
#include <RenderBox/RBPathCallbacks.h>
#include <RenderBox/RBPathStorage.h>

typedef RBPath ORBPath;
typedef RBPathElement ORBPathElement;
typedef RBPathRoundedCornerStyle ORBPathRoundedCornerStyle;
typedef RBPathApplyCallback ORBPathApplyCallback;
typedef RBPathCallbacks ORBPathCallbacks;
typedef RBPathCallbacksFlags ORBPathCallbacksFlags;
typedef RBPathCallbacksExtended ORBPathCallbacksExtended;
typedef RBPathStorageRef ORBPathStorageRef;

#define ORBPathElementMoveToPoint RBPathElementMoveToPoint
#define ORBPathElementAddLineToPoint RBPathElementAddLineToPoint
#define ORBPathElementAddQuadCurveToPoint RBPathElementAddQuadCurveToPoint
#define ORBPathElementAddCurveToPoint RBPathElementAddCurveToPoint
#define ORBPathElementCloseSubpath RBPathElementCloseSubpath
#define ORBPathElementRect RBPathElementRect
#define ORBPathElementRoundedRect RBPathElementRoundedRect
#define ORBPathElementFixedRoundedRectCircular RBPathElementFixedRoundedRectCircular
#define ORBPathElementFixedRoundedRectContinuous RBPathElementFixedRoundedRectContinuous
#define ORBPathElementInvalid RBPathElementInvalid

#define ORBPathRoundedCornerStyleCircular RBPathRoundedCornerStyleCircular
#define ORBPathRoundedCornerStyleContinuous RBPathRoundedCornerStyleContinuous

#define ORBPathEmpty RBPathEmpty
#define ORBPathNull RBPathNull
#define ORBPathRetain RBPathRetain
#define ORBPathRelease RBPathRelease
#define ORBPathMakeWithCGPath RBPathMakeWithCGPath
#define ORBPathMakeRect RBPathMakeRect
#define ORBPathMakeEllipse RBPathMakeEllipse
#define ORBPathMakeRoundedRect RBPathMakeRoundedRect
#define ORBPathMakeUnevenRoundedRect RBPathMakeUnevenRoundedRect
#define ORBPathIsEmpty RBPathIsEmpty
#define ORBPathApplyElements RBPathApplyElements
#define ORBPathEqualToPath RBPathEqualToPath
#define ORBPathCopyCGPath RBPathCopyCGPath
#define ORBPathContainsPoint RBPathContainsPoint
#define ORBPathContainsPoints RBPathContainsPoints

#define ORBPathCGPathCallbacks RBPathCGPathCallbacks
#define ORBPathStorageInit RBPathStorageInit
#define ORBPathStorageDestroy RBPathStorageDestroy
#define ORBPathStorageClear RBPathStorageClear
#define ORBPathStorageAppendElement RBPathStorageAppendElement
#define ORBPathStorageAppendPath RBPathStorageAppendPath
#define ORBPathStorageApplyElements RBPathStorageApplyElements
#define ORBPathStorageIsEmpty RBPathStorageIsEmpty
#define ORBPathStorageEqualToStorage RBPathStorageEqualToStorage
#define ORBPathStorageIsSingleElement RBPathStorageIsSingleElement
#define ORBPathStorageGetBezierOrder RBPathStorageGetBezierOrder
#define ORBPathStorageGetBoundingRect RBPathStorageGetBoundingRect
#define ORBPathStorageGetCGPath RBPathStorageGetCGPath
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module OpenRenderBoxShimsCxx {
umbrella header "OpenRenderBoxShims/OpenRenderBoxShims.h"
export *
}
Loading