[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:
9
recipes/flex/all/test_package/CMakeLists.txt
Normal file
9
recipes/flex/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package LANGUAGES CXX)
|
||||
|
||||
find_package(FLEX REQUIRED)
|
||||
flex_target(flex_scanner basic_nr.l ${PROJECT_BINARY_DIR}/basic_nr.cpp)
|
||||
|
||||
add_executable(${PROJECT_NAME} basic_nr.cpp)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${FLEX_INCLUDE_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${FLEX_LIBRARIES})
|
||||
9
recipes/flex/all/test_package/CMakeUserPresets.json
Normal file
9
recipes/flex/all/test_package/CMakeUserPresets.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": 4,
|
||||
"vendor": {
|
||||
"conan": {}
|
||||
},
|
||||
"include": [
|
||||
"build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json"
|
||||
]
|
||||
}
|
||||
89
recipes/flex/all/test_package/basic_nr.l
Normal file
89
recipes/flex/all/test_package/basic_nr.l
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* This file is part of flex.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
*/
|
||||
|
||||
%option C++ noyywrap
|
||||
|
||||
%{
|
||||
int mylineno = 0;
|
||||
%}
|
||||
|
||||
string \"[^\n"]+\"
|
||||
|
||||
ws [ \t]+
|
||||
|
||||
alpha [A-Za-z]
|
||||
dig [0-9]
|
||||
name ({alpha}|{dig}|\$)({alpha}|{dig}|\_|\.|\-|\/|\$)*
|
||||
num1 [-+]?{dig}+\.?([eE][-+]?{dig}+)?
|
||||
num2 [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)?
|
||||
number {num1}|{num2}
|
||||
|
||||
%%
|
||||
|
||||
{ws} /* skip blanks and tabs */
|
||||
|
||||
"/*" {
|
||||
int c;
|
||||
|
||||
while((c = yyinput()) != 0)
|
||||
{
|
||||
if(c == '\n')
|
||||
++mylineno;
|
||||
|
||||
else if(c == '*')
|
||||
{
|
||||
if((c = yyinput()) == '/')
|
||||
break;
|
||||
else
|
||||
unput(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{number} std::cout << "number " << YYText() << '\n';
|
||||
|
||||
\n mylineno++;
|
||||
|
||||
{name} std::cout << "name " << YYText() << '\n';
|
||||
|
||||
{string} std::cout << "string " << YYText() << '\n';
|
||||
|
||||
%%
|
||||
|
||||
extern "C" {
|
||||
int yylex() {return 0;}
|
||||
}
|
||||
|
||||
#include <fstream>
|
||||
|
||||
int main( int argc, const char *argv[]) {
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Need an argument\n");
|
||||
return 1;
|
||||
}
|
||||
std::ifstream ifs(argv[1]);
|
||||
FlexLexer *lexer = new yyFlexLexer(ifs, std::cout);
|
||||
while(lexer->yylex() != 0)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
6
recipes/flex/all/test_package/basic_nr.txt
Normal file
6
recipes/flex/all/test_package/basic_nr.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
/* this is a multi line comment
|
||||
still in the comment
|
||||
and done */
|
||||
foo = "bar"
|
||||
num = 43
|
||||
setting = false
|
||||
50
recipes/flex/all/test_package/conanfile.py
Normal file
50
recipes/flex/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import os
|
||||
import re
|
||||
from io import StringIO
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv", "CMakeDeps"
|
||||
test_type = "explicit"
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def build_requirements(self):
|
||||
self.tool_requires(self.tested_reference_str)
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def _assert_expected_version(self):
|
||||
|
||||
def tested_reference_version():
|
||||
tokens = re.split('[@#]', self.tested_reference_str)
|
||||
return tokens[0].split("/", 1)[1]
|
||||
|
||||
output = StringIO()
|
||||
self.run("flex --version", output)
|
||||
output_str = str(output.getvalue())
|
||||
self.output.info("Installed version: {}".format(output_str))
|
||||
expected_version = tested_reference_version()
|
||||
self.output.info("Expected version: {}".format(expected_version))
|
||||
assert_flex_version = "flex {}".format(expected_version)
|
||||
assert(assert_flex_version in output_str)
|
||||
|
||||
def build(self):
|
||||
# Let's check flex version installed
|
||||
self._assert_expected_version()
|
||||
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")
|
||||
txt_file = os.path.join(self.source_folder, "basic_nr.txt")
|
||||
self.run(f"{bin_path} {txt_file}", env="conanrun")
|
||||
Reference in New Issue
Block a user