[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:
7
recipes/libiconv/all/test_package/CMakeLists.txt
Normal file
7
recipes/libiconv/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package C)
|
||||
|
||||
find_package(Iconv REQUIRED)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Iconv::Iconv)
|
||||
27
recipes/libiconv/all/test_package/conanfile.py
Normal file
27
recipes/libiconv/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import os
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
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 can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
50
recipes/libiconv/all/test_package/test_package.c
Normal file
50
recipes/libiconv/all/test_package/test_package.c
Normal file
@@ -0,0 +1,50 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> //for EXIT_FAILURE
|
||||
#include <locale.h>
|
||||
|
||||
#if _MSC_VER && _MSC_VER < 1600
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include "iconv.h"
|
||||
#include "libcharset.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Test libiconv
|
||||
char in_bytes[4] = {'c', 'i', 'a', 'o'};
|
||||
char *in_buffer = (char *)&in_bytes;
|
||||
size_t in_bytes_left = sizeof(char) * 4;
|
||||
uint32_t ou_bytes[4] = {(uint32_t)-1, (uint32_t)-1, (uint32_t)-1, (uint32_t)-1};
|
||||
size_t ou_bytes_left = sizeof(uint32_t) * 4;
|
||||
char *ou_buffer = (char *)&ou_bytes;
|
||||
iconv_t context;
|
||||
size_t rv;
|
||||
|
||||
context = iconv_open("UCS-4-INTERNAL", "US-ASCII");
|
||||
if ((iconv_t)(-1) == context)
|
||||
{
|
||||
fprintf(stderr, "iconv_open failed\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
rv = iconv(context, &in_buffer, &in_bytes_left, &ou_buffer, &ou_bytes_left);
|
||||
if ((size_t)(-1) == rv)
|
||||
{
|
||||
fprintf(stderr, "icon failed\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("retval libiconv: %lu %u %u %u %u\n", rv, ou_bytes[0], ou_bytes[1], ou_bytes[2], ou_bytes[3]);
|
||||
|
||||
iconv_close(context);
|
||||
|
||||
// Test libcharset
|
||||
setlocale(LC_ALL, "");
|
||||
printf("retval libcharset: %s\n", locale_charset());
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user