-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Universal Build for Big Sur #18094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Universal Build for Big Sur #18094
Conversation
platforms/ios/build_framework.py
Outdated
if arch != "arm64": | ||
cmakecmd.append("-DENABLE_NEON=OFF") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we should re-check CMake scripts (toolchain?) to ensure that this is default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that there is an issue in CMake which overwrites the value set for CMAKE_SYSTEM_PROCESSOR when building for macOS. This meant that when building for arm64 on Intel or for x86_64 on ARM we were getting incorrect information for supported compiler optimizations, which was causing the various weird build errors we were seeing. I have added a work-around for this.
if args.legacy_build: | ||
args.framework_name = "opencv2" | ||
if not "objc" in args.without: | ||
args.without.append("objc") | ||
|
||
b = OSXBuilder(args.opencv, args.contrib, False, False, args.without, args.disable, args.enablenonfree, | ||
[ | ||
(["x86_64"], "MacOSX") | ||
(archs, "MacOSX") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use this form here:
("x86_64", "MacOSX"),
("arm64", "MacOSX"),
(as result)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OSXBuilder shares code with the iOSBuilder so we need to pass the parameters in a way that is consistent with how it is done on iOS:
[
(["armv7, "armv7s", "arm64"], "iPhoneOS"),
(["x86_64", "i386"], "iPhoneSimulator"),
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.
I have confused by arch = archs[0]
line in makeCMakeCmd()
.
For each arch we should have own dedicated CMake pass.
It is impossible to "merge" them - current CMake scripts are targeted to single configuration at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have confused by arch = archs[0] line in makeCMakeCmd()
OK I understand what you mean - I can fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was only one set of conditions where multiple architectures were being built at the same time but the changes in #17665 meant actually it wasn't necessary any more - so I have modified the iOS and macOS builds to always just build one architecture at a time.
…e + improve code readability
723e376
to
fdcbd8d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! Thank you for contribution 👍
* Universal Build for Big Sur * Refactor MacOS/iOS build to only ever build one architecture at a time + improve code readability * Workaround for CMake issue 20989
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
This PR resolves #18049
--archs
parameter to the MacOS build