[DO-977] add libyuv package (!12)

Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/12
This commit is contained in:
Aleksandr Vodyanov
2024-12-26 13:56:22 +03:00
parent 28d4363c15
commit 0d5cfacb2e
13 changed files with 584 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)
find_package(libyuv REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE libyuv::libyuv)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)

View File

@@ -0,0 +1,31 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def generate(self):
tc = CMakeToolchain(self)
tc.preprocessor_definitions["HAS_JPEG"] = bool(self.dependencies[self.tested_reference_str].options.with_jpeg)
tc.generate()
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")

View File

@@ -0,0 +1,17 @@
#include "libyuv.h"
#if HAS_JPEG
#include "libyuv/mjpeg_decoder.h"
#endif
int main() {
uint8_t in[16] = {};
uint8_t out[16] = {};
libyuv::ConvertToARGB(in, 16, out, 0, 0, 0, 1, 1, 0, 0,
libyuv::RotationMode::kRotate0, 0);
#if HAS_JPEG
// Test jpeg implementaiton is correctly linked
libyuv::MJpegDecoder decoder;
decoder.LoadFrame(in, 0);
#endif
return 0;
}