Skip to content

Commit

Permalink
Merge pull request #16 from yeatse/feature/visionos
Browse files Browse the repository at this point in the history
Update patch file
  • Loading branch information
yeatse authored Mar 20, 2024
2 parents 7285605 + b1f5472 commit b7373d9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ 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
uses: jwlawson/[email protected]
Expand Down Expand Up @@ -45,6 +46,8 @@ jobs:
pip3 install pathlib
python3 platforms/apple/build_xcframework.py \
--iphoneos_archs=arm64 \
--visionos_archs=arm64 \
--visionsimulator_archs=x86_64,arm64 \
--disable-bitcode -o build
- name: Zip artifact
Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(
Expand All @@ -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++")
]
Expand Down
28 changes: 26 additions & 2 deletions opencv.patch
Original file line number Diff line number Diff line change
@@ -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 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>CFBundleExecutable</key>
+ <string>opencv2</string>
<key>CFBundleName</key>
<string>${OPENCV_APPLE_BUNDLE_NAME}</string>
<key>CFBundleIdentifier</key>
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:
Expand All @@ -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 = '''<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict></dict>
+</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:
Expand Down

0 comments on commit b7373d9

Please sign in to comment.