[DO-971] ffmpeg recipe with requirements (!9)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/9
This commit is contained in:
35
recipes/ffmpeg/all/test_package/CMakeLists.txt
Normal file
35
recipes/ffmpeg/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,35 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(ffmpeg REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avutil)
|
||||
if (TARGET ffmpeg::avdevice)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVDEVICE)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avdevice)
|
||||
endif ()
|
||||
if (TARGET ffmpeg::avfilter)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVFILTER)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avfilter)
|
||||
endif ()
|
||||
if (TARGET ffmpeg::avformat)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVFORMAT)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avformat)
|
||||
endif ()
|
||||
if (TARGET ffmpeg::avcodec)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_AVCODEC)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::avcodec)
|
||||
endif ()
|
||||
if (TARGET ffmpeg::swscale)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_SWSCALE)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::swscale)
|
||||
endif ()
|
||||
if (TARGET ffmpeg::swresample)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_SWRESAMPLE)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::swresample)
|
||||
endif ()
|
||||
if (TARGET ffmpeg::postproc)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FFMPEG_POSTPROC)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ffmpeg::postproc)
|
||||
endif ()
|
||||
26
recipes/ffmpeg/all/test_package/conanfile.py
Normal file
26
recipes/ffmpeg/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
55
recipes/ffmpeg/all/test_package/test_package.c
Normal file
55
recipes/ffmpeg/all/test_package/test_package.c
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifdef HAVE_FFMPEG_AVCODEC
|
||||
# include <libavcodec/avcodec.h>
|
||||
#endif
|
||||
#ifdef HAVE_FFMPEG_AVFORMAT
|
||||
# include <libavformat/avformat.h>
|
||||
#endif
|
||||
#ifdef HAVE_FFMPEG_AVFILTER
|
||||
# include <libavfilter/avfilter.h>
|
||||
#endif
|
||||
#ifdef HAVE_FFMPEG_AVDEVICE
|
||||
# include <libavdevice/avdevice.h>
|
||||
#endif
|
||||
#ifdef HAVE_FFMPEG_SWRESAMPLE
|
||||
# include <libswresample/swresample.h>
|
||||
#endif
|
||||
#ifdef HAVE_FFMPEG_SWSCALE
|
||||
# include <libswscale/swscale.h>
|
||||
#endif
|
||||
#include <libavutil/hwcontext.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef HAVE_FFMPEG_AVCODEC
|
||||
printf("configuration: %s\n", avcodec_configuration());
|
||||
printf("avcodec version: %d.%d.%d\n", AV_VERSION_MAJOR(avcodec_version()), AV_VERSION_MINOR(avcodec_version()), AV_VERSION_MICRO(avcodec_version()));
|
||||
#else
|
||||
printf("avcodec is disabled!\n");
|
||||
#endif
|
||||
#ifdef HAVE_FFMPEG_AVFILTER
|
||||
printf("avfilter version: %d.%d.%d\n", AV_VERSION_MAJOR(avfilter_version()), AV_VERSION_MINOR(avfilter_version()), AV_VERSION_MICRO(avfilter_version()));
|
||||
#else
|
||||
printf("avfilter is disabled!\n");
|
||||
#endif
|
||||
#ifdef HAVE_FFMPEG_AVDEVICE
|
||||
avdevice_register_all();
|
||||
printf("avdevice version: %d.%d.%d\n", AV_VERSION_MAJOR(avdevice_version()), AV_VERSION_MINOR(avdevice_version()), AV_VERSION_MICRO(avdevice_version()));
|
||||
#else
|
||||
printf("avdevice is disabled!\n");
|
||||
#endif
|
||||
#ifdef HAVE_FFMPEG_SWRESAMPLE
|
||||
printf("swresample version: %d.%d.%d\n", AV_VERSION_MAJOR(swresample_version()), AV_VERSION_MINOR(swresample_version()), AV_VERSION_MICRO(swresample_version()));
|
||||
#else
|
||||
printf("swresample is disabled!\n");
|
||||
#endif
|
||||
#ifdef HAVE_FFMPEG_SWSCALE
|
||||
printf("swscale version: %d.%d.%d\n", AV_VERSION_MAJOR(swscale_version()), AV_VERSION_MINOR(swscale_version()), AV_VERSION_MICRO(swscale_version()));
|
||||
#else
|
||||
printf("swscale is disabled!\n");
|
||||
#endif
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user