Unify static linking for all operating systems and improve README #129
+278
−146
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit unifies the code for static linking under all operating systems, with a focus on fixing problems for Windows:
All functionality for pkg-config is now enabled for Windows as well. For example, a vcpkg-built pkgconf works great. Therefore, it seems there is no reason to prevent users from using pkg-config on Windows if they want to use it.
When not using pkg-config on Windows, and statically linking against FFmpeg libraries, many system libraries will also need to be linked. A list of known system libraries will now be linked in such situations. It's best to use pkg-config, but this will at least reduce the probability of linker errors. Note that we also have to do this for vcpkg as well.
Code duplication between Windows and other operating systems has been eliminated.
The statik flag is now correctly passed to pkg_config when in the static_linking function.
The GitHub Actions workflow is updated to test the new possibilities on Windows. The example program is also run, which revealed that the existing vcpkg-based way of finding FFmpeg was missing several system libraries for linking.
Make significant improvements to the README. More detailed information about environment variables, features, how the build script works, vcpkg triples, and more is included to help users work with the crate.
Improving the functionality of dynamic linking is an obvious next step, but is out of scope of this commit. It's likely that a single, large function can eventually be used for both static and dynamic linking.