[DO-973] harfbuzz package (!10)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/10
This commit is contained in:
7
recipes/pcre2/all/test_package/CMakeLists.txt
Normal file
7
recipes/pcre2/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(PCRE2 REQUIRED 8BIT CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE PCRE2::8BIT)
|
||||
10
recipes/pcre2/all/test_package/CMakeUserPresets.json
Normal file
10
recipes/pcre2/all/test_package/CMakeUserPresets.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"version": 4,
|
||||
"vendor": {
|
||||
"conan": {}
|
||||
},
|
||||
"include": [
|
||||
"build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json",
|
||||
"build/gcc-11.5-x86_64-17-release/generators/CMakePresets.json"
|
||||
]
|
||||
}
|
||||
26
recipes/pcre2/all/test_package/conanfile.py
Normal file
26
recipes/pcre2/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
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.bindir, "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
34
recipes/pcre2/all/test_package/test_package.c
Normal file
34
recipes/pcre2/all/test_package/test_package.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#include <pcre2.h>
|
||||
|
||||
|
||||
int main() {
|
||||
pcre2_code *re;
|
||||
int rc;
|
||||
PCRE2_SIZE erroffset;
|
||||
int errcode;
|
||||
PCRE2_SIZE* ovector;
|
||||
const char *pattern = "\\w+";
|
||||
size_t pattern_size = strlen(pattern);
|
||||
const char *subject = "conan";
|
||||
size_t subject_size = strlen(subject);
|
||||
uint32_t options = 0;
|
||||
pcre2_match_data *match_data;
|
||||
uint32_t ovecsize = 128;
|
||||
|
||||
re = pcre2_compile(pattern, pattern_size, options, &errcode, &erroffset, NULL);
|
||||
match_data = pcre2_match_data_create(ovecsize, NULL);
|
||||
rc = pcre2_match(re, subject, subject_size, 0, options, match_data, NULL);
|
||||
ovector = pcre2_get_ovector_pointer(match_data);
|
||||
PCRE2_SPTR start = subject + ovector[0];
|
||||
PCRE2_SIZE slen = ovector[1] - ovector[0];
|
||||
printf("match: %.*s\n", (int)slen, (char *)start );
|
||||
pcre2_match_data_free(match_data);
|
||||
pcre2_code_free(re);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user