Skip to content

Commit 1004fb9

Browse files
committed
Update Tuist workspace configuration
1 parent e3484bf commit 1004fb9

15 files changed

Lines changed: 356 additions & 91 deletions

File tree

‎.github/workflows/compute.yml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,54 @@ jobs:
2929
- name: Build in debug mode
3030
run: swift build -c debug -Xcc -Wno-elaborated-enum-base
3131

32+
compute_tuist_macos_build:
33+
name: Build generated project with Compute (source) on macOS
34+
permissions:
35+
contents: read
36+
id-token: write
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
os: [macos-15]
41+
xcode-version: ["26.6"]
42+
runs-on:
43+
- ${{ matrix.os }}
44+
- xcode-26.6
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
submodules: true
49+
- name: Setup Xcode
50+
uses: OpenSwiftUIProject/setup-xcode@v2
51+
with:
52+
xcode-version: ${{ matrix.xcode-version }}
53+
- name: Set up mise
54+
uses: jdx/mise-action@v2
55+
with:
56+
install: false
57+
cache: false
58+
- name: Set up Tuist cache
59+
run: |
60+
source Scripts/Tuist/common.sh
61+
tuist_ci_setup
62+
shell: bash
63+
- name: Generate workspace with Compute
64+
run: Scripts/setup.sh --compute
65+
shell: bash
66+
- name: Build OpenAttributeGraphShims with Compute
67+
run: |
68+
source Scripts/Tuist/common.sh
69+
tuist_xcodebuild \
70+
"${RUNNER_TEMP:-/tmp}/openattributegraph-compute-tuist-macos-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT:-0}.xcresult" \
71+
build \
72+
-workspace OpenAttributeGraph.xcworkspace \
73+
-scheme OpenAttributeGraphShims \
74+
-configuration Debug \
75+
-destination "platform=macOS" \
76+
-derivedDataPath .build-tuist-compute \
77+
CODE_SIGNING_ALLOWED=NO
78+
shell: bash
79+
3280
compute_macos_build:
3381
name: Build with Compute (binary) on macOS
3482
strategy:

‎Configs/Common.xcconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx xros xrsimulator
1313
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES
1414
TARGETED_DEVICE_FAMILY = 1,2,7
1515
SDKROOT = auto
16+
ONLY_ACTIVE_ARCH[config=Debug] = YES
1617

1718
// MARK: - C/C++ Language
1819

‎Example/Project.swift‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import ProjectDescription
22

3+
let openAttributeGraphModuleSearchSettings: SettingsDictionary = [
4+
"LD_RUNPATH_SEARCH_PATHS": "$(inherited) @loader_path",
5+
"SWIFT_INCLUDE_PATHS": "$(inherited) $(SRCROOT)/../Sources/OpenAttributeGraphCxx/include",
6+
]
7+
38
let project = Project(
49
name: "Example",
510
targets: [
@@ -12,8 +17,9 @@ let project = Project(
1217
sources: ["Sources/**"],
1318
dependencies: [
1419
.sdk(name: "c++", type: .library),
15-
.external(name: "OpenAttributeGraph"),
16-
]
20+
.project(target: "OpenAttributeGraph", path: ".."),
21+
],
22+
settings: .settings(base: openAttributeGraphModuleSearchSettings)
1723
),
1824
]
1925
)

‎Example/Tuist.swift‎

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

‎Example/Tuist/Package.resolved‎

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

‎Example/Tuist/Package.swift‎

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

‎Example/mise.toml‎

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

‎Example/setup.sh‎

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

‎Project.swift‎

Lines changed: 145 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,110 @@ import ProjectDescription
33
// MARK: - Constants
44

55
let destinations: Destinations = [.iPhone, .iPad, .mac, .appleVision]
6+
let useComputeBackend = Environment.openattributegraphCompute.getBoolean(default: false)
7+
let platformTargetName = "OpenAttributeGraphPlatform"
8+
let utilitiesTargetName = "OpenAttributeGraphUtilities"
9+
let commonConfigurations: [Configuration] = [
10+
.debug(name: "Debug", xcconfig: "Configs/Common.xcconfig"),
11+
.release(name: "Release", xcconfig: "Configs/Common.xcconfig"),
12+
]
13+
let nativeHeaderSearchSettings: SettingsDictionary = [
14+
"HEADER_SEARCH_PATHS": "$(inherited) $(SRCROOT)/Sources/Platform/include $(SRCROOT)/Sources/Utilities/include $(SRCROOT)/Sources/OpenAttributeGraphCxx/include",
15+
"USER_HEADER_SEARCH_PATHS": "$(inherited) $(SRCROOT)/Sources/OpenAttributeGraphCxx",
16+
]
17+
let cxxInteropSettings: SettingsDictionary = [
18+
"GCC_PREPROCESSOR_DEFINITIONS": "$(inherited) SWIFT_TESTING=1",
19+
"OTHER_SWIFT_FLAGS": "$(inherited) -cxx-interoperability-mode=default -Xcc -std=c++20",
20+
"SWIFT_INCLUDE_PATHS": "$(inherited) $(SRCROOT)/Sources/Platform/include $(SRCROOT)/Sources/Utilities/include $(SRCROOT)/Sources/OpenAttributeGraphCxx/include",
21+
]
22+
let openAttributeGraphShimsDependencies: [TargetDependency] = useComputeBackend
23+
? [
24+
.external(name: "Compute"),
25+
.sdk(name: "c++", type: .library),
26+
.sdk(name: "Demangle", type: .swiftLibrary),
27+
]
28+
: [
29+
.target(name: "OpenAttributeGraph"),
30+
]
31+
let openAttributeGraphShimsSettings: SettingsDictionary = useComputeBackend
32+
? [
33+
"SWIFT_ACTIVE_COMPILATION_CONDITIONS": "$(inherited) OPENATTRIBUTEGRAPH_COMPUTE",
34+
]
35+
: [:]
36+
37+
func commonSettings(base: SettingsDictionary = [:]) -> Settings {
38+
.settings(
39+
base: base,
40+
configurations: commonConfigurations,
41+
defaultSettings: .none
42+
)
43+
}
644

745
// MARK: - Project
846

947
let project = Project(
1048
name: "OpenAttributeGraph",
1149
settings: .settings(
12-
configurations: [
13-
.debug(name: "Debug", xcconfig: "Configs/Common.xcconfig"),
14-
.release(name: "Release", xcconfig: "Configs/Common.xcconfig"),
15-
],
50+
configurations: commonConfigurations,
1651
defaultSettings: .none
1752
),
1853
targets: [
54+
.target(
55+
name: platformTargetName,
56+
destinations: destinations,
57+
product: .staticLibrary,
58+
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph.Platform",
59+
sources: ["Sources/Platform/**/*.c"],
60+
headers: .headers(public: ["Sources/Platform/include/platform/**"]),
61+
settings: commonSettings(base: nativeHeaderSearchSettings)
62+
),
63+
.target(
64+
name: utilitiesTargetName,
65+
destinations: destinations,
66+
product: .staticLibrary,
67+
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph.Utilities",
68+
sources: ["Sources/Utilities/**/*.cpp"],
69+
headers: .headers(public: ["Sources/Utilities/include/Utilities/**"]),
70+
dependencies: [
71+
.target(name: platformTargetName),
72+
],
73+
settings: commonSettings(
74+
base: nativeHeaderSearchSettings.merging([
75+
"PRODUCT_MODULE_NAME": "Utilities",
76+
])
77+
)
78+
),
79+
.target(
80+
name: "OpenAttributeGraphCxx",
81+
destinations: destinations,
82+
product: .staticLibrary,
83+
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph.Cxx",
84+
sources: [
85+
"Sources/OpenAttributeGraphCxx/**/*.c",
86+
"Sources/OpenAttributeGraphCxx/**/*.cpp",
87+
"Sources/OpenAttributeGraphCxx/**/*.mm",
88+
],
89+
headers: .headers(
90+
public: [
91+
"Sources/OpenAttributeGraphCxx/include/OpenAttributeGraph/**",
92+
"Sources/OpenAttributeGraphCxx/include/OpenAttributeGraphCxx/**",
93+
]
94+
),
95+
dependencies: [
96+
.target(name: platformTargetName),
97+
.target(name: utilitiesTargetName),
98+
.sdk(name: "z", type: .library),
99+
],
100+
settings: commonSettings(base: nativeHeaderSearchSettings)
101+
),
19102
.target(
20103
name: "OpenAttributeGraph",
21104
destinations: destinations,
22105
product: .framework,
23106
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph",
24107
sources: [
25-
"Sources/Platform/**",
26-
"Sources/Utilities/**",
27-
"Sources/OpenAttributeGraphCxx/**",
28108
"Sources/OpenAttributeGraph/**",
29109
],
30-
headers: .headers(
31-
project: [
32-
"Sources/OpenAttributeGraphCxx/include/**",
33-
"Sources/Platform/include/**",
34-
"Sources/Utilities/include/**",
35-
]
36-
),
37110
scripts: [
38111
.pre(
39112
path: "Scripts/Xcode/process_headers.sh",
@@ -51,11 +124,13 @@ let project = Project(
51124
),
52125
],
53126
dependencies: [
54-
.sdk(name: "z", type: .library),
127+
.target(name: "OpenAttributeGraphCxx"),
128+
.sdk(name: "c++", type: .library),
55129
],
56130
settings: .settings(
57131
base: [
58132
"DEFINES_MODULE": "NO",
133+
"OTHER_LDFLAGS": "$(inherited) -force_load $(BUILT_PRODUCTS_DIR)/libOpenAttributeGraphCxx.a",
59134
],
60135
configurations: [
61136
.debug(name: "Debug", xcconfig: "Configs/OpenAttributeGraph.xcconfig"),
@@ -64,5 +139,60 @@ let project = Project(
64139
defaultSettings: .none
65140
)
66141
),
142+
.target(
143+
name: "OpenAttributeGraphShims",
144+
destinations: destinations,
145+
product: .staticFramework,
146+
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph.Shims",
147+
sources: ["Sources/OpenAttributeGraphShims/**"],
148+
dependencies: openAttributeGraphShimsDependencies,
149+
settings: commonSettings(base: openAttributeGraphShimsSettings)
150+
),
151+
.target(
152+
name: "UtilitiesTests",
153+
destinations: destinations,
154+
product: .unitTests,
155+
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph.UtilitiesTests",
156+
sources: ["Tests/UtilitiesTests/**/*.swift"],
157+
dependencies: [
158+
.target(name: utilitiesTargetName),
159+
],
160+
settings: commonSettings(base: cxxInteropSettings)
161+
),
162+
.target(
163+
name: "OpenAttributeGraphCxxTests",
164+
destinations: destinations,
165+
product: .unitTests,
166+
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph.CxxTests",
167+
sources: ["Tests/OpenAttributeGraphCxxTests/**/*.swift"],
168+
dependencies: [
169+
.target(name: "OpenAttributeGraphCxx"),
170+
],
171+
settings: commonSettings(base: cxxInteropSettings)
172+
),
173+
.target(
174+
name: "OpenAttributeGraphShimsTests",
175+
destinations: destinations,
176+
product: .unitTests,
177+
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph.ShimsTests",
178+
sources: ["Tests/OpenAttributeGraphShimsTests/**/*.swift"],
179+
dependencies: [
180+
.target(name: "OpenAttributeGraphShims"),
181+
],
182+
settings: commonSettings()
183+
),
184+
.target(
185+
name: "OpenAttributeGraphCompatibilityTests",
186+
destinations: destinations,
187+
product: .unitTests,
188+
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph.CompatibilityTests",
189+
sources: ["Tests/OpenAttributeGraphCompatibilityTests/**/*.swift"],
190+
dependencies: [
191+
.target(name: "OpenAttributeGraph"),
192+
.external(name: "Numerics"),
193+
.external(name: "RealModule"),
194+
],
195+
settings: commonSettings()
196+
),
67197
]
68198
)

‎README.md‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,31 @@ git submodule update --init
7373
### Xcode (via Tuist)
7474

7575
This project uses [Tuist](https://tuist.dev) to generate the Xcode project for framework builds.
76+
The root workspace contains separate `OpenAttributeGraph` and `Example` projects.
77+
The root `Package.swift` defines the public SwiftPM package, while `Tuist/Package.swift` defines
78+
the external dependencies used only by the generated workspace.
7679

77-
1. Install Tuist (if not already installed):
80+
1. Run the root setup script. It installs the pinned Tuist version from the root `mise.toml` and generates the workspace:
7881
```shell
79-
# via mise
80-
mise install tuist
81-
# or via Homebrew
82-
brew install tuist
82+
Scripts/setup.sh
8383
```
8484

85-
2. Generate the Xcode project:
85+
By default, `OpenAttributeGraphShims` embeds the local `OpenAttributeGraph` implementation.
86+
To use the source Compute package instead, select the environment from `mise.compute.toml`:
8687
```shell
87-
tuist generate
88+
Scripts/setup.sh --compute
8889
```
8990

90-
3. Build using the generated workspace:
91+
2. Build using the generated workspace:
9192
```shell
9293
xcodebuild build -workspace OpenAttributeGraph.xcworkspace -scheme OpenAttributeGraph -destination 'generic/platform=iOS Simulator'
9394
```
9495

96+
To verify the Compute-backed shims generated by `--compute`:
97+
```shell
98+
xcodebuild build -workspace OpenAttributeGraph.xcworkspace -scheme OpenAttributeGraphShims -destination 'platform=macOS'
99+
```
100+
95101
## License
96102

97103
See LICENSE file - MIT

0 commit comments

Comments
 (0)