Skip to content
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

Add support for Apple-Framework builds #466

Merged
merged 2 commits into from
Jan 23, 2025
Merged

Conversation

Treata11
Copy link
Contributor

Greetings,

Cross-compilation for a macOS target was already supported within this framework. To enable iOS compilations, I introduced a new flag, BUILD_FRAMEWORK, which is set to FALSE by default.

cmake -S. -B build -DBUILD_FRAMEWORK=TRUE -DCMAKE_SYSTEM_NAME=iOS

sudo cmake --build build --target install --config Release

Builds for an iOS target is successful using the commands above (There were a good count of warnings though) And the resulting iOS binaries can then be found in: build/libde265/de265.framework.

@Treata11
Copy link
Contributor Author

The properties are set for the de265 target. I can add the required properties for the rest as well if needed.

I'll create a similar PR for libheif once everything's setup here.

@farindk
Copy link
Contributor

farindk commented Jan 22, 2025

Thank you.

One question before I merge this: I am not that familiar with iOS. Is a framework the equivalent of a library? Or are there both, (static) libraries and frameworks, on iOS? If there are only frameworks, then we could maybe omit the BUILD_FRAMEWORK flag and do this automatically when CMAKE_SYSTEM_NAME is set to iOS ?

@Treata11
Copy link
Contributor Author

One question before I merge this: I am not that familiar with iOS. Is a framework the equivalent of a library?

Yes it is. It's a container/bundle for binaries, headers, metadata (info.plist) and some other resources, that is most suitable for embedding the library in an XCode project.

Or are there both, (static) libraries and frameworks, on iOS?

The built artifact inside the .framework containers are all static (You can tweak it to build an dynamic lib (dylib) but it'll be rejected upon publication in AppStore & honestly it doesn't serve any purpose on embedded systems since Applications do not share their sandbox...).
It's worth noting that the built artifacts don't have an extension (they mostly don't come with .a extension)

If there are only frameworks, then we could maybe omit the BUILD_FRAMEWORK flag and do this automatically when CMAKE_SYSTEM_NAME is set to iOS

I think the method above should be the most convenient since it is covering all of the iOS-derived platforms (iOS, ipadOS, tvOS, watchOS & visionOS). See CMake's documentation.
What you say can be achieved in the configs, but it'll make the conditions unnecessarily complex, wouldn't it?

@farindk farindk merged commit b67f401 into strukturag:master Jan 23, 2025
23 of 25 checks passed
@farindk
Copy link
Contributor

farindk commented Jan 23, 2025

Great, thanks for the extra explanations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants