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

Set some dependency options to be multi-choice. #1758

Merged
merged 8 commits into from
Nov 21, 2023

Conversation

vrabaud
Copy link
Collaborator

@vrabaud vrabaud commented Nov 14, 2023

The current options are complex:

  • you want a local AOM, you need to set to variables (AVIF_CODEC_AOM and AVIF_LOCAL_AOM to ON)
  • they can be confusing: some work in best effort, e.g. if you do not set AVIF_LOCAL_LIBYUV, it tries to find libyuv if not, oh well, too bad let's move on.
  • you cannot disable some options: if libyuv is found, use it! Oh wait, I actually never asked for it (causing issues like Undefined symbols for architecture x86_64 macOS #1732)

That's why I propose to set dependency options to: OFF: it will never be used whether it is findable or in ext LOCAL: it has to use the version in ext/ and will fail if not found SYSTEM: it will find_package it and fail if not found

An AUTO version (that uses a dependency if found) should not be added as it will create more confusion for developers or package building.

This is compatible with ccmake or cmake-gui.

@vrabaud vrabaud changed the title Set some dependency options to be multi-choice. RFC: Set some dependency options to be multi-choice. Nov 14, 2023
@vrabaud vrabaud marked this pull request as ready for review November 14, 2023 14:23
@vrabaud
Copy link
Collaborator Author

vrabaud commented Nov 14, 2023

@fdintino , @wantehchang , what do you think? BTW, this is the official way of doing things: https://www.kitware.com//constraining-values-with-comboboxes-in-cmake-cmake-gui/

@vrabaud vrabaud requested a review from wantehchang November 14, 2023 14:23
@fdintino
Copy link
Contributor

I like it. I've also seen projects accept paths for these options, to force find_package to look in a specific prefix.

Copy link
Collaborator

@wantehchang wantehchang left a comment

Choose a reason for hiding this comment

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

I am sorry I missed the review request.

Could you describe this change in the changelog?

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@wantehchang
Copy link
Collaborator

Vincent: In addition to the changelog, please also update https://github.com/AOMediaCodec/libavif/blob/main/README.md.

I think this is a good simplification of the cmake options. Thanks.

@vrabaud vrabaud force-pushed the cmake_cleanup branch 2 times, most recently from c07124b to fe444ff Compare November 20, 2023 14:34
@vrabaud vrabaud requested a review from wantehchang November 20, 2023 14:41
@vrabaud vrabaud changed the title RFC: Set some dependency options to be multi-choice. Set some dependency options to be multi-choice. Nov 20, 2023
CMakeLists.txt Outdated Show resolved Hide resolved
The current options are complex:
- you want a local AOM, you need to set to variables (AVIF_CODEC_AOM
and AVIF_LOCAL_AOM to ON)
- they can be confusing: some work in best effort, e.g. if you do
not AVIF_LOCAL_LIBYUV, it tries to find libyuv if not, oh well, too
bad let's move on.
- you cannot disable some options: if libyuv is found, use it! Oh
wait, I actually never asked for it (causing issues like
AOMediaCodec#1732)

That's why I propose to set dependency options to:
OFF: it will never be used whether it is findable or in ext
LOCAL: it has to use the version in ext/ and will fail if not found
SYSTEM: it will find_package it and fail if not found

An AUTO version (that uses a dependency if found) should not be
added as it will create more confusion for developers or
package building.
Add backward compatibility
Update readme and changelog.
Fix CMake comment.
- look for variables in CACHE (for Android, they are set first)
- use SYSTEM for installed CI
@vrabaud vrabaud merged commit f7ce882 into AOMediaCodec:main Nov 21, 2023
@vrabaud vrabaud deleted the cmake_cleanup branch November 21, 2023 10:24
Copy link
Collaborator

@wantehchang wantehchang left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -51,8 +52,9 @@ list of requirements.

If you want to statically link any codec into your local (static) build of
libavif, building using one of these scripts and then enabling the associated
`AVIF_LOCAL_*` is a convenient method, but you must make sure to disable
`BUILD_SHARED_LIBS` in CMake to instruct it to make a static libavif library.
`AVIF_LOCAL_*` and setting `AVIF_CODEC_*` to `LOCAL` is a convenient method,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The new text mentions both the old and new ways, connected by "and". I think we just need to mention the new way ("setting AVIF_CODEC_* to LOCAL"). If we mention both, they should be connected by "or" because one of them is sufficient.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thx, fixed in #1795 I believe

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.

3 participants