From c7f94cc8ec3f670c970072e5a465518db1ed99c2 Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 26 Mar 2026 01:28:11 +0800 Subject: [PATCH 1/4] Add Tuist support for project generation - Add root Project.swift replacing hand-maintained xcodeproj - Add Tuist.swift and .mise.toml (pins tuist 4.115.1) - Add Example/ with minimal commandLine app consuming OpenAttributeGraph - Update build_xcframework.sh to use tuist generate - Update .gitignore for Tuist-generated files --- .gitignore | 4 ++ .mise.toml | 2 + Example/.gitignore | 6 +++ Example/Project.swift | 18 +++++++++ Example/Sources/main.swift | 4 ++ Example/Tuist.swift | 3 ++ Example/Tuist/Package.swift | 10 +++++ Project.swift | 72 ++++++++++++++++++++++++++++++++++++ Scripts/build_xcframework.sh | 15 ++++++-- Tuist.swift | 3 ++ 10 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 .mise.toml create mode 100644 Example/.gitignore create mode 100644 Example/Project.swift create mode 100644 Example/Sources/main.swift create mode 100644 Example/Tuist.swift create mode 100644 Example/Tuist/Package.swift create mode 100644 Project.swift create mode 100644 Tuist.swift diff --git a/.gitignore b/.gitignore index 13cac52..9f57ebe 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,8 @@ Checkouts/* build/ .ag_repo/ .oag_repo/ +## Tuist generated files +*.xcodeproj +*.xcworkspace +Derived/ .claude diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 0000000..d8a4370 --- /dev/null +++ b/.mise.toml @@ -0,0 +1,2 @@ +[tools] +tuist = "4.115.1" diff --git a/Example/.gitignore b/Example/.gitignore new file mode 100644 index 0000000..ffa2309 --- /dev/null +++ b/Example/.gitignore @@ -0,0 +1,6 @@ +## Tuist generated files +*.xcodeproj +*.xcworkspace +Derived/ +build/ +.build diff --git a/Example/Project.swift b/Example/Project.swift new file mode 100644 index 0000000..6849a3a --- /dev/null +++ b/Example/Project.swift @@ -0,0 +1,18 @@ +import ProjectDescription + +let project = Project( + name: "Example", + targets: [ + .target( + name: "Example", + destinations: [.mac], + product: .commandLineTool, + bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph.Example", + deploymentTargets: .macOS("15.0"), + sources: ["Sources/**"], + dependencies: [ + .external(name: "OpenAttributeGraph"), + ] + ), + ] +) diff --git a/Example/Sources/main.swift b/Example/Sources/main.swift new file mode 100644 index 0000000..2ed4c8d --- /dev/null +++ b/Example/Sources/main.swift @@ -0,0 +1,4 @@ +import OpenAttributeGraph + +let _ = Graph() +print("OpenAttributeGraph Example: Graph created successfully") diff --git a/Example/Tuist.swift b/Example/Tuist.swift new file mode 100644 index 0000000..ff8e64f --- /dev/null +++ b/Example/Tuist.swift @@ -0,0 +1,3 @@ +import ProjectDescription + +let config = Config() diff --git a/Example/Tuist/Package.swift b/Example/Tuist/Package.swift new file mode 100644 index 0000000..4723307 --- /dev/null +++ b/Example/Tuist/Package.swift @@ -0,0 +1,10 @@ +// swift-tools-version: 6.1 + +import PackageDescription + +let package = Package( + name: "ExampleDependencies", + dependencies: [ + .package(path: "../../"), + ] +) diff --git a/Project.swift b/Project.swift new file mode 100644 index 0000000..7b3c277 --- /dev/null +++ b/Project.swift @@ -0,0 +1,72 @@ +import ProjectDescription + +// MARK: - Process Headers Script + +let processHeadersScript: TargetScript = .pre( + script: """ + Scripts/Xcode/process_headers.sh + """, + name: "Process Headers", + inputFileListPaths: [ + "Scripts/Xcode/process_headers_inputs.xcfilelist", + ], + outputFileListPaths: [ + "Scripts/Xcode/process_headers_outputs.xcfilelist", + ] +) + +// MARK: - Project + +let project = Project( + name: "OpenAttributeGraph", + settings: .settings( + configurations: [ + .debug(name: .debug, xcconfig: "Configs/Common.xcconfig"), + .release(name: .release, xcconfig: "Configs/Common.xcconfig"), + ] + ), + targets: [ + .target( + name: "OpenAttributeGraph", + destinations: [.iPhone, .iPad, .mac, .appleVision], + product: .framework, + bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph", + deploymentTargets: .multiplatform( + iOS: "18.0", + macOS: "15.0", + visionOS: "2.0" + ), + sources: .sourceFilesList(globs: [ + .glob( + "Sources/Platform/**", + excluding: ["Sources/Platform/README.md"] + ), + .glob( + "Sources/Utilities/**", + excluding: [ + "Sources/Utilities/README.md", + "Sources/Utilities/include/SwiftBridging/README.md", + ] + ), + .glob( + "Sources/OpenAttributeGraphCxx/**", + excluding: [ + "Sources/OpenAttributeGraphCxx/include/OpenAttributeGraphCxx/Vector/vector.tpp", + "Sources/OpenAttributeGraphCxx/include/SwiftBridging/README.md", + ] + ), + "Sources/OpenAttributeGraph/**", + ]), + scripts: [processHeadersScript], + dependencies: [ + .sdk(name: "libz", type: .library), + ], + settings: .settings( + configurations: [ + .debug(name: .debug, xcconfig: "Configs/OpenAttributeGraph.xcconfig"), + .release(name: .release, xcconfig: "Configs/OpenAttributeGraph.xcconfig"), + ] + ) + ), + ] +) diff --git a/Scripts/build_xcframework.sh b/Scripts/build_xcframework.sh index a2d87d5..603ded8 100755 --- a/Scripts/build_xcframework.sh +++ b/Scripts/build_xcframework.sh @@ -8,6 +8,13 @@ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" BUILD_DIR="$PROJECT_ROOT/.build/Xcode" SCHEME="OpenAttributeGraph" +# Generate Xcode project via Tuist +pushd "$PROJECT_ROOT" > /dev/null +tuist generate --no-open +popd > /dev/null + +XCODEPROJ="$PROJECT_ROOT/OpenAttributeGraph.xcodeproj" + # Copy and modify modulemap for framework distribution mkdir -p "$BUILD_DIR/Archives" "$BUILD_DIR/Frameworks" cat > "$BUILD_DIR/module.modulemap" << 'EOF' @@ -34,23 +41,23 @@ done echo "Building xcframework for $SCHEME (debug info: $DEBUG_INFO)" -# Archive for each platform using the xcodeproj +# Archive for each platform using the Tuist-generated xcodeproj xcodebuild archive \ - -project "$PROJECT_ROOT/OpenAttributeGraph.xcodeproj" \ + -project "$XCODEPROJ" \ -scheme "$SCHEME" \ -destination "generic/platform=macOS" \ -archivePath "$BUILD_DIR/Archives/$SCHEME-macOS.xcarchive" \ ENABLE_USER_SCRIPT_SANDBOXING=NO xcodebuild archive \ - -project "$PROJECT_ROOT/OpenAttributeGraph.xcodeproj" \ + -project "$XCODEPROJ" \ -scheme "$SCHEME" \ -destination "generic/platform=iOS" \ -archivePath "$BUILD_DIR/Archives/$SCHEME-iOS.xcarchive" \ ENABLE_USER_SCRIPT_SANDBOXING=NO xcodebuild archive \ - -project "$PROJECT_ROOT/OpenAttributeGraph.xcodeproj" \ + -project "$XCODEPROJ" \ -scheme "$SCHEME" \ -destination "generic/platform=iOS Simulator" \ -archivePath "$BUILD_DIR/Archives/$SCHEME-iOS-Simulator.xcarchive" \ diff --git a/Tuist.swift b/Tuist.swift new file mode 100644 index 0000000..ff8e64f --- /dev/null +++ b/Tuist.swift @@ -0,0 +1,3 @@ +import ProjectDescription + +let config = Config() From a8be65e1c69ab4d64a0f952d7803e01b84d6ec97 Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 26 Mar 2026 01:28:53 +0800 Subject: [PATCH 2/4] Remove hand-maintained OpenAttributeGraph.xcodeproj Replaced by Tuist project generation via Project.swift. --- OpenAttributeGraph.xcodeproj/project.pbxproj | 343 ------------------ .../contents.xcworkspacedata | 7 - 2 files changed, 350 deletions(-) delete mode 100644 OpenAttributeGraph.xcodeproj/project.pbxproj delete mode 100644 OpenAttributeGraph.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/OpenAttributeGraph.xcodeproj/project.pbxproj b/OpenAttributeGraph.xcodeproj/project.pbxproj deleted file mode 100644 index 4fab947..0000000 --- a/OpenAttributeGraph.xcodeproj/project.pbxproj +++ /dev/null @@ -1,343 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 77; - objects = { - -/* Begin PBXBuildFile section */ - OAG0000010000000000000001 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = OAG0000020000000000000001 /* libz.tbd */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - OAG0000020000000000000001 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; - OAG0000030000000000000001 /* OpenAttributeGraph.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OpenAttributeGraph.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - OAG00000C0000000000000001 /* Common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = ""; }; - OAG00000C0000000000000002 /* OpenAttributeGraph.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = OpenAttributeGraph.xcconfig; sourceTree = ""; }; - OAG00000C0000000000000003 /* OpenAttributeGraphTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = OpenAttributeGraphTests.xcconfig; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ - 277F10582F4EF9460061C27D /* Exceptions for "OpenAttributeGraphCxx" folder in "OpenAttributeGraph" target */ = { - isa = PBXFileSystemSynchronizedBuildFileExceptionSet; - membershipExceptions = ( - include/OpenAttributeGraphCxx/Vector/vector.tpp, - include/SwiftBridging/README.md, - ); - target = OAG0000080000000000000001 /* OpenAttributeGraph */; - }; - OAG00000D0000000000000001 /* Exceptions for "Platform" folder in "OpenAttributeGraph" target */ = { - isa = PBXFileSystemSynchronizedBuildFileExceptionSet; - membershipExceptions = ( - README.md, - ); - target = OAG0000080000000000000001 /* OpenAttributeGraph */; - }; - OAG00000D0000000000000002 /* Exceptions for "Utilities" folder in "OpenAttributeGraph" target */ = { - isa = PBXFileSystemSynchronizedBuildFileExceptionSet; - membershipExceptions = ( - include/SwiftBridging/README.md, - README.md, - ); - target = OAG0000080000000000000001 /* OpenAttributeGraph */; - }; -/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ - -/* Begin PBXFileSystemSynchronizedRootGroup section */ - OAG0000040000000000000001 /* Platform */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - OAG00000D0000000000000001 /* Exceptions for "Platform" folder in "OpenAttributeGraph" target */, - ); - name = Platform; - path = Sources/Platform; - sourceTree = ""; - }; - OAG0000040000000000000002 /* Utilities */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - OAG00000D0000000000000002 /* Exceptions for "Utilities" folder in "OpenAttributeGraph" target */, - ); - name = Utilities; - path = Sources/Utilities; - sourceTree = ""; - }; - OAG0000040000000000000003 /* OpenAttributeGraphCxx */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - 277F10582F4EF9460061C27D /* Exceptions for "OpenAttributeGraphCxx" folder in "OpenAttributeGraph" target */, - ); - name = OpenAttributeGraphCxx; - path = Sources/OpenAttributeGraphCxx; - sourceTree = ""; - }; - OAG0000040000000000000004 /* OpenAttributeGraph */ = { - isa = PBXFileSystemSynchronizedRootGroup; - name = OpenAttributeGraph; - path = Sources/OpenAttributeGraph; - sourceTree = ""; - }; -/* End PBXFileSystemSynchronizedRootGroup section */ - -/* Begin PBXFrameworksBuildPhase section */ - OAG0000050000000000000001 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - OAG0000010000000000000001 /* libz.tbd in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - OAG0000060000000000000001 = { - isa = PBXGroup; - children = ( - OAG0000040000000000000001 /* Platform */, - OAG0000040000000000000002 /* Utilities */, - OAG0000040000000000000003 /* OpenAttributeGraphCxx */, - OAG0000040000000000000004 /* OpenAttributeGraph */, - OAG00000B0000000000000001 /* Configs */, - OAG0000060000000000000003 /* Frameworks */, - OAG0000060000000000000002 /* Products */, - ); - sourceTree = ""; - }; - OAG0000060000000000000002 /* Products */ = { - isa = PBXGroup; - children = ( - OAG0000030000000000000001 /* OpenAttributeGraph.framework */, - ); - name = Products; - sourceTree = ""; - }; - OAG0000060000000000000003 /* Frameworks */ = { - isa = PBXGroup; - children = ( - OAG0000020000000000000001 /* libz.tbd */, - ); - name = Frameworks; - sourceTree = ""; - }; - OAG00000B0000000000000001 /* Configs */ = { - isa = PBXGroup; - children = ( - OAG00000C0000000000000001 /* Common.xcconfig */, - OAG00000C0000000000000002 /* OpenAttributeGraph.xcconfig */, - OAG00000C0000000000000003 /* OpenAttributeGraphTests.xcconfig */, - ); - path = Configs; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - OAG0000070000000000000001 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - OAG0000080000000000000001 /* OpenAttributeGraph */ = { - isa = PBXNativeTarget; - buildConfigurationList = OAG000009000000000000000A /* Build configuration list for PBXNativeTarget "OpenAttributeGraph" */; - buildPhases = ( - OAG0000070000000000000001 /* Headers */, - OAG00000A0000000000000001 /* Process Headers */, - OAG0000050000000000000002 /* Sources */, - OAG0000050000000000000001 /* Frameworks */, - OAG0000050000000000000003 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - fileSystemSynchronizedGroups = ( - OAG0000040000000000000001 /* Platform */, - OAG0000040000000000000002 /* Utilities */, - OAG0000040000000000000003 /* OpenAttributeGraphCxx */, - OAG0000040000000000000004 /* OpenAttributeGraph */, - ); - name = OpenAttributeGraph; - packageProductDependencies = ( - ); - productName = OpenAttributeGraph; - productReference = OAG0000030000000000000001 /* OpenAttributeGraph.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - OAG0000060000000000000000 /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = 1; - LastUpgradeCheck = 1640; - TargetAttributes = { - OAG0000080000000000000001 = { - CreatedOnToolsVersion = 16.4; - }; - }; - }; - buildConfigurationList = OAG0000090000000000000001 /* Build configuration list for PBXProject "OpenAttributeGraph" */; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = OAG0000060000000000000001; - minimizedProjectReferenceProxies = 1; - preferredProjectObjectVersion = 77; - productRefGroup = OAG0000060000000000000002 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - OAG0000080000000000000001 /* OpenAttributeGraph */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - OAG0000050000000000000003 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - OAG00000A0000000000000001 /* Process Headers */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "$(SRCROOT)/Scripts/Xcode/process_headers_inputs.xcfilelist", - ); - inputPaths = ( - "$(SRCROOT)/Scripts/Xcode/process_headers.sh", - ); - name = "Process Headers"; - outputFileListPaths = ( - "$(SRCROOT)/Scripts/Xcode/process_headers_outputs.xcfilelist", - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nScripts/Xcode/process_headers.sh\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - OAG0000050000000000000002 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - OAG0000090000000000000002 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = OAG00000C0000000000000001 /* Common.xcconfig */; - buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - OAG0000090000000000000003 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = OAG00000C0000000000000001 /* Common.xcconfig */; - buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_NO_COMMON_BLOCKS = YES; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SWIFT_COMPILATION_MODE = wholemodule; - }; - name = Release; - }; - OAG0000090000000000000004 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = OAG00000C0000000000000002 /* OpenAttributeGraph.xcconfig */; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - LD_RUNPATH_SEARCH_PATHS = ( - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = ( - "@executable_path/../Frameworks", - "@loader_path/Frameworks", - ); - }; - name = Debug; - }; - OAG0000090000000000000005 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = OAG00000C0000000000000002 /* OpenAttributeGraph.xcconfig */; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - LD_RUNPATH_SEARCH_PATHS = ( - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = ( - "@executable_path/../Frameworks", - "@loader_path/Frameworks", - ); - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - OAG0000090000000000000001 /* Build configuration list for PBXProject "OpenAttributeGraph" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - OAG0000090000000000000002 /* Debug */, - OAG0000090000000000000003 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - OAG000009000000000000000A /* Build configuration list for PBXNativeTarget "OpenAttributeGraph" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - OAG0000090000000000000004 /* Debug */, - OAG0000090000000000000005 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = OAG0000060000000000000000 /* Project object */; -} diff --git a/OpenAttributeGraph.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/OpenAttributeGraph.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/OpenAttributeGraph.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - From e244b769723b9c674085a2dca3f84fa482760845 Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 26 Mar 2026 01:36:51 +0800 Subject: [PATCH 3/4] Fix Tuist Project.swift build issues - Fix libz SDK dependency name (use "z" not "libz" to avoid double prefix) - Add GCC_TREAT_WARNINGS_AS_ERRORS=NO and DEFINES_MODULE=NO overrides - Fix missing return in GraphDescription.cpp when OAG_OBJC_FOUNDATION=0 --- Project.swift | 9 ++++++++- Sources/OpenAttributeGraphCxx/Graph/GraphDescription.cpp | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Project.swift b/Project.swift index 7b3c277..db4d63d 100644 --- a/Project.swift +++ b/Project.swift @@ -20,6 +20,9 @@ let processHeadersScript: TargetScript = .pre( let project = Project( name: "OpenAttributeGraph", settings: .settings( + base: [ + "GCC_TREAT_WARNINGS_AS_ERRORS": "NO", + ], configurations: [ .debug(name: .debug, xcconfig: "Configs/Common.xcconfig"), .release(name: .release, xcconfig: "Configs/Common.xcconfig"), @@ -59,9 +62,13 @@ let project = Project( ]), scripts: [processHeadersScript], dependencies: [ - .sdk(name: "libz", type: .library), + .sdk(name: "z", type: .library), ], settings: .settings( + base: [ + "GCC_TREAT_WARNINGS_AS_ERRORS": "NO", + "DEFINES_MODULE": "NO", + ], configurations: [ .debug(name: .debug, xcconfig: "Configs/OpenAttributeGraph.xcconfig"), .release(name: .release, xcconfig: "Configs/OpenAttributeGraph.xcconfig"), diff --git a/Sources/OpenAttributeGraphCxx/Graph/GraphDescription.cpp b/Sources/OpenAttributeGraphCxx/Graph/GraphDescription.cpp index 5fc6146..280223c 100644 --- a/Sources/OpenAttributeGraphCxx/Graph/GraphDescription.cpp +++ b/Sources/OpenAttributeGraphCxx/Graph/GraphDescription.cpp @@ -16,6 +16,8 @@ CFTypeRef OAGGraphDescription(OAGGraphRef graph, CFDictionaryRef options) { OAG::precondition_failure("invalidated graph"); } return OAG::Graph::description(&graph->context.get_graph(), (__bridge NSDictionary*)options); + #else + return nullptr; #endif } From 22af58ded7a814989a07d16d9683f57d6f21ea1d Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 26 Mar 2026 01:44:43 +0800 Subject: [PATCH 4/4] Align Tuist setup with remote branch best practices - Use Tuist 4.x API (Tuist struct) instead of deprecated Config() - Add defaultSettings: .none to let xcconfigs drive all build settings - Add Tuist/Package.swift for Tuist 4.x external dependency support - Add explicit headers configuration for project headers - Use .pre(path:) script API with explicit input/output paths - Rename .mise.toml to mise.toml, update to tuist 4.156.0 - Add Tuist/.build/ and *.xcframework to .gitignore - Add "Xcode (via Tuist)" section to README.md - Update Example/Tuist.swift to Tuist 4.x API --- .gitignore | 9 +++-- .mise.toml | 2 -- Example/Tuist.swift | 4 ++- Project.swift | 85 ++++++++++++++++++++------------------------- README.md | 22 ++++++++++++ Tuist.swift | 4 ++- Tuist/Package.swift | 15 ++++++++ mise.toml | 2 ++ 8 files changed, 88 insertions(+), 55 deletions(-) delete mode 100644 .mise.toml create mode 100644 Tuist/Package.swift create mode 100644 mise.toml diff --git a/.gitignore b/.gitignore index 9f57ebe..32b12e5 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,11 @@ Checkouts/* build/ .ag_repo/ .oag_repo/ -## Tuist generated files +.claude + +# Tuist +Derived/ +Tuist/.build/ *.xcodeproj *.xcworkspace -Derived/ -.claude +*.xcframework diff --git a/.mise.toml b/.mise.toml deleted file mode 100644 index d8a4370..0000000 --- a/.mise.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tools] -tuist = "4.115.1" diff --git a/Example/Tuist.swift b/Example/Tuist.swift index ff8e64f..abf9ffd 100644 --- a/Example/Tuist.swift +++ b/Example/Tuist.swift @@ -1,3 +1,5 @@ import ProjectDescription -let config = Config() +let tuist = Tuist( + project: .tuist() +) diff --git a/Project.swift b/Project.swift index db4d63d..b7065df 100644 --- a/Project.swift +++ b/Project.swift @@ -1,78 +1,67 @@ import ProjectDescription -// MARK: - Process Headers Script +// MARK: - Constants -let processHeadersScript: TargetScript = .pre( - script: """ - Scripts/Xcode/process_headers.sh - """, - name: "Process Headers", - inputFileListPaths: [ - "Scripts/Xcode/process_headers_inputs.xcfilelist", - ], - outputFileListPaths: [ - "Scripts/Xcode/process_headers_outputs.xcfilelist", - ] -) +let destinations: Destinations = [.iPhone, .iPad, .mac, .appleVision] // MARK: - Project let project = Project( name: "OpenAttributeGraph", settings: .settings( - base: [ - "GCC_TREAT_WARNINGS_AS_ERRORS": "NO", - ], configurations: [ - .debug(name: .debug, xcconfig: "Configs/Common.xcconfig"), - .release(name: .release, xcconfig: "Configs/Common.xcconfig"), - ] + .debug(name: "Debug", xcconfig: "Configs/Common.xcconfig"), + .release(name: "Release", xcconfig: "Configs/Common.xcconfig"), + ], + defaultSettings: .none ), targets: [ .target( name: "OpenAttributeGraph", - destinations: [.iPhone, .iPad, .mac, .appleVision], + destinations: destinations, product: .framework, bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph", - deploymentTargets: .multiplatform( - iOS: "18.0", - macOS: "15.0", - visionOS: "2.0" + sources: [ + "Sources/Platform/**", + "Sources/Utilities/**", + "Sources/OpenAttributeGraphCxx/**", + "Sources/OpenAttributeGraph/**", + ], + headers: .headers( + project: [ + "Sources/OpenAttributeGraphCxx/include/**", + "Sources/Platform/include/**", + "Sources/Utilities/include/**", + ] ), - sources: .sourceFilesList(globs: [ - .glob( - "Sources/Platform/**", - excluding: ["Sources/Platform/README.md"] - ), - .glob( - "Sources/Utilities/**", - excluding: [ - "Sources/Utilities/README.md", - "Sources/Utilities/include/SwiftBridging/README.md", - ] - ), - .glob( - "Sources/OpenAttributeGraphCxx/**", - excluding: [ - "Sources/OpenAttributeGraphCxx/include/OpenAttributeGraphCxx/Vector/vector.tpp", - "Sources/OpenAttributeGraphCxx/include/SwiftBridging/README.md", + scripts: [ + .pre( + path: "Scripts/Xcode/process_headers.sh", + name: "Process Headers", + inputPaths: [ + "$(SRCROOT)/Scripts/Xcode/process_headers.sh", + ], + inputFileListPaths: [ + "Scripts/Xcode/process_headers_inputs.xcfilelist", + ], + outputPaths: [], + outputFileListPaths: [ + "Scripts/Xcode/process_headers_outputs.xcfilelist", ] ), - "Sources/OpenAttributeGraph/**", - ]), - scripts: [processHeadersScript], + ], dependencies: [ .sdk(name: "z", type: .library), ], settings: .settings( base: [ - "GCC_TREAT_WARNINGS_AS_ERRORS": "NO", "DEFINES_MODULE": "NO", ], configurations: [ - .debug(name: .debug, xcconfig: "Configs/OpenAttributeGraph.xcconfig"), - .release(name: .release, xcconfig: "Configs/OpenAttributeGraph.xcconfig"), - ] + .debug(name: "Debug", xcconfig: "Configs/OpenAttributeGraph.xcconfig"), + .release(name: "Release", xcconfig: "Configs/OpenAttributeGraph.xcconfig"), + ], + defaultSettings: .none ) ), ] diff --git a/README.md b/README.md index 08a5ec5..d26ffd0 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,28 @@ The project requires Swift toolchain headers for compilation. They are included git submodule update --init ``` +### Xcode (via Tuist) + +This project uses [Tuist](https://tuist.dev) to generate the Xcode project for framework builds. + +1. Install Tuist (if not already installed): + ```shell + # via mise + mise install tuist + # or via Homebrew + brew install tuist + ``` + +2. Generate the Xcode project: + ```shell + tuist generate + ``` + +3. Build using the generated workspace: + ```shell + xcodebuild build -workspace OpenAttributeGraph.xcworkspace -scheme OpenAttributeGraph -destination 'generic/platform=iOS Simulator' + ``` + ## License See LICENSE file - MIT diff --git a/Tuist.swift b/Tuist.swift index ff8e64f..abf9ffd 100644 --- a/Tuist.swift +++ b/Tuist.swift @@ -1,3 +1,5 @@ import ProjectDescription -let config = Config() +let tuist = Tuist( + project: .tuist() +) diff --git a/Tuist/Package.swift b/Tuist/Package.swift new file mode 100644 index 0000000..85b0f14 --- /dev/null +++ b/Tuist/Package.swift @@ -0,0 +1,15 @@ +// swift-tools-version: 6.1 +import PackageDescription + +#if TUIST +import ProjectDescription + +let packageSettings = PackageSettings( + productTypes: [:] +) +#endif + +let package = Package( + name: "OpenAttributeGraphDeps", + dependencies: [] +) diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..82eb7c5 --- /dev/null +++ b/mise.toml @@ -0,0 +1,2 @@ +[tools] +tuist = "4.156.0"