Skip to content

Commit 60430cf

Browse files
committed
Update target and add CxxTests
1 parent c85365e commit 60430cf

File tree

9 files changed

+49
-30
lines changed

9 files changed

+49
-30
lines changed

Package.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@ let openRenderBoxShimsTarget = Target.target(
7575
name: "OpenRenderBoxShims",
7676
swiftSettings: sharedSwiftSettings
7777
)
78-
let openRenderBoxTestTarget = Target.testTarget(
79-
name: "OpenRenderBoxTests",
78+
let openRenderBoxCxxTestTarget = Target.testTarget(
79+
name: "OpenRenderBoxCxxTests",
8080
dependencies: [
8181
"OpenRenderBox",
8282
],
8383
exclude: ["README.md"],
84-
swiftSettings: sharedSwiftSettings
84+
cSettings: sharedCSettings + [.define("SWIFT_TESTING")],
85+
swiftSettings: sharedSwiftSettings + [.interoperabilityMode(.Cxx)]
8586
)
8687
let openRenderBoxCompatibilityTestTarget = Target.testTarget(
8788
name: "OpenRenderBoxCompatibilityTests",
@@ -117,7 +118,7 @@ let package = Package(
117118
openRenderBoxTarget,
118119
openRenderBoxShimsTarget,
119120

120-
openRenderBoxTestTarget,
121+
openRenderBoxCxxTestTarget,
121122
openRenderBoxCompatibilityTestTarget,
122123
],
123124
cxxLanguageStandard: .cxx20

Sources/OpenRenderBox/UUID/ORBUUID.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <OpenRenderBox/ORBUUID.h>
66

7-
#if ORB_TARGET_OS_DARWIN
7+
#if ORB_TARGET_OS_DARWIN && __OBJC__
88
ORBUUID ORBUUIDInitFromNSUUID(NSUUID *uuid) {
99
ORBUUID ob_uuid;
1010
[uuid getUUIDBytes:ob_uuid.bytes];

Sources/OpenRenderBox/include/OpenRenderBox/ORBUUID.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include "ORBBase.h"
88

9-
#if ORB_TARGET_OS_DARWIN
9+
#if ORB_TARGET_OS_DARWIN && __OBJC__
1010
#include <Foundation/Foundation.h>
1111
#endif
1212

@@ -16,7 +16,7 @@ typedef struct ORBUUID {
1616

1717
ORB_EXTERN_C_BEGIN
1818

19-
#if ORB_TARGET_OS_DARWIN
19+
#if ORB_TARGET_OS_DARWIN && __OBJC__
2020
ORB_EXPORT
2121
ORB_REFINED_FOR_SWIFT
2222
ORBUUID ORBUUIDInitFromNSUUID(NSUUID *uuid) ORB_SWIFT_NAME(ORBUUID.init(uuid:));

Sources/OpenRenderBox/include/OpenRenderBoxCxx/Util/log.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010

1111
#include <os/log.h>
1212

13+
ORB_ASSUME_NONNULL_BEGIN
14+
1315
namespace ORB {
1416
os_log_t misc_log();
1517
os_log_t error_log();
1618
} /* ORB */
1719

20+
ORB_ASSUME_NONNULL_END
21+
1822
#endif /* ORB_TARGET_OS_DARWIN */
1923

Sources/OpenRenderBox/include/module.modulemap

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,20 @@ module OpenRenderBox {
22
umbrella header "OpenRenderBox/OpenRenderBox-umbrella.h"
33
export *
44
}
5+
6+
module OpenRenderBoxCxx {
7+
requires cplusplus
8+
export *
9+
}
10+
11+
module OpenRenderBoxCxx.Path {
12+
requires cplusplus
13+
umbrella "OpenRenderBoxCxx/Path"
14+
export *
15+
}
16+
17+
module OpenRenderBoxCxx.Util {
18+
requires cplusplus
19+
umbrella "OpenRenderBoxCxx/Util"
20+
export *
21+
}

Sources/OpenRenderBox/include/module.private.modulemap

Lines changed: 0 additions & 15 deletions
This file was deleted.
File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// LogTests.swift
3+
// OpenRenderBox
4+
//
5+
// Created by Kyle on 2025/9/8.
6+
//
7+
8+
#if canImport(Darwin)
9+
import OpenRenderBoxCxx.Util
10+
import Testing
11+
12+
@Suite
13+
struct LogTests {
14+
@Test
15+
func table() {
16+
_ = ORB.misc_log()
17+
_ = ORB.error_log()
18+
}
19+
}
20+
#endif

Tests/OpenRenderBoxTests/DummyTests.swift

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)