Skip to content

Fixes for Swift troubles#20092

Merged
alalek merged 5 commits intoopencv:masterfrom
komakai:disable_swift_build
May 18, 2021
Merged

Fixes for Swift troubles#20092
alalek merged 5 commits intoopencv:masterfrom
komakai:disable_swift_build

Conversation

@komakai
Copy link
Copy Markdown
Contributor

@komakai komakai commented May 15, 2021

Pull Request Readiness Checklist

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work

This PR hopefully addresses a few issues that have been giving trouble when building the Swift wrapper for iOS/macOS

  • add a build flag disable-swift flag to suppress building Swift extensions
  • when the disable-swift is set - still generate Swift extensions and put them in SwiftSources output folder such they can be added manually to a project if needed
  • change to use typealias instead of NS_SWIFT_NAME to handle Point2i → Point, Rect2i → Rect, Size2i → Size type mappings (thanks to @chrisballinger for this)

Issue that may be fixed or partially fixed by this PR: #19645 #19992 #19254

force_builders=docs,ios,Custom Mac
buildworker:Mac=macosx-1
buildworker:iOS=macosx-2
build_image:Custom Mac=osx_framework-test
buildworker:Custom Mac=macosx-1

@komakai
Copy link
Copy Markdown
Contributor Author

komakai commented May 16, 2021

Failing test seems unrelated to this PR.
Hopefully #20097 solves it.

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@alalek alalek merged commit 6265155 into opencv:master May 18, 2021
@alalek alalek mentioned this pull request Jun 4, 2021
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
Fixes for Swift troubles

* Remove NS_SWIFT_NAME override for Point, Rect, and Size due to Darwin namespace conflict

* Fix swift_type overrides in objc generator

* Add backwards compatibility Swift typealiases for Point, Rect, Size

* Add disable-swift build option to iOS/macOS builds

* Add import directive to swift source when building with disable-swift

Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants