[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:
55
recipes/vaapi/all/conanfile.py
Normal file
55
recipes/vaapi/all/conanfile.py
Normal file
@@ -0,0 +1,55 @@
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.gnu import PkgConfig
|
||||
from conan.tools.system import package_manager
|
||||
|
||||
required_conan_version = ">=1.50.0"
|
||||
|
||||
|
||||
class SysConfigVAAPIConan(ConanFile):
|
||||
name = "vaapi"
|
||||
version = "system"
|
||||
description = "VA-API is an open-source library and API specification, which provides access to graphics hardware acceleration capabilities for video processing."
|
||||
topics = ("hwaccel", "video")
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://01.org/linuxmedia/vaapi"
|
||||
license = "MIT"
|
||||
package_type = "shared-library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
|
||||
def layout(self):
|
||||
pass
|
||||
|
||||
def package_id(self):
|
||||
self.info.clear()
|
||||
|
||||
def validate(self):
|
||||
if self.settings.os not in ["Linux", "FreeBSD"]:
|
||||
raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD")
|
||||
|
||||
def system_requirements(self):
|
||||
dnf = package_manager.Dnf(self)
|
||||
dnf.install(["libva-devel"], update=True, check=True)
|
||||
|
||||
yum = package_manager.Yum(self)
|
||||
yum.install(["libva-devel"], update=True, check=True)
|
||||
|
||||
apt = package_manager.Apt(self)
|
||||
apt.install(["libva-dev"], update=True, check=True)
|
||||
|
||||
pacman = package_manager.PacMan(self)
|
||||
pacman.install(["libva"], update=True, check=True)
|
||||
|
||||
zypper = package_manager.Zypper(self)
|
||||
zypper.install(["libva-devel"], update=True, check=True)
|
||||
|
||||
pkg = package_manager.Pkg(self)
|
||||
pkg.install(["libva"], update=True, check=True)
|
||||
|
||||
def package_info(self):
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
for name in ['libva', 'libva-x11', 'libva-drm']:
|
||||
pkg_config = PkgConfig(self, name)
|
||||
self.cpp_info.components[name].includedirs = []
|
||||
self.cpp_info.components[name].libdirs = []
|
||||
pkg_config.fill_cpp_info(self.cpp_info.components[name])
|
||||
8
recipes/vaapi/all/test_package/CMakeLists.txt
Normal file
8
recipes/vaapi/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(xorg REQUIRED CONFIG)
|
||||
find_package(vaapi REQUIRED CONFIG)
|
||||
|
||||
add_executable(test_package test_package.c)
|
||||
target_link_libraries(test_package PRIVATE vaapi::vaapi xorg::xorg)
|
||||
27
recipes/vaapi/all/test_package/conanfile.py
Normal file
27
recipes/vaapi/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import os
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import cross_building
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv"
|
||||
requires = ("xorg/system",)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not cross_building(self):
|
||||
cmd = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(cmd, env="conanrun")
|
||||
38
recipes/vaapi/all/test_package/test_package.c
Normal file
38
recipes/vaapi/all/test_package/test_package.c
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <va/va.h>
|
||||
#include <va/va_x11.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
VADisplay va_display;
|
||||
VAStatus status;
|
||||
int major, minor;
|
||||
Display * display = XOpenDisplay(NULL);
|
||||
if (!display)
|
||||
{
|
||||
printf("XOpenDisplay failed!\n");
|
||||
return 0;
|
||||
}
|
||||
va_display = vaGetDisplay(display);
|
||||
if (!va_display)
|
||||
{
|
||||
XCloseDisplay(display);
|
||||
printf("vaGetDisplay failed\n");
|
||||
return 0;
|
||||
}
|
||||
status = vaInitialize(va_display, &major, &minor);
|
||||
if (status == VA_STATUS_SUCCESS)
|
||||
printf("va version %d.%d\n", major, minor);
|
||||
else
|
||||
{
|
||||
XCloseDisplay(display);
|
||||
printf("vaInitialize failed\n");
|
||||
return 0;
|
||||
}
|
||||
vaTerminate(va_display);
|
||||
XCloseDisplay(display);
|
||||
return 0;
|
||||
}
|
||||
3
recipes/vaapi/config.yml
Normal file
3
recipes/vaapi/config.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
versions:
|
||||
"system":
|
||||
folder: all
|
||||
Reference in New Issue
Block a user