From 71f936f365cd4f2d082a855e27fd9ec92f59732d Mon Sep 17 00:00:00 2001 From: Yang Chao Date: Fri, 29 Dec 2023 15:06:07 +0800 Subject: [PATCH 1/7] support visionOS --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index b561b4d..729bd6f 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -9,7 +9,7 @@ let checksum = "9109ce819eb9c62eafee160b274c74182430aae16774bcc54d4ad25aec9fddf2 let package = Package( name: "OpenCV", platforms: [ - .macOS(.v10_13), .iOS(.v12), .macCatalyst(.v13) + .macOS(.v10_13), .iOS(.v12), .macCatalyst(.v13), .visionOS(.v1) ], products: [ .library( From 0362cfd845e54f76013c9b54b30c4c88bb729a9b Mon Sep 17 00:00:00 2001 From: Yang Chao Date: Fri, 29 Dec 2023 15:16:34 +0800 Subject: [PATCH 2/7] fix visionOS build error --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 729bd6f..19b4efa 100644 --- a/Package.swift +++ b/Package.swift @@ -26,8 +26,8 @@ let package = Package( .linkedFramework("AVFoundation"), .linkedFramework("CoreImage"), .linkedFramework("CoreMedia"), - .linkedFramework("CoreVideo", .when(platforms: [.iOS])), - .linkedFramework("Accelerate", .when(platforms: [.iOS, .macOS])), + .linkedFramework("CoreVideo", .when(platforms: [.iOS, .visionOS])), + .linkedFramework("Accelerate", .when(platforms: [.iOS, .macOS, .visionOS])), .linkedFramework("OpenCL", .when(platforms: [.macOS])), .linkedLibrary("c++") ] From 3cc03934b8fbf9eaf45a734e2e4daac59a85b7f1 Mon Sep 17 00:00:00 2001 From: Yang Chao Date: Sat, 30 Dec 2023 01:07:12 +0800 Subject: [PATCH 3/7] build visionOS --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfd6df6..2bc51f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,6 +45,8 @@ jobs: pip3 install pathlib python3 platforms/apple/build_xcframework.py \ --iphoneos_archs=arm64 \ + --visionos_archs=arm64 \ + --visionsimulator_archs=arm64 \ --disable-bitcode -o build - name: Zip artifact From 5f599c2b37173361c1ebf066068f5a5a1dd28d3b Mon Sep 17 00:00:00 2001 From: Yang Chao Date: Sat, 30 Dec 2023 01:12:22 +0800 Subject: [PATCH 4/7] build x86_64 for visionsimulator --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2bc51f9..29cefad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: python3 platforms/apple/build_xcframework.py \ --iphoneos_archs=arm64 \ --visionos_archs=arm64 \ - --visionsimulator_archs=arm64 \ + --visionsimulator_archs=x86_64,arm64 \ --disable-bitcode -o build - name: Zip artifact From f22451b76a66caae4a09eb91b8f39dc0609f4d90 Mon Sep 17 00:00:00 2001 From: Yang Chao Date: Sat, 30 Dec 2023 11:33:34 +0800 Subject: [PATCH 5/7] fix visionOS build error --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 29cefad..5a9bad6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,7 @@ jobs: - name: Prepare Xcode run: | sudo xcode-select -s /Applications/Xcode_15.1.app/Contents/Developer + xcodebuild -downloadPlatform visionOS - name: actions-setup-cmake uses: jwlawson/actions-setup-cmake@v1.13.1 From 04a84ba8ffdc088675609d9bdd966af5c600d6ce Mon Sep 17 00:00:00 2001 From: Yang Chao Date: Wed, 6 Mar 2024 23:29:56 +0800 Subject: [PATCH 6/7] update xcode 15.2 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5a9bad6..625eddb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Prepare Xcode run: | - sudo xcode-select -s /Applications/Xcode_15.1.app/Contents/Developer + sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer xcodebuild -downloadPlatform visionOS - name: actions-setup-cmake From b1f547204500af73eaa0c8acf9f9e18f731010db Mon Sep 17 00:00:00 2001 From: Yang Chao Date: Thu, 21 Mar 2024 00:21:26 +0800 Subject: [PATCH 7/7] fix installation error on Xcode 15.3 --- opencv.patch | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/opencv.patch b/opencv.patch index 3d14e72..025fecb 100644 --- a/opencv.patch +++ b/opencv.patch @@ -1,5 +1,18 @@ +diff --git a/platforms/ios/Info.plist.in b/platforms/ios/Info.plist.in +index a166934bdf..fa70c29349 100644 +--- a/platforms/ios/Info.plist.in ++++ b/platforms/ios/Info.plist.in +@@ -2,6 +2,8 @@ + + + ++ CFBundleExecutable ++ opencv2 + CFBundleName + ${OPENCV_APPLE_BUNDLE_NAME} + CFBundleIdentifier diff --git a/platforms/ios/build_framework.py b/platforms/ios/build_framework.py -index 77878280f7..435eb89c8c 100755 +index b876812720..efc929bfed 100755 --- a/platforms/ios/build_framework.py +++ b/platforms/ios/build_framework.py @@ -426,6 +426,12 @@ class Builder: @@ -15,10 +28,21 @@ index 77878280f7..435eb89c8c 100755 platform_name_map = { "arm": "armv7-apple-ios", "arm64": "arm64-apple-ios", -@@ -478,6 +484,24 @@ class Builder: +@@ -478,6 +484,35 @@ class Builder: d = os.path.join(framework_dir, *l[1]) os.symlink(s, d) ++ # Fix build failure on Xcode 15.3 ++ root_plist = ''' ++ ++ ++ ++ ++''' ++ root_plist_path = os.path.join(framework_dir, 'Info.plist') ++ with open(root_plist_path, 'w') as root_plist_file: ++ root_plist_file.write(root_plist) ++ + def mergeModuleHeaders(self, merged_header, module_header): + print("Merging module headers:\n\t%s\n\t%s" % (merged_header, module_header)) + with codecs.open(merged_header, "r", "utf-8") as file: