[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:
8
recipes/libyuv/all/test_package/CMakeLists.txt
Normal file
8
recipes/libyuv/all/test_package/CMakeLists.txt
Normal 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)
|
||||
31
recipes/libyuv/all/test_package/conanfile.py
Normal file
31
recipes/libyuv/all/test_package/conanfile.py
Normal 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")
|
||||
17
recipes/libyuv/all/test_package/test_package.cpp
Normal file
17
recipes/libyuv/all/test_package/test_package.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user