Expose TorchCodecConfig.cmake #938
Open
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 exposes torchcodec core library to be used by third party modules on the C++ level. The primary purpose is to allow non-CUDA device interfaces out-of-tree implementations. There are the following major changes:
Exposed TorchCodecConfig.cmake which defines torchcodec targets to be linked with
Provided Python level APIs to faciliate out-of-tree device interfaces work with torchcodec:
torchcodec.cmake_prefix_path
- path which points toTorchCodecConfig.cmake
configurationtorchcodec.variant
- variant of the torchcodec library which was loaded, i.e. N in libtorchcodec_core{N}.so (currently ffmpeg_major_version)torchcodec.core_library_path
- full path of the loaded torchcodec core librarysrc/torchcodec/_core/
dropped from include paths to allow using of the core library out-of-treeTorchCodecConfig.cmake
has 2 working modes:pkg-config
and configures corresponding (single) version of torchcodecTORCHCODEC_FFMPEG{N}_INSTALL_PREFIX
is set (N=4,5,6,7
- version of FFmpeg), then config defines torchcodec target corresponding to the specified FFmpeg version. Note that multiple prefixes can be specified at the same time allowing to build against few torchcodec versions at once.Config will define
TORCHCODEC_VARIANTS
variable with value corresponding to FFmpeg major versions of available torchcodec core libraries. Further, config will also definetorchcodec::ffmpeg${N}
andtorchcodec::core${N}
targets whereN
takes values fromTORCHCODEC_VARIANTS
.See the following repository for an actual out-of-tree device interface torchcodec plugin:
I suggest to pay attention on these:
CC: @scotts, @NicolasHug