-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* libva/2.20.0 * don't use release tarball work around intel/libva#781 * fix windows libname * fix windows debug * Update recipes/libva/all/conanfile.py Co-authored-by: Jordan Williams <[email protected]> --------- Co-authored-by: Jordan Williams <[email protected]>
- Loading branch information
1 parent
546214e
commit 232de10
Showing
7 changed files
with
227 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
sources: | ||
"2.20.0": | ||
url: "https://github.com/intel/libva/archive/refs/tags/2.20.0.tar.gz" | ||
sha256: "117f8d658a5fc9ea406ca80a3eb4ae1d70b15a54807c9ed77199c812bed73b60" | ||
patches: | ||
"2.20.0": | ||
- patch_file: "patches/0001-fix-win32-debug.patch" | ||
patch_description: "Fix win32 debug build break" | ||
patch_type: "backport" | ||
patch_source: "https://github.com/intel/libva/pull/759" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.apple import fix_apple_shared_install_name | ||
from conan.tools.env import VirtualBuildEnv | ||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir | ||
from conan.tools.gnu import PkgConfigDeps | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.meson import Meson, MesonToolchain | ||
import os | ||
|
||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class PackageConan(ConanFile): | ||
name = "libva" | ||
description = "Libva is an implementation for VA-API" | ||
license = "MIT" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/intel/libva" | ||
topics = ("VA-API", "Video", "Acceleration") | ||
provides = "vaapi" | ||
package_type = "shared-library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"with_drm": [True, False], | ||
"with_x11": [True, False], | ||
"with_glx": [True, False], | ||
"with_wayland": [True, False], | ||
"with_win32": [True, False], | ||
} | ||
default_options = { | ||
"with_drm": True, | ||
"with_x11": True, | ||
"with_glx": True, | ||
"with_wayland": True, | ||
"with_win32": True, | ||
} | ||
|
||
def export_sources(self): | ||
export_conandata_patches(self) | ||
|
||
def config_options(self): | ||
if self.settings.os != "Windows": | ||
del self.options.with_win32 | ||
|
||
if self.settings.os not in ["Linux", "FreeBSD"]: | ||
del self.options.with_x11 | ||
del self.options.with_glx | ||
del self.options.with_drm | ||
|
||
if self.settings.os != "Linux": | ||
del self.options.with_wayland | ||
|
||
def configure(self): | ||
self.settings.rm_safe("compiler.cppstd") | ||
self.settings.rm_safe("compiler.libcxx") | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
if self.options.get_safe("with_x11"): | ||
self.requires("xorg/system") | ||
if self.options.get_safe("with_drm"): | ||
self.requires("libdrm/2.4.114") | ||
if self.options.get_safe("with_wayland"): | ||
self.requires("wayland/1.22.0") | ||
if self.options.get_safe("with_glx"): | ||
self.requires("opengl/system") | ||
|
||
def validate(self): | ||
if self.options.get_safe("with_glx") and not self.options.get_safe("with_x11"): | ||
raise ConanInvalidConfiguration(f"{self.ref} requires x11 when glx is enabled") | ||
if not self.options.get_safe("with_drm") and not self.options.get_safe("with_x11") and not self.options.get_safe("with_wayland") and not self.options.get_safe("with_win32"): | ||
raise ConanInvalidConfiguration(f"{self.ref} can not be built without at least one backend dev files.") | ||
|
||
def build_requirements(self): | ||
if self.options.get_safe("with_wayland"): | ||
self.tool_requires("wayland/1.22.0") | ||
self.tool_requires("meson/1.2.3") | ||
if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): | ||
self.tool_requires("pkgconf/2.0.3") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
tc = MesonToolchain(self) | ||
tc.project_options["disable_drm"] = not self.options.get_safe("with_drm") | ||
for opt in ['with_x11', 'with_glx', 'with_wayland', 'with_win32']: | ||
tc.project_options[opt] = "yes" if self.options.get_safe(opt) else "no" | ||
tc.generate() | ||
tc = PkgConfigDeps(self) | ||
tc.generate() | ||
tc = VirtualBuildEnv(self) | ||
tc.generate() | ||
|
||
def build(self): | ||
apply_conandata_patches(self) | ||
meson = Meson(self) | ||
meson.configure() | ||
meson.build() | ||
|
||
def package(self): | ||
copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
meson = Meson(self) | ||
meson.install() | ||
|
||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "share")) | ||
rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) | ||
rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) | ||
|
||
fix_apple_shared_install_name(self) | ||
|
||
def package_info(self): | ||
self.cpp_info.components["libva_"].libs = ["va"] | ||
self.cpp_info.components["libva_"].set_property("pkg_config_name", "libva") | ||
|
||
if self.options.get_safe("with_drm"): | ||
self.cpp_info.components["libva-drm"].libs = ["va-drm"] | ||
self.cpp_info.components["libva-drm"].set_property("pkg_config_name", "libva-drm") | ||
self.cpp_info.components["libva-drm"].requires = ["libva_", "libdrm::libdrm"] | ||
|
||
if self.options.get_safe("with_x11"): | ||
self.cpp_info.components["libva-x11"].libs = ["va-x11"] | ||
self.cpp_info.components["libva-x11"].set_property("pkg_config_name", "libva-x11") | ||
self.cpp_info.components["libva-x11"].requires = ["libva_", "xorg::xorg"] | ||
|
||
if self.options.get_safe("with_glx"): | ||
self.cpp_info.components["libva-glx"].libs = ["va-glx"] | ||
self.cpp_info.components["libva-glx"].set_property("pkg_config_name", "libva-glx") | ||
self.cpp_info.components["libva-glx"].requires = ["libva_", "opengl::opengl"] | ||
|
||
if self.options.get_safe("with_wayland"): | ||
self.cpp_info.components["libva-wayland"].libs = ["va-wayland"] | ||
self.cpp_info.components["libva-wayland"].set_property("pkg_config_name", "libva-wayland") | ||
self.cpp_info.components["libva-wayland"].requires = ["libva_", "wayland::wayland-client"] | ||
|
||
if self.options.get_safe("with_win32"): | ||
self.cpp_info.components["libva-win32"].libs = ["va_win32"] | ||
self.cpp_info.components["libva-win32"].set_property("pkg_config_name", "libva-win32") | ||
self.cpp_info.components["libva-win32"].requires = ["libva_"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From 2a1536a7d87eee3de17c27d07a40d8578cbf7cc0 Mon Sep 17 00:00:00 2001 | ||
From: Sil Vilerino <[email protected]> | ||
Date: Wed, 27 Sep 2023 11:50:16 -0400 | ||
Subject: [PATCH] win32: Fix debug build break | ||
|
||
Fixes: 484f128 ("win32: remove duplicate adapter_luid entry") | ||
Signed-off-by: Sil Vilerino <[email protected]> | ||
--- | ||
va/win32/va_win32.c | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/va/win32/va_win32.c b/va/win32/va_win32.c | ||
index 7a6a895d3..350ee3a27 100644 | ||
--- a/va/win32/va_win32.c | ||
+++ b/va/win32/va_win32.c | ||
@@ -183,9 +183,9 @@ VADisplay vaGetDisplayWin32( | ||
LoadDriverNameFromRegistry(adapter_luid, pWin32Ctx); | ||
#ifdef _DEBUG | ||
if (pWin32Ctx->registry_driver_available_flag) { | ||
- fprintf(stderr, "VA_Win32: Found driver %s in the registry for LUID %ld %ld \n", pWin32Ctx->registry_driver_name, adapter_luid.LowPart, adapter_luid.HighPart); | ||
+ fprintf(stderr, "VA_Win32: Found driver %s in the registry for LUID %ld %ld \n", pWin32Ctx->registry_driver_name, adapter_luid->LowPart, adapter_luid->HighPart); | ||
} else { | ||
- fprintf(stderr, "VA_Win32: Couldn't find a driver in the registry for LUID %ld %ld. Using default driver: %s \n", adapter_luid.LowPart, adapter_luid.HighPart, VAAPI_DEFAULT_DRIVER_NAME); | ||
+ fprintf(stderr, "VA_Win32: Couldn't find a driver in the registry for LUID %ld %ld. Using default driver: %s \n", adapter_luid->LowPart, adapter_luid->HighPart, VAAPI_DEFAULT_DRIVER_NAME); | ||
} | ||
#endif // _DEBUG | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package LANGUAGES C) | ||
|
||
find_package(libva REQUIRED CONFIG) | ||
|
||
add_executable(test_package test_package.c) | ||
target_link_libraries(test_package PRIVATE libva::libva) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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" | ||
|
||
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <va/va.h> | ||
|
||
#include <stdio.h> | ||
|
||
int main() | ||
{ | ||
VADisplay va_display; | ||
printf("Display is valid: %d", vaDisplayIsValid(0)); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"2.20.0": | ||
folder: all |