diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index b84e54e..baaf304 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -28,6 +28,13 @@ jobs: swift-version-minor: ${{ steps.swift-version.outputs.minor }} - name: Build run: swift build + - name: Build XCFramework + run: ./Scripts/create-xcframework.sh + - name: Upload XCFramework + uses: actions/upload-artifact@v6 + with: + name: Compute.xcframework + path: .build/Xcode/Frameworks/Compute.xcframework linux-build: name: Linux diff --git a/.gitignore b/.gitignore index 307a868..1539e6a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,8 @@ .build .swiftpm +# Xcode +xcuserdata + # Dependencies Checkouts \ No newline at end of file diff --git a/Compute.xcodeproj/project.pbxproj b/Compute.xcodeproj/project.pbxproj new file mode 100644 index 0000000..46aec50 --- /dev/null +++ b/Compute.xcodeproj/project.pbxproj @@ -0,0 +1,480 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 1AEE2EA42F16D270009CBD65 /* libswiftDemangle.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AEE2EA32F16D26B009CBD65 /* libswiftDemangle.tbd */; }; + 1AEE2EA62F16D2AE009CBD65 /* libswiftCore.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AEE2EA52F16D2A7009CBD65 /* libswiftCore.tbd */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1AD6DB892F16AA0D00D4C5D6 /* Compute.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Compute.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1AEE2EA32F16D26B009CBD65 /* libswiftDemangle.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libswiftDemangle.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS26.2.sdk/usr/lib/swift/libswiftDemangle.tbd; sourceTree = DEVELOPER_DIR; }; + 1AEE2EA52F16D2A7009CBD65 /* libswiftCore.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libswiftCore.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS26.2.sdk/usr/lib/swift/libswiftCore.tbd; sourceTree = DEVELOPER_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 1AEE2D3B2F16D0BF009CBD65 /* Platform */ = { + isa = PBXFileSystemSynchronizedRootGroup; + name = Platform; + path = Sources/Platform; + sourceTree = ""; + }; + 1AEE2DA62F16D158009CBD65 /* Utilities */ = { + isa = PBXFileSystemSynchronizedRootGroup; + name = Utilities; + path = Sources/Utilities; + sourceTree = ""; + }; + 1AEE2E362F16D1DB009CBD65 /* ComputeCxx */ = { + isa = PBXFileSystemSynchronizedRootGroup; + name = ComputeCxx; + path = Sources/ComputeCxx; + sourceTree = ""; + }; + 1AEE2EA82F16D2CC009CBD65 /* ComputeCxxSwiftSupport */ = { + isa = PBXFileSystemSynchronizedRootGroup; + name = ComputeCxxSwiftSupport; + path = Sources/ComputeCxxSwiftSupport; + sourceTree = ""; + }; + 1AEE2ED32F16D309009CBD65 /* Compute */ = { + isa = PBXFileSystemSynchronizedRootGroup; + name = Compute; + path = Sources/Compute; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1AD6DB862F16AA0D00D4C5D6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1AEE2EA42F16D270009CBD65 /* libswiftDemangle.tbd in Frameworks */, + 1AEE2EA62F16D2AE009CBD65 /* libswiftCore.tbd in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1AD6DB7D2F16A95B00D4C5D6 = { + isa = PBXGroup; + children = ( + 1AEE2D3B2F16D0BF009CBD65 /* Platform */, + 1AEE2DA62F16D158009CBD65 /* Utilities */, + 1AEE2E362F16D1DB009CBD65 /* ComputeCxx */, + 1AEE2EA82F16D2CC009CBD65 /* ComputeCxxSwiftSupport */, + 1AEE2ED32F16D309009CBD65 /* Compute */, + 1AEE2EA22F16D26B009CBD65 /* Frameworks */, + 1AD6DB8A2F16AA0D00D4C5D6 /* Products */, + ); + sourceTree = ""; + }; + 1AD6DB8A2F16AA0D00D4C5D6 /* Products */ = { + isa = PBXGroup; + children = ( + 1AD6DB892F16AA0D00D4C5D6 /* Compute.framework */, + ); + name = Products; + sourceTree = ""; + }; + 1AEE2EA22F16D26B009CBD65 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1AEE2EA52F16D2A7009CBD65 /* libswiftCore.tbd */, + 1AEE2EA32F16D26B009CBD65 /* libswiftDemangle.tbd */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 1AD6DB842F16AA0D00D4C5D6 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 1AD6DB882F16AA0D00D4C5D6 /* Compute */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1AD6DB902F16AA0D00D4C5D6 /* Build configuration list for PBXNativeTarget "Compute" */; + buildPhases = ( + 1AD6DB842F16AA0D00D4C5D6 /* Headers */, + 1A628D742F1D506100C17ED9 /* Process Headers */, + 1AD6DB852F16AA0D00D4C5D6 /* Sources */, + 1AD6DB862F16AA0D00D4C5D6 /* Frameworks */, + 1AD6DB872F16AA0D00D4C5D6 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 1AEE2D3B2F16D0BF009CBD65 /* Platform */, + 1AEE2DA62F16D158009CBD65 /* Utilities */, + 1AEE2E362F16D1DB009CBD65 /* ComputeCxx */, + 1AEE2EA82F16D2CC009CBD65 /* ComputeCxxSwiftSupport */, + 1AEE2ED32F16D309009CBD65 /* Compute */, + ); + name = Compute; + packageProductDependencies = ( + ); + productName = Compute; + productReference = 1AD6DB892F16AA0D00D4C5D6 /* Compute.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 1AD6DB7E2F16A95B00D4C5D6 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 2620; + LastUpgradeCheck = 2620; + TargetAttributes = { + 1AD6DB882F16AA0D00D4C5D6 = { + CreatedOnToolsVersion = 26.2; + }; + }; + }; + buildConfigurationList = 1AD6DB812F16A95B00D4C5D6 /* Build configuration list for PBXProject "Compute" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 1AD6DB7D2F16A95B00D4C5D6; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 1AD6DB8A2F16AA0D00D4C5D6 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1AD6DB882F16AA0D00D4C5D6 /* Compute */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1AD6DB872F16AA0D00D4C5D6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 1A628D742F1D506100C17ED9 /* 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 */ + 1AD6DB852F16AA0D00D4C5D6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1AD6DB822F16A95B00D4C5D6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Debug; + }; + 1AD6DB832F16A95B00D4C5D6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Release; + }; + 1AD6DB8E2F16AA0D00D4C5D6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + GENERATE_INFOPLIST_FILE = YES; + HEADER_SEARCH_PATHS = ( + Sources/Platform/include, + Sources/Utilities/include, + Sources/ComputeCxx/include, + ); + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 26.2; + LD_RUNPATH_SEARCH_PATHS = ( + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = ( + "@executable_path/../Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 26.2; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_SWIFT_FLAGS = "-enable-experimental-feature Extern"; + PRODUCT_BUNDLE_IDENTIFIER = dev.incrematic.Compute; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = auto; + SKIP_INSTALL = NO; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_INCLUDE_PATHS = Sources/ComputeCxx/include; + SWIFT_INSTALL_MODULE = YES; + SWIFT_INSTALL_OBJC_HEADER = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 6.0; + SYSTEM_HEADER_SEARCH_PATHS = ( + Checkouts/swift/include, + Checkouts/swift/stdlib/include, + Checkouts/swift/stdlib/public/SwiftShims, + ); + TARGETED_DEVICE_FAMILY = "1,2,7"; + USER_HEADER_SEARCH_PATHS = ( + Sources/ComputeCxx, + Sources/ComputeCxx/internalInclude, + ); + USE_HEADERMAP = NO; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + XROS_DEPLOYMENT_TARGET = 26.2; + }; + name = Debug; + }; + 1AD6DB8F2F16AA0D00D4C5D6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES; + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + GENERATE_INFOPLIST_FILE = YES; + HEADER_SEARCH_PATHS = ( + Sources/Platform/include, + Sources/Utilities/include, + Sources/ComputeCxx/include, + ); + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 26.2; + LD_RUNPATH_SEARCH_PATHS = ( + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = ( + "@executable_path/../Frameworks", + "@loader_path/Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 26.2; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + OTHER_SWIFT_FLAGS = "-enable-experimental-feature Extern"; + PRODUCT_BUNDLE_IDENTIFIER = dev.incrematic.Compute; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = auto; + SKIP_INSTALL = NO; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_INCLUDE_PATHS = Sources/ComputeCxx/include; + SWIFT_INSTALL_MODULE = YES; + SWIFT_INSTALL_OBJC_HEADER = NO; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 6.0; + SYSTEM_HEADER_SEARCH_PATHS = ( + Checkouts/swift/include, + Checkouts/swift/stdlib/include, + Checkouts/swift/stdlib/public/SwiftShims, + ); + TARGETED_DEVICE_FAMILY = "1,2,7"; + USER_HEADER_SEARCH_PATHS = ( + Sources/ComputeCxx, + Sources/ComputeCxx/internalInclude, + ); + USE_HEADERMAP = NO; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + XROS_DEPLOYMENT_TARGET = 26.2; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1AD6DB812F16A95B00D4C5D6 /* Build configuration list for PBXProject "Compute" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1AD6DB822F16A95B00D4C5D6 /* Debug */, + 1AD6DB832F16A95B00D4C5D6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1AD6DB902F16AA0D00D4C5D6 /* Build configuration list for PBXNativeTarget "Compute" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1AD6DB8E2F16AA0D00D4C5D6 /* Debug */, + 1AD6DB8F2F16AA0D00D4C5D6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1AD6DB7E2F16A95B00D4C5D6 /* Project object */; +} diff --git a/Compute.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Compute.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Compute.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/README.md b/README.md index e57d103..56071dc 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,48 @@ An incremental computation library for Swift. Compute is a reimplementation of the AttributeGraph framework on Apple platforms. +## Building + +### Project setup + +This project has a dependency on the Swift language codebase, which must be +configured manually. + +1. Clone the `swiftlang/swift` repository to `Checkouts/swift`. + + From within the package directory: + + ```sh + mkdir -p Checkouts + cd Checkouts + git clone git@github.com:swiftlang/swift.git swift + ``` + +2. Write the `CMakeConfig.h` file: + + From within the Swift repository: + + ```sh + cat > include/swift/Runtime/CMakeConfig.h << EOF + #ifndef SWIFT_RUNTIME_CMAKECONFIG_H + #define SWIFT_RUNTIME_CMAKECONFIG_H + #define SWIFT_VERSION_MAJOR "6" + #define SWIFT_VERSION_MINOR "2" + #endif + EOF + ``` + +### Build as a Swift package + +```sh +swift build +``` + +### Build as a framework + +This package can also be built as a XCFramework bundle using Xcode by running +`Scripts/create-xcframework.sh`. + ## Acknowledgments Thank you to [OpenSwiftUIProject](https://github.com/OpenSwiftUIProject/OpenGraph/tree/main) diff --git a/Scripts/Resources/module.modulemap b/Scripts/Resources/module.modulemap new file mode 100644 index 0000000..dc50750 --- /dev/null +++ b/Scripts/Resources/module.modulemap @@ -0,0 +1,8 @@ +framework module Compute { + umbrella header "Compute.h" + + export * + module * { + export * + } +} diff --git a/Scripts/Xcode/process_headers.sh b/Scripts/Xcode/process_headers.sh new file mode 100755 index 0000000..95bf768 --- /dev/null +++ b/Scripts/Xcode/process_headers.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +set -e + +# Post-process headers: replace #include with #include +# Uses Xcode's SCRIPT_INPUT_FILE_LIST_* and SCRIPT_OUTPUT_FILE_LIST_* for sandbox compatibility + +if [ "$SCRIPT_INPUT_FILE_LIST_COUNT" -eq 0 ]; then + echo "error: No input file list specified" + exit 1 +fi + +if [ "$SCRIPT_OUTPUT_FILE_LIST_COUNT" -eq 0 ]; then + echo "error: No output file list specified" + exit 1 +fi + +count=0 + +# Process input and output file lists line by line +while IFS= read -r input_file <&3 && IFS= read -r output_file <&4; do + # Skip empty lines + [ -z "$input_file" ] && continue + + # Create output directory if needed + mkdir -p "$(dirname "$output_file")" + + # Replace #include with #include + sed 's|#include "$output_file" + + echo "Processed: $(basename "$input_file") -> $(basename "$output_file")" + count=$((count + 1)) +done 3< "$SCRIPT_INPUT_FILE_LIST_0" 4< "$SCRIPT_OUTPUT_FILE_LIST_0" + +echo "Processed $count headers" diff --git a/Scripts/Xcode/process_headers_inputs.xcfilelist b/Scripts/Xcode/process_headers_inputs.xcfilelist new file mode 100644 index 0000000..bde4e20 --- /dev/null +++ b/Scripts/Xcode/process_headers_inputs.xcfilelist @@ -0,0 +1,25 @@ +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGAttribute.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGAttributeInfo.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGAttributeType.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGBase.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGCachedValueOptions.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGChangedValue.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGClosure.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGComparison.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGDescription.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGGraph.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGGraphCounterQueryType.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGGraphTracing.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGInputOptions.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGSearchOptions.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGSubgraph.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGTargetConditionals.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGTraceType.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGTreeElement.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGTreeValue.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGTuple.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGType.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGUniqueID.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGValue.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/AGWeakAttribute.h +$(SRCROOT)/Sources/ComputeCxx/include/ComputeCxx/ComputeCxx.h diff --git a/Scripts/Xcode/process_headers_outputs.xcfilelist b/Scripts/Xcode/process_headers_outputs.xcfilelist new file mode 100644 index 0000000..4945767 --- /dev/null +++ b/Scripts/Xcode/process_headers_outputs.xcfilelist @@ -0,0 +1,25 @@ +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGAttribute.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGAttributeInfo.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGAttributeType.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGBase.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGCachedValueOptions.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGChangedValue.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGClosure.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGComparison.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGDescription.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGGraph.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGGraphCounterQueryType.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGGraphTracing.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGInputOptions.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGSearchOptions.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGSubgraph.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGTargetConditionals.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGTraceType.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGTreeElement.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGTreeValue.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGTuple.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGType.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGUniqueID.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGValue.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/AGWeakAttribute.h +$(BUILT_PRODUCTS_DIR)/$(PUBLIC_HEADERS_FOLDER_PATH)/Compute.h diff --git a/Scripts/create-xcframework.sh b/Scripts/create-xcframework.sh new file mode 100755 index 0000000..1a65996 --- /dev/null +++ b/Scripts/create-xcframework.sh @@ -0,0 +1,38 @@ +#!/bin/zsh + +set -e + +BUILD_DIR=".build/Xcode" + +xcodebuild archive \ + -project Compute.xcodeproj \ + -scheme Compute \ + -destination "generic/platform=macOS" \ + -archivePath "$BUILD_DIR/Archives/Compute-macOS.xcarchive" \ + ENABLE_USER_SCRIPT_SANDBOXING=NO + +rm -rf "$BUILD_DIR/Frameworks/Compute.xcframework" + +xcodebuild -create-xcframework \ + -archive "$BUILD_DIR/Archives/Compute-macOS.xcarchive" -framework Compute.framework \ + -output "$BUILD_DIR/Frameworks/Compute.xcframework" + +# Post-process swiftinterface files to replace ComputeCxx references with Compute +find "$BUILD_DIR/Frameworks/Compute.xcframework" -name "*.swiftinterface" | while read -r file; do + sed -i '' 's/ComputeCxx/Compute/g' "$file" + echo "Processed: $file" +done + +# Copy module.modulemap into each framework's Modules directory +find "$BUILD_DIR/Frameworks/Compute.xcframework" -type d -name "Modules" | while read -r modules_dir; do + cp Scripts/Resources/module.modulemap "$modules_dir/" + echo "Copied modulemap to: $modules_dir" +done + +# Fix missing Headers symlink +find "$BUILD_DIR/Frameworks/Compute.xcframework" -type d -name "Compute.framework" | while read -r framework_dir; do + if [ -d "$framework_dir/Versions" ] && [ ! -L "$framework_dir/Headers" ]; then + ln -s Versions/Current/Headers "$framework_dir/Headers" + echo "Added Headers symlink to: $framework_dir" + fi +done diff --git a/Sources/Compute/Attribute/Optional/OptionalAttribute.swift b/Sources/Compute/Attribute/Optional/OptionalAttribute.swift index 589cd61..87c9577 100644 --- a/Sources/Compute/Attribute/Optional/OptionalAttribute.swift +++ b/Sources/Compute/Attribute/Optional/OptionalAttribute.swift @@ -1,3 +1,5 @@ +import ComputeCxx + @propertyWrapper @dynamicMemberLookup public struct OptionalAttribute { diff --git a/Sources/Compute/Attribute/Rule/Focus.swift b/Sources/Compute/Attribute/Rule/Focus.swift index 09f0a7e..1047490 100644 --- a/Sources/Compute/Attribute/Rule/Focus.swift +++ b/Sources/Compute/Attribute/Rule/Focus.swift @@ -1,3 +1,5 @@ +import ComputeCxx + public struct Focus { public var root: Attribute diff --git a/Sources/Compute/Attribute/Rule/Map.swift b/Sources/Compute/Attribute/Rule/Map.swift index 440a727..b6ad5f3 100644 --- a/Sources/Compute/Attribute/Rule/Map.swift +++ b/Sources/Compute/Attribute/Rule/Map.swift @@ -1,3 +1,5 @@ +import ComputeCxx + public struct Map { public var arg: Attribute diff --git a/Sources/Compute/Attribute/RuleContext/RuleContext.swift b/Sources/Compute/Attribute/RuleContext/RuleContext.swift index b38cc5c..98a2dab 100644 --- a/Sources/Compute/Attribute/RuleContext/RuleContext.swift +++ b/Sources/Compute/Attribute/RuleContext/RuleContext.swift @@ -1,3 +1,5 @@ +import ComputeCxx + public struct RuleContext { public var attribute: Attribute diff --git a/Sources/Compute/Attribute/Weak/WeakAttribute.swift b/Sources/Compute/Attribute/Weak/WeakAttribute.swift index 1745239..08daed9 100644 --- a/Sources/Compute/Attribute/Weak/WeakAttribute.swift +++ b/Sources/Compute/Attribute/Weak/WeakAttribute.swift @@ -1,3 +1,5 @@ +import ComputeCxx + @propertyWrapper @dynamicMemberLookup public struct WeakAttribute { diff --git a/Sources/Compute/Runtime/Tuple.swift b/Sources/Compute/Runtime/Tuple.swift index 3abaa76..7799343 100644 --- a/Sources/Compute/Runtime/Tuple.swift +++ b/Sources/Compute/Runtime/Tuple.swift @@ -1,3 +1,5 @@ +import ComputeCxx + public func withUnsafeTuple( of type: TupleType, count: Int, diff --git a/Sources/ComputeCxx/include/ComputeCxx/AGBase.h b/Sources/ComputeCxx/include/ComputeCxx/AGBase.h index 748a9fb..4b86e4b 100644 --- a/Sources/ComputeCxx/include/ComputeCxx/AGBase.h +++ b/Sources/ComputeCxx/include/ComputeCxx/AGBase.h @@ -4,7 +4,7 @@ #include #include -#include "AGTargetConditionals.h" +#include #ifndef __has_include #define __has_include(x) 0 diff --git a/Sources/ComputeCxx/include/module.modulemap b/Sources/ComputeCxx/include/module.modulemap new file mode 100644 index 0000000..cf21a6c --- /dev/null +++ b/Sources/ComputeCxx/include/module.modulemap @@ -0,0 +1,5 @@ +module ComputeCxx { + umbrella header "ComputeCxx/ComputeCxx.h" + + export * +}