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

Enhance FindFFmpeg.cmake with fallback version parsing, FFmpeg_VERSION, etc. #694

Merged
merged 3 commits into from Jun 26, 2021

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Jun 25, 2021

My recent PR #693 depends on the availability of the avformat_VERSION value in CMake, just as a previous PR added a dependency on the avcodec_VERSION for determining hardware-acceleration support. Previously, FFmpeg component versions were only available if PkgConfig had been used to retrieve the FFmpeg configuration.

This PR enhances the Find module so that, if PkgConfig is not available/used, the component versions are parsed out of the relevant version.h file in each component's include directory.

Along the way, it also makes several other enhancements to the Find module:

  • Probing of non-requested FFmpeg components (a serious time-waster) is eliminated, so if the find_package() line specifies COMPONENTS or OPTIONAL_COMPONENTS only those libraries will be available.
  • All component variables now use the CMake standard naming of FFmpeg_<component>_<var>, instead of the previous <component>_<var>.
  • find_package_handle_standard_args() is now called with HANDLE_COMPONENTS to verify the component list against FFmpeg_FIND_COMPONENTS
  • The overall FFmpeg_VERSION value is now parsed from libavutil/ffversion.h and published as the module's VERSION_VAR

- Add fallback component version parsing from the individual
  <includedir>/<libname>/version.h headers
- Switch to FFmpeg_<component>_<property> variable names, standard
  for CMake component variables
- No longer probe for non-requested components
- Use HANDLE_COMPONENT in find_package_handle_standard_args
- Parse, export overall FFmpeg_VERSION from libavutil/ffversion.h
@ferdnyc ferdnyc added the build Issues related to compiling or installing libopenshot and its dependencies label Jun 25, 2021
@codecov
Copy link

codecov bot commented Jun 25, 2021

Codecov Report

Merging #694 (e2b685d) into develop (09eb807) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #694   +/-   ##
========================================
  Coverage    50.41%   50.41%           
========================================
  Files          155      155           
  Lines        13315    13315           
========================================
  Hits          6713     6713           
  Misses        6602     6602           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09eb807...e2b685d. Read the comment docs.

find_package_handle_standard_args() will take care of that
@ferdnyc
Copy link
Contributor Author

ferdnyc commented Jun 25, 2021

The version number changes particularly affect the WIN32 platform, which previously lacked FFmpeg component versions because PkgConfig was not used to discover the library.

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Jun 25, 2021

  • Probing of non-requested FFmpeg components (a serious time-waster) is eliminated, so if the find_package() line specifies COMPONENTS or OPTIONAL_COMPONENTS only those libraries will be available.

(Except for avutil, which will always be resolved due to the aforementioned parsing of libavutil/ffversion.h.)

@ferdnyc ferdnyc merged commit 27e8497 into OpenShot:develop Jun 26, 2021
@ferdnyc ferdnyc deleted the find-ffmpeg-versions branch June 26, 2021 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues related to compiling or installing libopenshot and its dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant