[DO-981] qt package (!15)

Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/15
This commit is contained in:
Aleksandr Vodyanov
2025-02-13 12:25:48 +03:00
parent 60445ac09e
commit 3759e1163f
228 changed files with 16106 additions and 12 deletions

View File

@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES CXX)
find_package(BISON REQUIRED)
set(BISON_VARS
BISON_FOUND
BISON_EXECUTABLE
BISON_VERSION
)
foreach(BISON_VAR ${BISON_VARS})
message("${BISON_VAR}: ${${BISON_VAR}}")
if(NOT ${BISON_VAR})
message(FATAL_ERROR "${BISON_VAR} NOT FOUND")
endif()
endforeach()
bison_target(McParser mc_parser.yy "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp")
add_library(${PROJECT_NAME} STATIC ${BISON_McParser_OUTPUTS})

View File

@@ -0,0 +1,9 @@
{
"version": 4,
"vendor": {
"conan": {}
},
"include": [
"build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json"
]
}

View File

@@ -0,0 +1,38 @@
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.microsoft import unix_path
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv"
test_type = "explicit"
win_bash = True
@property
def _settings_build(self):
return getattr(self, "settings_build", self.settings)
def layout(self):
cmake_layout(self)
def build_requirements(self):
self.tool_requires(self.tested_reference_str)
if self._settings_build.os == "Windows":
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
@property
def _mc_parser_source(self):
return os.path.join(self.source_folder, "mc_parser.yy")
def test(self):
self.run("bison --version")
self.run("yacc --version")
self.run(f"bison -d {unix_path(self, self._mc_parser_source)}")

View File

@@ -0,0 +1,42 @@
%{
#include <iostream>
#include <string>
#include <map>
#include <cstdlib> //-- I need this for atoi
using namespace std;
int yylex();
int yyerror(const char *p) { cerr << "Error!" << endl; return 42; }
%}
%union {
int val;
char sym;
};
%token <val> NUM
%token <sym> OPA OPM LP RP STOP
%type <val> exp term sfactor factor res
%%
run: res run | res /* forces bison to process many stmts */
res: exp STOP { cout << $1 << endl; }
exp: exp OPA term { $$ = ($2 == '+' ? $1 + $3 : $1 - $3); }
| term { $$ = $1; }
term: term OPM factor { $$ = ($2 == '*' ? $1 * $3 : $1 / $3); }
| sfactor { $$ = $1; }
sfactor: OPA factor { $$ = ($1 == '+' ? $2 : -$2); }
| factor { $$ = $1; }
factor: NUM { $$ = $1; }
| LP exp RP { $$ = $2; }
%%
int main()
{
yyparse();
return 0;
}