From 9675c6050d7d7b32cdf24362e9731747d6dcce7b Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 12 Mar 2024 12:51:41 +0100 Subject: [PATCH 01/50] test yaml-cpp --- src/CMakeLists.txt | 15 ++ src/libs/antares/CMakeLists.txt | 1 + src/libs/antares/yaml-parser/CMakeLists.txt | 13 ++ src/libs/antares/yaml-parser/main.cpp | 158 ++++++++++++++++++++ 4 files changed, 187 insertions(+) create mode 100644 src/libs/antares/yaml-parser/CMakeLists.txt create mode 100644 src/libs/antares/yaml-parser/main.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 292a476a8b..21f74b44d6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -315,6 +315,21 @@ if(NOT minizip_FOUND OR BUILD_MINIZIP) endif() find_package(minizip REQUIRED) + + +FetchContent_Declare( + yaml-cpp + GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git + GIT_TAG 0.8.0 # Can be a tag (yaml-cpp-x.x.x), a commit hash, or a branch name (master) +) +FetchContent_GetProperties(yaml-cpp) + +if(NOT yaml-cpp_POPULATED) + message(STATUS "Fetching yaml-cpp...") + FetchContent_Populate(yaml-cpp) + add_subdirectory(${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR}) +endif() + #wxWidget not needed for all library find is done in ui CMakeLists.txt if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) #Add cmake directory to CMAKE_MODULE_PATH to use specific FindwxWidgets package needed for vcpkg diff --git a/src/libs/antares/CMakeLists.txt b/src/libs/antares/CMakeLists.txt index 05cc04769e..d9bdc2bef2 100644 --- a/src/libs/antares/CMakeLists.txt +++ b/src/libs/antares/CMakeLists.txt @@ -26,6 +26,7 @@ add_subdirectory(study) add_subdirectory(sys) add_subdirectory(utils) add_subdirectory(writer) +add_subdirectory(yaml-parser) set(HEADERS include/antares/antares/antares.h diff --git a/src/libs/antares/yaml-parser/CMakeLists.txt b/src/libs/antares/yaml-parser/CMakeLists.txt new file mode 100644 index 0000000000..3314e8503a --- /dev/null +++ b/src/libs/antares/yaml-parser/CMakeLists.txt @@ -0,0 +1,13 @@ + + +Set(SRCS main.cpp +) + +set(execname "yaml-parser-test") +add_executable(${execname} ${SRCS}) +# INSTALL(EXPORT ${execname} +# FILE yaml-parser-testConfig.cmake +# DESTINATION cmake +# ) + +target_link_libraries(${execname} PUBLIC yaml-cpp::yaml-cpp) # The library or executable that require yaml-cpp library diff --git a/src/libs/antares/yaml-parser/main.cpp b/src/libs/antares/yaml-parser/main.cpp new file mode 100644 index 0000000000..673a489ee8 --- /dev/null +++ b/src/libs/antares/yaml-parser/main.cpp @@ -0,0 +1,158 @@ +#include "yaml-cpp/yaml.h" +#include +#include +#include +#include + +// our data types +struct Vec3 +{ + float x, y, z; +}; +struct Power +{ + std::string name; + int damage; +}; + +struct Monster +{ + std::string name; + Vec3 position; + std::vector powers; +}; +namespace YAML +{ +template<> +struct convert +{ + static Node encode(const Vec3& rhs) + { + Node node; + node.push_back(rhs.x); + node.push_back(rhs.y); + node.push_back(rhs.z); + return node; + } + + static bool decode(const Node& node, Vec3& rhs) + { + if (!node.IsSequence() || node.size() != 3) + { + return false; + } + + rhs.x = node[0].as(); + rhs.y = node[1].as(); + rhs.z = node[2].as(); + return true; + } +}; +template<> +struct convert +{ + static Node encode(const Power& rhs) + { + Node node; + node["name"] = rhs.name; + node["damage"] = rhs.damage; + return node; + } + + static bool decode(const Node& node, Power& rhs) + { + rhs.name = node["name"].as(); + rhs.damage = node["damage"].as(); + return true; + } +}; +template<> +struct convert +{ + static Node encode(const Monster& rhs) + { + Node node; + node["name"] = rhs.name; + // node["position"] = node["position"].as(); + node["position"] = rhs.position; + node["powers"] = rhs.powers; + + return node; + } + + static bool decode(const Node& node, Monster& rhs) + { + rhs.name = node["name"].as(); + rhs.position = node["position"].as(); + const YAML::Node& powers = node["powers"]; + for (const auto power : powers) + { + rhs.powers.push_back(power.as()); + } + return true; + } +}; +} // namespace YAML + +// // now the extraction operators for these types +// void operator>>(const YAML::Node& node, Vec3& v) +// { +// node[0] >> v.x; +// node[1] >> v.y; +// node[2] >> v.z; +// } + +// void operator>>(const YAML::Node& node, Power& power) +// { +// node["name"] >> power.name; +// node["damage"] >> power.damage; +// } + +// void operator>>(const YAML::Node& node, Monster& monster) +// { +// node["name"] >> monster.name; +// node["position"] >> monster.position; +// const YAML::Node& powers = node["powers"]; +// for (unsigned i = 0; i < powers.size(); i++) +// { +// Power power; +// powers[i] >> power; +// monster.powers.push_back(power); +// } +// } + +// int main(int argc, char** argv) +int main() +{ + // YAML::Node doc = YAML::LoadFile(argv[1]); + std::string my_yaml = R"(- name: Ogre + position: [0, 5, 0] + powers: + - name: Club + damage: 10 + - name: Fist + damage: 8 +- name: Dragon + position: [1, 0, 10] + powers: + - name: Fire Breath + damage: 25 + - name: Claws + damage: 15 +- name: Wizard + position: [5, -3, 0] + powers: + - name: Acid Rain + damage: 50 + - name: Staff + damage: 3)"; + YAML::Node doc = YAML::Load(my_yaml); + for (unsigned i = 0; i < doc.size(); i++) + { + Monster monster; + monster = doc[i].as(); + std::cout << monster.name << "\n"; + } + + return 0; +} \ No newline at end of file From 719e73d060e6bb74ed31d2a59b32b802020c8aa9 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 12 Mar 2024 16:19:25 +0100 Subject: [PATCH 02/50] try with vcpkg and apt --- .github/workflows/ubuntu.yml | 1 + .github/workflows/windows-vcpkg.yml | 2 +- src/CMakeLists.txt | 24 ++++++++++----------- src/libs/antares/yaml-parser/CMakeLists.txt | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 6dc54d2f26..1a970237af 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -56,6 +56,7 @@ jobs: sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev sudo apt-get install libboost-test-dev sudo apt-get install g++-10 gcc-10 + sudo apt-get install libyaml-cpp-dev - name: Read antares-deps version id: antares-deps-version diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 7ced3690c9..ed00f11a04 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -39,7 +39,7 @@ jobs: ORTOOLS_DIR: ${{ github.workspace }}/or-tools os: windows-latest test-platform: windows-2022 - vcpkgPackages: wxwidgets boost-test + vcpkgPackages: wxwidgets boost-test yaml-cpp triplet: x64-windows runs-on: windows-latest diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 21f74b44d6..65d8479140 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -317,18 +317,18 @@ find_package(minizip REQUIRED) -FetchContent_Declare( - yaml-cpp - GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git - GIT_TAG 0.8.0 # Can be a tag (yaml-cpp-x.x.x), a commit hash, or a branch name (master) -) -FetchContent_GetProperties(yaml-cpp) - -if(NOT yaml-cpp_POPULATED) - message(STATUS "Fetching yaml-cpp...") - FetchContent_Populate(yaml-cpp) - add_subdirectory(${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR}) -endif() +# FetchContent_Declare( +# yaml-cpp +# GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git +# GIT_TAG 0.8.0 # Can be a tag (yaml-cpp-x.x.x), a commit hash, or a branch name (master) +# ) +# FetchContent_GetProperties(yaml-cpp) + +# if(NOT yaml-cpp_POPULATED) +# message(STATUS "Fetching yaml-cpp...") +# FetchContent_Populate(yaml-cpp) +# add_subdirectory(${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR}) +# endif() #wxWidget not needed for all library find is done in ui CMakeLists.txt if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) diff --git a/src/libs/antares/yaml-parser/CMakeLists.txt b/src/libs/antares/yaml-parser/CMakeLists.txt index 3314e8503a..2db4287747 100644 --- a/src/libs/antares/yaml-parser/CMakeLists.txt +++ b/src/libs/antares/yaml-parser/CMakeLists.txt @@ -1,5 +1,5 @@ - +find_package(yaml-cpp CONFIG REQUIRED) Set(SRCS main.cpp ) @@ -10,4 +10,4 @@ add_executable(${execname} ${SRCS}) # DESTINATION cmake # ) -target_link_libraries(${execname} PUBLIC yaml-cpp::yaml-cpp) # The library or executable that require yaml-cpp library +target_link_libraries(${execname} PUBLIC yaml-cpp) # The library or executable that require yaml-cpp library From 2c025d912c4362d2d93e2fbac061a863aef23a2a Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 12:09:04 +0100 Subject: [PATCH 03/50] build interface lib with antlr4 --- .github/workflows/ubuntu.yml | 2 +- .github/workflows/windows-vcpkg.yml | 2 +- src/libs/antares/CMakeLists.txt | 1 + .../antares/antlr-interface/CMakeLists.txt | 24 + src/libs/antares/antlr-interface/Expr.g4 | 50 + src/libs/antares/antlr-interface/Expr.interp | 50 + src/libs/antares/antlr-interface/Expr.tokens | 30 + .../antlr-interface/ExprBaseVisitor.cpp | 7 + .../antares/antlr-interface/ExprBaseVisitor.h | 80 ++ .../antares/antlr-interface/ExprLexer.cpp | 177 ++++ src/libs/antares/antlr-interface/ExprLexer.h | 51 + .../antares/antlr-interface/ExprLexer.interp | 74 ++ .../antares/antlr-interface/ExprLexer.tokens | 30 + .../antares/antlr-interface/ExprParser.cpp | 884 ++++++++++++++++++ src/libs/antares/antlr-interface/ExprParser.h | 244 +++++ .../antares/antlr-interface/ExprVisitor.cpp | 7 + .../antares/antlr-interface/ExprVisitor.h | 54 ++ src/libs/antares/yaml-parser/CMakeLists.txt | 11 +- src/libs/antares/yaml-parser/main.cpp | 31 +- 19 files changed, 1804 insertions(+), 5 deletions(-) create mode 100644 src/libs/antares/antlr-interface/CMakeLists.txt create mode 100644 src/libs/antares/antlr-interface/Expr.g4 create mode 100644 src/libs/antares/antlr-interface/Expr.interp create mode 100644 src/libs/antares/antlr-interface/Expr.tokens create mode 100644 src/libs/antares/antlr-interface/ExprBaseVisitor.cpp create mode 100644 src/libs/antares/antlr-interface/ExprBaseVisitor.h create mode 100644 src/libs/antares/antlr-interface/ExprLexer.cpp create mode 100644 src/libs/antares/antlr-interface/ExprLexer.h create mode 100644 src/libs/antares/antlr-interface/ExprLexer.interp create mode 100644 src/libs/antares/antlr-interface/ExprLexer.tokens create mode 100644 src/libs/antares/antlr-interface/ExprParser.cpp create mode 100644 src/libs/antares/antlr-interface/ExprParser.h create mode 100644 src/libs/antares/antlr-interface/ExprVisitor.cpp create mode 100644 src/libs/antares/antlr-interface/ExprVisitor.h diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 1a970237af..6f2041b4ad 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -56,7 +56,7 @@ jobs: sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev sudo apt-get install libboost-test-dev sudo apt-get install g++-10 gcc-10 - sudo apt-get install libyaml-cpp-dev + sudo apt-get install libyaml-cpp-dev antlr4 - name: Read antares-deps version id: antares-deps-version diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index ed00f11a04..60f456ccae 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -39,7 +39,7 @@ jobs: ORTOOLS_DIR: ${{ github.workspace }}/or-tools os: windows-latest test-platform: windows-2022 - vcpkgPackages: wxwidgets boost-test yaml-cpp + vcpkgPackages: wxwidgets boost-test yaml-cpp antlr4 triplet: x64-windows runs-on: windows-latest diff --git a/src/libs/antares/CMakeLists.txt b/src/libs/antares/CMakeLists.txt index d9bdc2bef2..5579c86f53 100644 --- a/src/libs/antares/CMakeLists.txt +++ b/src/libs/antares/CMakeLists.txt @@ -27,6 +27,7 @@ add_subdirectory(sys) add_subdirectory(utils) add_subdirectory(writer) add_subdirectory(yaml-parser) +add_subdirectory(antlr-interface) set(HEADERS include/antares/antares/antares.h diff --git a/src/libs/antares/antlr-interface/CMakeLists.txt b/src/libs/antares/antlr-interface/CMakeLists.txt new file mode 100644 index 0000000000..f357c9aeed --- /dev/null +++ b/src/libs/antares/antlr-interface/CMakeLists.txt @@ -0,0 +1,24 @@ + +find_package(antlr4-runtime CONFIG REQUIRED) +Set(SRCS +ExprBaseVisitor.h +ExprBaseVisitor.cpp +ExprLexer.h +ExprLexer.cpp +ExprParser.h +ExprParser.cpp +ExprVisitor.h +ExprVisitor.cpp +) + +set(lib_name "antlr-interface") +add_library(${lib_name} ${SRCS}) + +target_link_libraries(${lib_name} PUBLIC antlr4_shared) # The library or executable that require yaml-cpp library + +#ugly see https://github.com/antlr/antlr4/pull/1612 +get_target_property(antlr4_lib antlr4_shared IMPORTED_IMPLIB_DEBUG) +set(antlr4_include "${antlr4_lib}/../../../include/antlr4-runtime") +message ("************* ${antlr4_include} ***************** ") + +target_include_directories(${lib_name} PUBLIC ${antlr4_include}) \ No newline at end of file diff --git a/src/libs/antares/antlr-interface/Expr.g4 b/src/libs/antares/antlr-interface/Expr.g4 new file mode 100644 index 0000000000..d0d1642497 --- /dev/null +++ b/src/libs/antares/antlr-interface/Expr.g4 @@ -0,0 +1,50 @@ +/* +Copyright (c) 2024, RTE (https://www.rte-france.com) + +See AUTHORS.txt + +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +SPDX-License-Identifier: MPL-2.0 + +This file is part of the Antares project. +*/ + +grammar Expr; + +/* To match the whole input */ +fullexpr: expr EOF; + +shift: TIME (op=('+' | '-') expr)?; + +expr: '-' expr # negation + | expr op=('/' | '*') expr # muldiv + | expr op=('+' | '-') expr # addsub + | expr COMPARISON expr # comparison + | IDENTIFIER # identifier + | IDENTIFIER '.' IDENTIFIER # portField + | NUMBER # number + | '(' expr ')' # expression + | IDENTIFIER '(' expr ')' # function + | IDENTIFIER '[' shift (',' shift)* ']' # timeShift + | IDENTIFIER '[' expr (',' expr )* ']' # timeIndex + | IDENTIFIER '[' shift1=shift '..' shift2=shift ']' # timeShiftRange + | IDENTIFIER '[' expr '..' expr ']' # timeRange + ; + +fragment DIGIT : [0-9] ; +fragment CHAR : [a-zA-Z_]; +fragment CHAR_OR_DIGIT : (CHAR | DIGIT); + +NUMBER : DIGIT+ ('.' DIGIT+)?; +TIME : 't'; +IDENTIFIER : CHAR CHAR_OR_DIGIT*; +COMPARISON : ( '=' | '>=' | '<=' ); +ADDSUB : ( '+' | '-' ); +MULDIV : ( '*' | '/' ); +LBRACKET: '['; +RBRACKET: ']'; + +WS: (' ' | '\t' | '\r'| '\n') -> skip; diff --git a/src/libs/antares/antlr-interface/Expr.interp b/src/libs/antares/antlr-interface/Expr.interp new file mode 100644 index 0000000000..bed351938d --- /dev/null +++ b/src/libs/antares/antlr-interface/Expr.interp @@ -0,0 +1,50 @@ +token literal names: +null +'+' +'-' +'/' +'*' +'.' +'(' +')' +',' +'..' +null +'t' +null +null +null +null +'[' +']' +null + +token symbolic names: +null +null +null +null +null +null +null +null +null +null +NUMBER +TIME +IDENTIFIER +COMPARISON +ADDSUB +MULDIV +LBRACKET +RBRACKET +WS + +rule names: +fullexpr +shift +expr + + +atn: +[4, 1, 18, 86, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 3, 1, 13, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 37, 8, 2, 10, 2, 12, 2, 40, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 49, 8, 2, 10, 2, 12, 2, 52, 9, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 70, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 81, 8, 2, 10, 2, 12, 2, 84, 9, 2, 1, 2, 0, 1, 4, 3, 0, 2, 4, 0, 2, 1, 0, 1, 2, 1, 0, 3, 4, 97, 0, 6, 1, 0, 0, 0, 2, 9, 1, 0, 0, 0, 4, 69, 1, 0, 0, 0, 6, 7, 3, 4, 2, 0, 7, 8, 5, 0, 0, 1, 8, 1, 1, 0, 0, 0, 9, 12, 5, 11, 0, 0, 10, 11, 7, 0, 0, 0, 11, 13, 3, 4, 2, 0, 12, 10, 1, 0, 0, 0, 12, 13, 1, 0, 0, 0, 13, 3, 1, 0, 0, 0, 14, 15, 6, 2, -1, 0, 15, 16, 5, 2, 0, 0, 16, 70, 3, 4, 2, 13, 17, 70, 5, 12, 0, 0, 18, 19, 5, 12, 0, 0, 19, 20, 5, 5, 0, 0, 20, 70, 5, 12, 0, 0, 21, 70, 5, 10, 0, 0, 22, 23, 5, 6, 0, 0, 23, 24, 3, 4, 2, 0, 24, 25, 5, 7, 0, 0, 25, 70, 1, 0, 0, 0, 26, 27, 5, 12, 0, 0, 27, 28, 5, 6, 0, 0, 28, 29, 3, 4, 2, 0, 29, 30, 5, 7, 0, 0, 30, 70, 1, 0, 0, 0, 31, 32, 5, 12, 0, 0, 32, 33, 5, 16, 0, 0, 33, 38, 3, 2, 1, 0, 34, 35, 5, 8, 0, 0, 35, 37, 3, 2, 1, 0, 36, 34, 1, 0, 0, 0, 37, 40, 1, 0, 0, 0, 38, 36, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 41, 1, 0, 0, 0, 40, 38, 1, 0, 0, 0, 41, 42, 5, 17, 0, 0, 42, 70, 1, 0, 0, 0, 43, 44, 5, 12, 0, 0, 44, 45, 5, 16, 0, 0, 45, 50, 3, 4, 2, 0, 46, 47, 5, 8, 0, 0, 47, 49, 3, 4, 2, 0, 48, 46, 1, 0, 0, 0, 49, 52, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 53, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 53, 54, 5, 17, 0, 0, 54, 70, 1, 0, 0, 0, 55, 56, 5, 12, 0, 0, 56, 57, 5, 16, 0, 0, 57, 58, 3, 2, 1, 0, 58, 59, 5, 9, 0, 0, 59, 60, 3, 2, 1, 0, 60, 61, 5, 17, 0, 0, 61, 70, 1, 0, 0, 0, 62, 63, 5, 12, 0, 0, 63, 64, 5, 16, 0, 0, 64, 65, 3, 4, 2, 0, 65, 66, 5, 9, 0, 0, 66, 67, 3, 4, 2, 0, 67, 68, 5, 17, 0, 0, 68, 70, 1, 0, 0, 0, 69, 14, 1, 0, 0, 0, 69, 17, 1, 0, 0, 0, 69, 18, 1, 0, 0, 0, 69, 21, 1, 0, 0, 0, 69, 22, 1, 0, 0, 0, 69, 26, 1, 0, 0, 0, 69, 31, 1, 0, 0, 0, 69, 43, 1, 0, 0, 0, 69, 55, 1, 0, 0, 0, 69, 62, 1, 0, 0, 0, 70, 82, 1, 0, 0, 0, 71, 72, 10, 12, 0, 0, 72, 73, 7, 1, 0, 0, 73, 81, 3, 4, 2, 13, 74, 75, 10, 11, 0, 0, 75, 76, 7, 0, 0, 0, 76, 81, 3, 4, 2, 12, 77, 78, 10, 10, 0, 0, 78, 79, 5, 13, 0, 0, 79, 81, 3, 4, 2, 11, 80, 71, 1, 0, 0, 0, 80, 74, 1, 0, 0, 0, 80, 77, 1, 0, 0, 0, 81, 84, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 5, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 6, 12, 38, 50, 69, 80, 82] \ No newline at end of file diff --git a/src/libs/antares/antlr-interface/Expr.tokens b/src/libs/antares/antlr-interface/Expr.tokens new file mode 100644 index 0000000000..29d96df5f3 --- /dev/null +++ b/src/libs/antares/antlr-interface/Expr.tokens @@ -0,0 +1,30 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +T__6=7 +T__7=8 +T__8=9 +NUMBER=10 +TIME=11 +IDENTIFIER=12 +COMPARISON=13 +ADDSUB=14 +MULDIV=15 +LBRACKET=16 +RBRACKET=17 +WS=18 +'+'=1 +'-'=2 +'/'=3 +'*'=4 +'.'=5 +'('=6 +')'=7 +','=8 +'..'=9 +'t'=11 +'['=16 +']'=17 diff --git a/src/libs/antares/antlr-interface/ExprBaseVisitor.cpp b/src/libs/antares/antlr-interface/ExprBaseVisitor.cpp new file mode 100644 index 0000000000..42d6fef5d3 --- /dev/null +++ b/src/libs/antares/antlr-interface/ExprBaseVisitor.cpp @@ -0,0 +1,7 @@ + +// Generated from Expr.g4 by ANTLR 4.13.1 + + +#include "ExprBaseVisitor.h" + + diff --git a/src/libs/antares/antlr-interface/ExprBaseVisitor.h b/src/libs/antares/antlr-interface/ExprBaseVisitor.h new file mode 100644 index 0000000000..a8af3c573f --- /dev/null +++ b/src/libs/antares/antlr-interface/ExprBaseVisitor.h @@ -0,0 +1,80 @@ + +// Generated from Expr.g4 by ANTLR 4.13.1 + +#pragma once + + +#include "antlr4-runtime.h" +#include "ExprVisitor.h" + + +/** + * This class provides an empty implementation of ExprVisitor, which can be + * extended to create a visitor which only needs to handle a subset of the available methods. + */ +class ExprBaseVisitor : public ExprVisitor { +public: + + virtual std::any visitFullexpr(ExprParser::FullexprContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitShift(ExprParser::ShiftContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitIdentifier(ExprParser::IdentifierContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitNegation(ExprParser::NegationContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitExpression(ExprParser::ExpressionContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitComparison(ExprParser::ComparisonContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitAddsub(ExprParser::AddsubContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitPortField(ExprParser::PortFieldContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitMuldiv(ExprParser::MuldivContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitNumber(ExprParser::NumberContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTimeIndex(ExprParser::TimeIndexContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTimeShift(ExprParser::TimeShiftContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitFunction(ExprParser::FunctionContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTimeShiftRange(ExprParser::TimeShiftRangeContext *ctx) override { + return visitChildren(ctx); + } + + virtual std::any visitTimeRange(ExprParser::TimeRangeContext *ctx) override { + return visitChildren(ctx); + } + + +}; + diff --git a/src/libs/antares/antlr-interface/ExprLexer.cpp b/src/libs/antares/antlr-interface/ExprLexer.cpp new file mode 100644 index 0000000000..a645fcddd0 --- /dev/null +++ b/src/libs/antares/antlr-interface/ExprLexer.cpp @@ -0,0 +1,177 @@ + +// Generated from Expr.g4 by ANTLR 4.13.1 + + +#include "ExprLexer.h" + + +using namespace antlr4; + + + +using namespace antlr4; + +namespace { + +struct ExprLexerStaticData final { + ExprLexerStaticData(std::vector ruleNames, + std::vector channelNames, + std::vector modeNames, + std::vector literalNames, + std::vector symbolicNames) + : ruleNames(std::move(ruleNames)), channelNames(std::move(channelNames)), + modeNames(std::move(modeNames)), literalNames(std::move(literalNames)), + symbolicNames(std::move(symbolicNames)), + vocabulary(this->literalNames, this->symbolicNames) {} + + ExprLexerStaticData(const ExprLexerStaticData&) = delete; + ExprLexerStaticData(ExprLexerStaticData&&) = delete; + ExprLexerStaticData& operator=(const ExprLexerStaticData&) = delete; + ExprLexerStaticData& operator=(ExprLexerStaticData&&) = delete; + + std::vector decisionToDFA; + antlr4::atn::PredictionContextCache sharedContextCache; + const std::vector ruleNames; + const std::vector channelNames; + const std::vector modeNames; + const std::vector literalNames; + const std::vector symbolicNames; + const antlr4::dfa::Vocabulary vocabulary; + antlr4::atn::SerializedATNView serializedATN; + std::unique_ptr atn; +}; + +::antlr4::internal::OnceFlag exprlexerLexerOnceFlag; +#if ANTLR4_USE_THREAD_LOCAL_CACHE +static thread_local +#endif +ExprLexerStaticData *exprlexerLexerStaticData = nullptr; + +void exprlexerLexerInitialize() { +#if ANTLR4_USE_THREAD_LOCAL_CACHE + if (exprlexerLexerStaticData != nullptr) { + return; + } +#else + assert(exprlexerLexerStaticData == nullptr); +#endif + auto staticData = std::make_unique( + std::vector{ + "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8", + "DIGIT", "CHAR", "CHAR_OR_DIGIT", "NUMBER", "TIME", "IDENTIFIER", + "COMPARISON", "ADDSUB", "MULDIV", "LBRACKET", "RBRACKET", "WS" + }, + std::vector{ + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }, + std::vector{ + "DEFAULT_MODE" + }, + std::vector{ + "", "'+'", "'-'", "'/'", "'*'", "'.'", "'('", "')'", "','", "'..'", + "", "'t'", "", "", "", "", "'['", "']'" + }, + std::vector{ + "", "", "", "", "", "", "", "", "", "", "NUMBER", "TIME", "IDENTIFIER", + "COMPARISON", "ADDSUB", "MULDIV", "LBRACKET", "RBRACKET", "WS" + } + ); + static const int32_t serializedATNSegment[] = { + 4,0,18,111,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14, + 7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,1,0, + 1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1, + 8,1,9,1,9,1,10,1,10,1,11,1,11,3,11,69,8,11,1,12,4,12,72,8,12,11,12,12, + 12,73,1,12,1,12,4,12,78,8,12,11,12,12,12,79,3,12,82,8,12,1,13,1,13,1, + 14,1,14,5,14,88,8,14,10,14,12,14,91,9,14,1,15,1,15,1,15,1,15,1,15,3,15, + 98,8,15,1,16,1,16,1,17,1,17,1,18,1,18,1,19,1,19,1,20,1,20,1,20,1,20,0, + 0,21,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,0,21,0,23,0,25,10,27, + 11,29,12,31,13,33,14,35,15,37,16,39,17,41,18,1,0,5,1,0,48,57,3,0,65,90, + 95,95,97,122,2,0,43,43,45,45,2,0,42,42,47,47,3,0,9,10,13,13,32,32,114, + 0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0, + 0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0, + 0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39, + 1,0,0,0,0,41,1,0,0,0,1,43,1,0,0,0,3,45,1,0,0,0,5,47,1,0,0,0,7,49,1,0, + 0,0,9,51,1,0,0,0,11,53,1,0,0,0,13,55,1,0,0,0,15,57,1,0,0,0,17,59,1,0, + 0,0,19,62,1,0,0,0,21,64,1,0,0,0,23,68,1,0,0,0,25,71,1,0,0,0,27,83,1,0, + 0,0,29,85,1,0,0,0,31,97,1,0,0,0,33,99,1,0,0,0,35,101,1,0,0,0,37,103,1, + 0,0,0,39,105,1,0,0,0,41,107,1,0,0,0,43,44,5,43,0,0,44,2,1,0,0,0,45,46, + 5,45,0,0,46,4,1,0,0,0,47,48,5,47,0,0,48,6,1,0,0,0,49,50,5,42,0,0,50,8, + 1,0,0,0,51,52,5,46,0,0,52,10,1,0,0,0,53,54,5,40,0,0,54,12,1,0,0,0,55, + 56,5,41,0,0,56,14,1,0,0,0,57,58,5,44,0,0,58,16,1,0,0,0,59,60,5,46,0,0, + 60,61,5,46,0,0,61,18,1,0,0,0,62,63,7,0,0,0,63,20,1,0,0,0,64,65,7,1,0, + 0,65,22,1,0,0,0,66,69,3,21,10,0,67,69,3,19,9,0,68,66,1,0,0,0,68,67,1, + 0,0,0,69,24,1,0,0,0,70,72,3,19,9,0,71,70,1,0,0,0,72,73,1,0,0,0,73,71, + 1,0,0,0,73,74,1,0,0,0,74,81,1,0,0,0,75,77,5,46,0,0,76,78,3,19,9,0,77, + 76,1,0,0,0,78,79,1,0,0,0,79,77,1,0,0,0,79,80,1,0,0,0,80,82,1,0,0,0,81, + 75,1,0,0,0,81,82,1,0,0,0,82,26,1,0,0,0,83,84,5,116,0,0,84,28,1,0,0,0, + 85,89,3,21,10,0,86,88,3,23,11,0,87,86,1,0,0,0,88,91,1,0,0,0,89,87,1,0, + 0,0,89,90,1,0,0,0,90,30,1,0,0,0,91,89,1,0,0,0,92,98,5,61,0,0,93,94,5, + 62,0,0,94,98,5,61,0,0,95,96,5,60,0,0,96,98,5,61,0,0,97,92,1,0,0,0,97, + 93,1,0,0,0,97,95,1,0,0,0,98,32,1,0,0,0,99,100,7,2,0,0,100,34,1,0,0,0, + 101,102,7,3,0,0,102,36,1,0,0,0,103,104,5,91,0,0,104,38,1,0,0,0,105,106, + 5,93,0,0,106,40,1,0,0,0,107,108,7,4,0,0,108,109,1,0,0,0,109,110,6,20, + 0,0,110,42,1,0,0,0,7,0,68,73,79,81,89,97,1,6,0,0 + }; + staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0])); + + antlr4::atn::ATNDeserializer deserializer; + staticData->atn = deserializer.deserialize(staticData->serializedATN); + + const size_t count = staticData->atn->getNumberOfDecisions(); + staticData->decisionToDFA.reserve(count); + for (size_t i = 0; i < count; i++) { + staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i); + } + exprlexerLexerStaticData = staticData.release(); +} + +} + +ExprLexer::ExprLexer(CharStream *input) : Lexer(input) { + ExprLexer::initialize(); + _interpreter = new atn::LexerATNSimulator(this, *exprlexerLexerStaticData->atn, exprlexerLexerStaticData->decisionToDFA, exprlexerLexerStaticData->sharedContextCache); +} + +ExprLexer::~ExprLexer() { + delete _interpreter; +} + +std::string ExprLexer::getGrammarFileName() const { + return "Expr.g4"; +} + +const std::vector& ExprLexer::getRuleNames() const { + return exprlexerLexerStaticData->ruleNames; +} + +const std::vector& ExprLexer::getChannelNames() const { + return exprlexerLexerStaticData->channelNames; +} + +const std::vector& ExprLexer::getModeNames() const { + return exprlexerLexerStaticData->modeNames; +} + +const dfa::Vocabulary& ExprLexer::getVocabulary() const { + return exprlexerLexerStaticData->vocabulary; +} + +antlr4::atn::SerializedATNView ExprLexer::getSerializedATN() const { + return exprlexerLexerStaticData->serializedATN; +} + +const atn::ATN& ExprLexer::getATN() const { + return *exprlexerLexerStaticData->atn; +} + + + + +void ExprLexer::initialize() { +#if ANTLR4_USE_THREAD_LOCAL_CACHE + exprlexerLexerInitialize(); +#else + ::antlr4::internal::call_once(exprlexerLexerOnceFlag, exprlexerLexerInitialize); +#endif +} diff --git a/src/libs/antares/antlr-interface/ExprLexer.h b/src/libs/antares/antlr-interface/ExprLexer.h new file mode 100644 index 0000000000..c7db2c5f77 --- /dev/null +++ b/src/libs/antares/antlr-interface/ExprLexer.h @@ -0,0 +1,51 @@ + +// Generated from Expr.g4 by ANTLR 4.13.1 + +#pragma once + + +#include "antlr4-runtime.h" + + + + +class ExprLexer : public antlr4::Lexer { +public: + enum { + T__0 = 1, T__1 = 2, T__2 = 3, T__3 = 4, T__4 = 5, T__5 = 6, T__6 = 7, + T__7 = 8, T__8 = 9, NUMBER = 10, TIME = 11, IDENTIFIER = 12, COMPARISON = 13, + ADDSUB = 14, MULDIV = 15, LBRACKET = 16, RBRACKET = 17, WS = 18 + }; + + explicit ExprLexer(antlr4::CharStream *input); + + ~ExprLexer() override; + + + std::string getGrammarFileName() const override; + + const std::vector& getRuleNames() const override; + + const std::vector& getChannelNames() const override; + + const std::vector& getModeNames() const override; + + const antlr4::dfa::Vocabulary& getVocabulary() const override; + + antlr4::atn::SerializedATNView getSerializedATN() const override; + + const antlr4::atn::ATN& getATN() const override; + + // By default the static state used to implement the lexer is lazily initialized during the first + // call to the constructor. You can call this function if you wish to initialize the static state + // ahead of time. + static void initialize(); + +private: + + // Individual action functions triggered by action() above. + + // Individual semantic predicate functions triggered by sempred() above. + +}; + diff --git a/src/libs/antares/antlr-interface/ExprLexer.interp b/src/libs/antares/antlr-interface/ExprLexer.interp new file mode 100644 index 0000000000..e98cab1e7c --- /dev/null +++ b/src/libs/antares/antlr-interface/ExprLexer.interp @@ -0,0 +1,74 @@ +token literal names: +null +'+' +'-' +'/' +'*' +'.' +'(' +')' +',' +'..' +null +'t' +null +null +null +null +'[' +']' +null + +token symbolic names: +null +null +null +null +null +null +null +null +null +null +NUMBER +TIME +IDENTIFIER +COMPARISON +ADDSUB +MULDIV +LBRACKET +RBRACKET +WS + +rule names: +T__0 +T__1 +T__2 +T__3 +T__4 +T__5 +T__6 +T__7 +T__8 +DIGIT +CHAR +CHAR_OR_DIGIT +NUMBER +TIME +IDENTIFIER +COMPARISON +ADDSUB +MULDIV +LBRACKET +RBRACKET +WS + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[4, 0, 18, 111, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 3, 11, 69, 8, 11, 1, 12, 4, 12, 72, 8, 12, 11, 12, 12, 12, 73, 1, 12, 1, 12, 4, 12, 78, 8, 12, 11, 12, 12, 12, 79, 3, 12, 82, 8, 12, 1, 13, 1, 13, 1, 14, 1, 14, 5, 14, 88, 8, 14, 10, 14, 12, 14, 91, 9, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 98, 8, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 0, 0, 21, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 0, 21, 0, 23, 0, 25, 10, 27, 11, 29, 12, 31, 13, 33, 14, 35, 15, 37, 16, 39, 17, 41, 18, 1, 0, 5, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 2, 0, 43, 43, 45, 45, 2, 0, 42, 42, 47, 47, 3, 0, 9, 10, 13, 13, 32, 32, 114, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 1, 43, 1, 0, 0, 0, 3, 45, 1, 0, 0, 0, 5, 47, 1, 0, 0, 0, 7, 49, 1, 0, 0, 0, 9, 51, 1, 0, 0, 0, 11, 53, 1, 0, 0, 0, 13, 55, 1, 0, 0, 0, 15, 57, 1, 0, 0, 0, 17, 59, 1, 0, 0, 0, 19, 62, 1, 0, 0, 0, 21, 64, 1, 0, 0, 0, 23, 68, 1, 0, 0, 0, 25, 71, 1, 0, 0, 0, 27, 83, 1, 0, 0, 0, 29, 85, 1, 0, 0, 0, 31, 97, 1, 0, 0, 0, 33, 99, 1, 0, 0, 0, 35, 101, 1, 0, 0, 0, 37, 103, 1, 0, 0, 0, 39, 105, 1, 0, 0, 0, 41, 107, 1, 0, 0, 0, 43, 44, 5, 43, 0, 0, 44, 2, 1, 0, 0, 0, 45, 46, 5, 45, 0, 0, 46, 4, 1, 0, 0, 0, 47, 48, 5, 47, 0, 0, 48, 6, 1, 0, 0, 0, 49, 50, 5, 42, 0, 0, 50, 8, 1, 0, 0, 0, 51, 52, 5, 46, 0, 0, 52, 10, 1, 0, 0, 0, 53, 54, 5, 40, 0, 0, 54, 12, 1, 0, 0, 0, 55, 56, 5, 41, 0, 0, 56, 14, 1, 0, 0, 0, 57, 58, 5, 44, 0, 0, 58, 16, 1, 0, 0, 0, 59, 60, 5, 46, 0, 0, 60, 61, 5, 46, 0, 0, 61, 18, 1, 0, 0, 0, 62, 63, 7, 0, 0, 0, 63, 20, 1, 0, 0, 0, 64, 65, 7, 1, 0, 0, 65, 22, 1, 0, 0, 0, 66, 69, 3, 21, 10, 0, 67, 69, 3, 19, 9, 0, 68, 66, 1, 0, 0, 0, 68, 67, 1, 0, 0, 0, 69, 24, 1, 0, 0, 0, 70, 72, 3, 19, 9, 0, 71, 70, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 71, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 81, 1, 0, 0, 0, 75, 77, 5, 46, 0, 0, 76, 78, 3, 19, 9, 0, 77, 76, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 77, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 82, 1, 0, 0, 0, 81, 75, 1, 0, 0, 0, 81, 82, 1, 0, 0, 0, 82, 26, 1, 0, 0, 0, 83, 84, 5, 116, 0, 0, 84, 28, 1, 0, 0, 0, 85, 89, 3, 21, 10, 0, 86, 88, 3, 23, 11, 0, 87, 86, 1, 0, 0, 0, 88, 91, 1, 0, 0, 0, 89, 87, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 30, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, 92, 98, 5, 61, 0, 0, 93, 94, 5, 62, 0, 0, 94, 98, 5, 61, 0, 0, 95, 96, 5, 60, 0, 0, 96, 98, 5, 61, 0, 0, 97, 92, 1, 0, 0, 0, 97, 93, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 98, 32, 1, 0, 0, 0, 99, 100, 7, 2, 0, 0, 100, 34, 1, 0, 0, 0, 101, 102, 7, 3, 0, 0, 102, 36, 1, 0, 0, 0, 103, 104, 5, 91, 0, 0, 104, 38, 1, 0, 0, 0, 105, 106, 5, 93, 0, 0, 106, 40, 1, 0, 0, 0, 107, 108, 7, 4, 0, 0, 108, 109, 1, 0, 0, 0, 109, 110, 6, 20, 0, 0, 110, 42, 1, 0, 0, 0, 7, 0, 68, 73, 79, 81, 89, 97, 1, 6, 0, 0] \ No newline at end of file diff --git a/src/libs/antares/antlr-interface/ExprLexer.tokens b/src/libs/antares/antlr-interface/ExprLexer.tokens new file mode 100644 index 0000000000..29d96df5f3 --- /dev/null +++ b/src/libs/antares/antlr-interface/ExprLexer.tokens @@ -0,0 +1,30 @@ +T__0=1 +T__1=2 +T__2=3 +T__3=4 +T__4=5 +T__5=6 +T__6=7 +T__7=8 +T__8=9 +NUMBER=10 +TIME=11 +IDENTIFIER=12 +COMPARISON=13 +ADDSUB=14 +MULDIV=15 +LBRACKET=16 +RBRACKET=17 +WS=18 +'+'=1 +'-'=2 +'/'=3 +'*'=4 +'.'=5 +'('=6 +')'=7 +','=8 +'..'=9 +'t'=11 +'['=16 +']'=17 diff --git a/src/libs/antares/antlr-interface/ExprParser.cpp b/src/libs/antares/antlr-interface/ExprParser.cpp new file mode 100644 index 0000000000..3c688d96d3 --- /dev/null +++ b/src/libs/antares/antlr-interface/ExprParser.cpp @@ -0,0 +1,884 @@ + +// Generated from Expr.g4 by ANTLR 4.13.1 + + +#include "ExprVisitor.h" + +#include "ExprParser.h" + + +using namespace antlrcpp; + +using namespace antlr4; + +namespace { + +struct ExprParserStaticData final { + ExprParserStaticData(std::vector ruleNames, + std::vector literalNames, + std::vector symbolicNames) + : ruleNames(std::move(ruleNames)), literalNames(std::move(literalNames)), + symbolicNames(std::move(symbolicNames)), + vocabulary(this->literalNames, this->symbolicNames) {} + + ExprParserStaticData(const ExprParserStaticData&) = delete; + ExprParserStaticData(ExprParserStaticData&&) = delete; + ExprParserStaticData& operator=(const ExprParserStaticData&) = delete; + ExprParserStaticData& operator=(ExprParserStaticData&&) = delete; + + std::vector decisionToDFA; + antlr4::atn::PredictionContextCache sharedContextCache; + const std::vector ruleNames; + const std::vector literalNames; + const std::vector symbolicNames; + const antlr4::dfa::Vocabulary vocabulary; + antlr4::atn::SerializedATNView serializedATN; + std::unique_ptr atn; +}; + +::antlr4::internal::OnceFlag exprParserOnceFlag; +#if ANTLR4_USE_THREAD_LOCAL_CACHE +static thread_local +#endif +ExprParserStaticData *exprParserStaticData = nullptr; + +void exprParserInitialize() { +#if ANTLR4_USE_THREAD_LOCAL_CACHE + if (exprParserStaticData != nullptr) { + return; + } +#else + assert(exprParserStaticData == nullptr); +#endif + auto staticData = std::make_unique( + std::vector{ + "fullexpr", "shift", "expr" + }, + std::vector{ + "", "'+'", "'-'", "'/'", "'*'", "'.'", "'('", "')'", "','", "'..'", + "", "'t'", "", "", "", "", "'['", "']'" + }, + std::vector{ + "", "", "", "", "", "", "", "", "", "", "NUMBER", "TIME", "IDENTIFIER", + "COMPARISON", "ADDSUB", "MULDIV", "LBRACKET", "RBRACKET", "WS" + } + ); + static const int32_t serializedATNSegment[] = { + 4,1,18,86,2,0,7,0,2,1,7,1,2,2,7,2,1,0,1,0,1,0,1,1,1,1,1,1,3,1,13,8,1, + 1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1, + 2,1,2,1,2,1,2,1,2,5,2,37,8,2,10,2,12,2,40,9,2,1,2,1,2,1,2,1,2,1,2,1,2, + 1,2,5,2,49,8,2,10,2,12,2,52,9,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1, + 2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,70,8,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, + 1,2,5,2,81,8,2,10,2,12,2,84,9,2,1,2,0,1,4,3,0,2,4,0,2,1,0,1,2,1,0,3,4, + 97,0,6,1,0,0,0,2,9,1,0,0,0,4,69,1,0,0,0,6,7,3,4,2,0,7,8,5,0,0,1,8,1,1, + 0,0,0,9,12,5,11,0,0,10,11,7,0,0,0,11,13,3,4,2,0,12,10,1,0,0,0,12,13,1, + 0,0,0,13,3,1,0,0,0,14,15,6,2,-1,0,15,16,5,2,0,0,16,70,3,4,2,13,17,70, + 5,12,0,0,18,19,5,12,0,0,19,20,5,5,0,0,20,70,5,12,0,0,21,70,5,10,0,0,22, + 23,5,6,0,0,23,24,3,4,2,0,24,25,5,7,0,0,25,70,1,0,0,0,26,27,5,12,0,0,27, + 28,5,6,0,0,28,29,3,4,2,0,29,30,5,7,0,0,30,70,1,0,0,0,31,32,5,12,0,0,32, + 33,5,16,0,0,33,38,3,2,1,0,34,35,5,8,0,0,35,37,3,2,1,0,36,34,1,0,0,0,37, + 40,1,0,0,0,38,36,1,0,0,0,38,39,1,0,0,0,39,41,1,0,0,0,40,38,1,0,0,0,41, + 42,5,17,0,0,42,70,1,0,0,0,43,44,5,12,0,0,44,45,5,16,0,0,45,50,3,4,2,0, + 46,47,5,8,0,0,47,49,3,4,2,0,48,46,1,0,0,0,49,52,1,0,0,0,50,48,1,0,0,0, + 50,51,1,0,0,0,51,53,1,0,0,0,52,50,1,0,0,0,53,54,5,17,0,0,54,70,1,0,0, + 0,55,56,5,12,0,0,56,57,5,16,0,0,57,58,3,2,1,0,58,59,5,9,0,0,59,60,3,2, + 1,0,60,61,5,17,0,0,61,70,1,0,0,0,62,63,5,12,0,0,63,64,5,16,0,0,64,65, + 3,4,2,0,65,66,5,9,0,0,66,67,3,4,2,0,67,68,5,17,0,0,68,70,1,0,0,0,69,14, + 1,0,0,0,69,17,1,0,0,0,69,18,1,0,0,0,69,21,1,0,0,0,69,22,1,0,0,0,69,26, + 1,0,0,0,69,31,1,0,0,0,69,43,1,0,0,0,69,55,1,0,0,0,69,62,1,0,0,0,70,82, + 1,0,0,0,71,72,10,12,0,0,72,73,7,1,0,0,73,81,3,4,2,13,74,75,10,11,0,0, + 75,76,7,0,0,0,76,81,3,4,2,12,77,78,10,10,0,0,78,79,5,13,0,0,79,81,3,4, + 2,11,80,71,1,0,0,0,80,74,1,0,0,0,80,77,1,0,0,0,81,84,1,0,0,0,82,80,1, + 0,0,0,82,83,1,0,0,0,83,5,1,0,0,0,84,82,1,0,0,0,6,12,38,50,69,80,82 + }; + staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0])); + + antlr4::atn::ATNDeserializer deserializer; + staticData->atn = deserializer.deserialize(staticData->serializedATN); + + const size_t count = staticData->atn->getNumberOfDecisions(); + staticData->decisionToDFA.reserve(count); + for (size_t i = 0; i < count; i++) { + staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i); + } + exprParserStaticData = staticData.release(); +} + +} + +ExprParser::ExprParser(TokenStream *input) : ExprParser(input, antlr4::atn::ParserATNSimulatorOptions()) {} + +ExprParser::ExprParser(TokenStream *input, const antlr4::atn::ParserATNSimulatorOptions &options) : Parser(input) { + ExprParser::initialize(); + _interpreter = new atn::ParserATNSimulator(this, *exprParserStaticData->atn, exprParserStaticData->decisionToDFA, exprParserStaticData->sharedContextCache, options); +} + +ExprParser::~ExprParser() { + delete _interpreter; +} + +const atn::ATN& ExprParser::getATN() const { + return *exprParserStaticData->atn; +} + +std::string ExprParser::getGrammarFileName() const { + return "Expr.g4"; +} + +const std::vector& ExprParser::getRuleNames() const { + return exprParserStaticData->ruleNames; +} + +const dfa::Vocabulary& ExprParser::getVocabulary() const { + return exprParserStaticData->vocabulary; +} + +antlr4::atn::SerializedATNView ExprParser::getSerializedATN() const { + return exprParserStaticData->serializedATN; +} + + +//----------------- FullexprContext ------------------------------------------------------------------ + +ExprParser::FullexprContext::FullexprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +ExprParser::ExprContext* ExprParser::FullexprContext::expr() { + return getRuleContext(0); +} + +tree::TerminalNode* ExprParser::FullexprContext::EOF() { + return getToken(ExprParser::EOF, 0); +} + + +size_t ExprParser::FullexprContext::getRuleIndex() const { + return ExprParser::RuleFullexpr; +} + + +std::any ExprParser::FullexprContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitFullexpr(this); + else + return visitor->visitChildren(this); +} + +ExprParser::FullexprContext* ExprParser::fullexpr() { + FullexprContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 0, ExprParser::RuleFullexpr); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(6); + expr(0); + setState(7); + match(ExprParser::EOF); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ShiftContext ------------------------------------------------------------------ + +ExprParser::ShiftContext::ShiftContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +tree::TerminalNode* ExprParser::ShiftContext::TIME() { + return getToken(ExprParser::TIME, 0); +} + +ExprParser::ExprContext* ExprParser::ShiftContext::expr() { + return getRuleContext(0); +} + + +size_t ExprParser::ShiftContext::getRuleIndex() const { + return ExprParser::RuleShift; +} + + +std::any ExprParser::ShiftContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitShift(this); + else + return visitor->visitChildren(this); +} + +ExprParser::ShiftContext* ExprParser::shift() { + ShiftContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 2, ExprParser::RuleShift); + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(9); + match(ExprParser::TIME); + setState(12); + _errHandler->sync(this); + + _la = _input->LA(1); + if (_la == ExprParser::T__0 + + || _la == ExprParser::T__1) { + setState(10); + antlrcpp::downCast(_localctx)->op = _input->LT(1); + _la = _input->LA(1); + if (!(_la == ExprParser::T__0 + + || _la == ExprParser::T__1)) { + antlrcpp::downCast(_localctx)->op = _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(11); + expr(0); + } + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + +//----------------- ExprContext ------------------------------------------------------------------ + +ExprParser::ExprContext::ExprContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + + +size_t ExprParser::ExprContext::getRuleIndex() const { + return ExprParser::RuleExpr; +} + +void ExprParser::ExprContext::copyFrom(ExprContext *ctx) { + ParserRuleContext::copyFrom(ctx); +} + +//----------------- IdentifierContext ------------------------------------------------------------------ + +tree::TerminalNode* ExprParser::IdentifierContext::IDENTIFIER() { + return getToken(ExprParser::IDENTIFIER, 0); +} + +ExprParser::IdentifierContext::IdentifierContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::IdentifierContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitIdentifier(this); + else + return visitor->visitChildren(this); +} +//----------------- NegationContext ------------------------------------------------------------------ + +ExprParser::ExprContext* ExprParser::NegationContext::expr() { + return getRuleContext(0); +} + +ExprParser::NegationContext::NegationContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::NegationContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitNegation(this); + else + return visitor->visitChildren(this); +} +//----------------- ExpressionContext ------------------------------------------------------------------ + +ExprParser::ExprContext* ExprParser::ExpressionContext::expr() { + return getRuleContext(0); +} + +ExprParser::ExpressionContext::ExpressionContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::ExpressionContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitExpression(this); + else + return visitor->visitChildren(this); +} +//----------------- ComparisonContext ------------------------------------------------------------------ + +std::vector ExprParser::ComparisonContext::expr() { + return getRuleContexts(); +} + +ExprParser::ExprContext* ExprParser::ComparisonContext::expr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ExprParser::ComparisonContext::COMPARISON() { + return getToken(ExprParser::COMPARISON, 0); +} + +ExprParser::ComparisonContext::ComparisonContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::ComparisonContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitComparison(this); + else + return visitor->visitChildren(this); +} +//----------------- AddsubContext ------------------------------------------------------------------ + +std::vector ExprParser::AddsubContext::expr() { + return getRuleContexts(); +} + +ExprParser::ExprContext* ExprParser::AddsubContext::expr(size_t i) { + return getRuleContext(i); +} + +ExprParser::AddsubContext::AddsubContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::AddsubContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitAddsub(this); + else + return visitor->visitChildren(this); +} +//----------------- PortFieldContext ------------------------------------------------------------------ + +std::vector ExprParser::PortFieldContext::IDENTIFIER() { + return getTokens(ExprParser::IDENTIFIER); +} + +tree::TerminalNode* ExprParser::PortFieldContext::IDENTIFIER(size_t i) { + return getToken(ExprParser::IDENTIFIER, i); +} + +ExprParser::PortFieldContext::PortFieldContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::PortFieldContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitPortField(this); + else + return visitor->visitChildren(this); +} +//----------------- MuldivContext ------------------------------------------------------------------ + +std::vector ExprParser::MuldivContext::expr() { + return getRuleContexts(); +} + +ExprParser::ExprContext* ExprParser::MuldivContext::expr(size_t i) { + return getRuleContext(i); +} + +ExprParser::MuldivContext::MuldivContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::MuldivContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitMuldiv(this); + else + return visitor->visitChildren(this); +} +//----------------- NumberContext ------------------------------------------------------------------ + +tree::TerminalNode* ExprParser::NumberContext::NUMBER() { + return getToken(ExprParser::NUMBER, 0); +} + +ExprParser::NumberContext::NumberContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::NumberContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitNumber(this); + else + return visitor->visitChildren(this); +} +//----------------- TimeIndexContext ------------------------------------------------------------------ + +tree::TerminalNode* ExprParser::TimeIndexContext::IDENTIFIER() { + return getToken(ExprParser::IDENTIFIER, 0); +} + +tree::TerminalNode* ExprParser::TimeIndexContext::LBRACKET() { + return getToken(ExprParser::LBRACKET, 0); +} + +std::vector ExprParser::TimeIndexContext::expr() { + return getRuleContexts(); +} + +ExprParser::ExprContext* ExprParser::TimeIndexContext::expr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ExprParser::TimeIndexContext::RBRACKET() { + return getToken(ExprParser::RBRACKET, 0); +} + +ExprParser::TimeIndexContext::TimeIndexContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::TimeIndexContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTimeIndex(this); + else + return visitor->visitChildren(this); +} +//----------------- TimeShiftContext ------------------------------------------------------------------ + +tree::TerminalNode* ExprParser::TimeShiftContext::IDENTIFIER() { + return getToken(ExprParser::IDENTIFIER, 0); +} + +tree::TerminalNode* ExprParser::TimeShiftContext::LBRACKET() { + return getToken(ExprParser::LBRACKET, 0); +} + +std::vector ExprParser::TimeShiftContext::shift() { + return getRuleContexts(); +} + +ExprParser::ShiftContext* ExprParser::TimeShiftContext::shift(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ExprParser::TimeShiftContext::RBRACKET() { + return getToken(ExprParser::RBRACKET, 0); +} + +ExprParser::TimeShiftContext::TimeShiftContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::TimeShiftContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTimeShift(this); + else + return visitor->visitChildren(this); +} +//----------------- FunctionContext ------------------------------------------------------------------ + +tree::TerminalNode* ExprParser::FunctionContext::IDENTIFIER() { + return getToken(ExprParser::IDENTIFIER, 0); +} + +ExprParser::ExprContext* ExprParser::FunctionContext::expr() { + return getRuleContext(0); +} + +ExprParser::FunctionContext::FunctionContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::FunctionContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitFunction(this); + else + return visitor->visitChildren(this); +} +//----------------- TimeShiftRangeContext ------------------------------------------------------------------ + +tree::TerminalNode* ExprParser::TimeShiftRangeContext::IDENTIFIER() { + return getToken(ExprParser::IDENTIFIER, 0); +} + +tree::TerminalNode* ExprParser::TimeShiftRangeContext::LBRACKET() { + return getToken(ExprParser::LBRACKET, 0); +} + +tree::TerminalNode* ExprParser::TimeShiftRangeContext::RBRACKET() { + return getToken(ExprParser::RBRACKET, 0); +} + +std::vector ExprParser::TimeShiftRangeContext::shift() { + return getRuleContexts(); +} + +ExprParser::ShiftContext* ExprParser::TimeShiftRangeContext::shift(size_t i) { + return getRuleContext(i); +} + +ExprParser::TimeShiftRangeContext::TimeShiftRangeContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::TimeShiftRangeContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTimeShiftRange(this); + else + return visitor->visitChildren(this); +} +//----------------- TimeRangeContext ------------------------------------------------------------------ + +tree::TerminalNode* ExprParser::TimeRangeContext::IDENTIFIER() { + return getToken(ExprParser::IDENTIFIER, 0); +} + +tree::TerminalNode* ExprParser::TimeRangeContext::LBRACKET() { + return getToken(ExprParser::LBRACKET, 0); +} + +std::vector ExprParser::TimeRangeContext::expr() { + return getRuleContexts(); +} + +ExprParser::ExprContext* ExprParser::TimeRangeContext::expr(size_t i) { + return getRuleContext(i); +} + +tree::TerminalNode* ExprParser::TimeRangeContext::RBRACKET() { + return getToken(ExprParser::RBRACKET, 0); +} + +ExprParser::TimeRangeContext::TimeRangeContext(ExprContext *ctx) { copyFrom(ctx); } + + +std::any ExprParser::TimeRangeContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitTimeRange(this); + else + return visitor->visitChildren(this); +} + +ExprParser::ExprContext* ExprParser::expr() { + return expr(0); +} + +ExprParser::ExprContext* ExprParser::expr(int precedence) { + ParserRuleContext *parentContext = _ctx; + size_t parentState = getState(); + ExprParser::ExprContext *_localctx = _tracker.createInstance(_ctx, parentState); + ExprParser::ExprContext *previousContext = _localctx; + (void)previousContext; // Silence compiler, in case the context is not used by generated code. + size_t startState = 4; + enterRecursionRule(_localctx, 4, ExprParser::RuleExpr, precedence); + + size_t _la = 0; + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + unrollRecursionContexts(parentContext); + }); + try { + size_t alt; + enterOuterAlt(_localctx, 1); + setState(69); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 3, _ctx)) { + case 1: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + + setState(15); + match(ExprParser::T__1); + setState(16); + expr(13); + break; + } + + case 2: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(17); + match(ExprParser::IDENTIFIER); + break; + } + + case 3: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(18); + match(ExprParser::IDENTIFIER); + setState(19); + match(ExprParser::T__4); + setState(20); + match(ExprParser::IDENTIFIER); + break; + } + + case 4: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(21); + match(ExprParser::NUMBER); + break; + } + + case 5: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(22); + match(ExprParser::T__5); + setState(23); + expr(0); + setState(24); + match(ExprParser::T__6); + break; + } + + case 6: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(26); + match(ExprParser::IDENTIFIER); + setState(27); + match(ExprParser::T__5); + setState(28); + expr(0); + setState(29); + match(ExprParser::T__6); + break; + } + + case 7: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(31); + match(ExprParser::IDENTIFIER); + setState(32); + match(ExprParser::LBRACKET); + setState(33); + shift(); + setState(38); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ExprParser::T__7) { + setState(34); + match(ExprParser::T__7); + setState(35); + shift(); + setState(40); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(41); + match(ExprParser::RBRACKET); + break; + } + + case 8: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(43); + match(ExprParser::IDENTIFIER); + setState(44); + match(ExprParser::LBRACKET); + setState(45); + expr(0); + setState(50); + _errHandler->sync(this); + _la = _input->LA(1); + while (_la == ExprParser::T__7) { + setState(46); + match(ExprParser::T__7); + setState(47); + expr(0); + setState(52); + _errHandler->sync(this); + _la = _input->LA(1); + } + setState(53); + match(ExprParser::RBRACKET); + break; + } + + case 9: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(55); + match(ExprParser::IDENTIFIER); + setState(56); + match(ExprParser::LBRACKET); + setState(57); + antlrcpp::downCast(_localctx)->shift1 = shift(); + setState(58); + match(ExprParser::T__8); + setState(59); + antlrcpp::downCast(_localctx)->shift2 = shift(); + setState(60); + match(ExprParser::RBRACKET); + break; + } + + case 10: { + _localctx = _tracker.createInstance(_localctx); + _ctx = _localctx; + previousContext = _localctx; + setState(62); + match(ExprParser::IDENTIFIER); + setState(63); + match(ExprParser::LBRACKET); + setState(64); + expr(0); + setState(65); + match(ExprParser::T__8); + setState(66); + expr(0); + setState(67); + match(ExprParser::RBRACKET); + break; + } + + default: + break; + } + _ctx->stop = _input->LT(-1); + setState(82); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 5, _ctx); + while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { + if (alt == 1) { + if (!_parseListeners.empty()) + triggerExitRuleEvent(); + previousContext = _localctx; + setState(80); + _errHandler->sync(this); + switch (getInterpreter()->adaptivePredict(_input, 4, _ctx)) { + case 1: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleExpr); + setState(71); + + if (!(precpred(_ctx, 12))) throw FailedPredicateException(this, "precpred(_ctx, 12)"); + setState(72); + antlrcpp::downCast(_localctx)->op = _input->LT(1); + _la = _input->LA(1); + if (!(_la == ExprParser::T__2 + + || _la == ExprParser::T__3)) { + antlrcpp::downCast(_localctx)->op = _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(73); + expr(13); + break; + } + + case 2: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleExpr); + setState(74); + + if (!(precpred(_ctx, 11))) throw FailedPredicateException(this, "precpred(_ctx, 11)"); + setState(75); + antlrcpp::downCast(_localctx)->op = _input->LT(1); + _la = _input->LA(1); + if (!(_la == ExprParser::T__0 + + || _la == ExprParser::T__1)) { + antlrcpp::downCast(_localctx)->op = _errHandler->recoverInline(this); + } + else { + _errHandler->reportMatch(this); + consume(); + } + setState(76); + expr(12); + break; + } + + case 3: { + auto newContext = _tracker.createInstance(_tracker.createInstance(parentContext, parentState)); + _localctx = newContext; + pushNewRecursionContext(newContext, startState, RuleExpr); + setState(77); + + if (!(precpred(_ctx, 10))) throw FailedPredicateException(this, "precpred(_ctx, 10)"); + setState(78); + match(ExprParser::COMPARISON); + setState(79); + expr(11); + break; + } + + default: + break; + } + } + setState(84); + _errHandler->sync(this); + alt = getInterpreter()->adaptivePredict(_input, 5, _ctx); + } + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + return _localctx; +} + +bool ExprParser::sempred(RuleContext *context, size_t ruleIndex, size_t predicateIndex) { + switch (ruleIndex) { + case 2: return exprSempred(antlrcpp::downCast(context), predicateIndex); + + default: + break; + } + return true; +} + +bool ExprParser::exprSempred(ExprContext *_localctx, size_t predicateIndex) { + switch (predicateIndex) { + case 0: return precpred(_ctx, 12); + case 1: return precpred(_ctx, 11); + case 2: return precpred(_ctx, 10); + + default: + break; + } + return true; +} + +void ExprParser::initialize() { +#if ANTLR4_USE_THREAD_LOCAL_CACHE + exprParserInitialize(); +#else + ::antlr4::internal::call_once(exprParserOnceFlag, exprParserInitialize); +#endif +} diff --git a/src/libs/antares/antlr-interface/ExprParser.h b/src/libs/antares/antlr-interface/ExprParser.h new file mode 100644 index 0000000000..aa1c8b6f09 --- /dev/null +++ b/src/libs/antares/antlr-interface/ExprParser.h @@ -0,0 +1,244 @@ + +// Generated from Expr.g4 by ANTLR 4.13.1 + +#pragma once + + +#include "antlr4-runtime.h" + + + + +class ExprParser : public antlr4::Parser { +public: + enum { + T__0 = 1, T__1 = 2, T__2 = 3, T__3 = 4, T__4 = 5, T__5 = 6, T__6 = 7, + T__7 = 8, T__8 = 9, NUMBER = 10, TIME = 11, IDENTIFIER = 12, COMPARISON = 13, + ADDSUB = 14, MULDIV = 15, LBRACKET = 16, RBRACKET = 17, WS = 18 + }; + + enum { + RuleFullexpr = 0, RuleShift = 1, RuleExpr = 2 + }; + + explicit ExprParser(antlr4::TokenStream *input); + + ExprParser(antlr4::TokenStream *input, const antlr4::atn::ParserATNSimulatorOptions &options); + + ~ExprParser() override; + + std::string getGrammarFileName() const override; + + const antlr4::atn::ATN& getATN() const override; + + const std::vector& getRuleNames() const override; + + const antlr4::dfa::Vocabulary& getVocabulary() const override; + + antlr4::atn::SerializedATNView getSerializedATN() const override; + + + class FullexprContext; + class ShiftContext; + class ExprContext; + + class FullexprContext : public antlr4::ParserRuleContext { + public: + FullexprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ExprContext *expr(); + antlr4::tree::TerminalNode *EOF(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + FullexprContext* fullexpr(); + + class ShiftContext : public antlr4::ParserRuleContext { + public: + antlr4::Token *op = nullptr; + ShiftContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + antlr4::tree::TerminalNode *TIME(); + ExprContext *expr(); + + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ShiftContext* shift(); + + class ExprContext : public antlr4::ParserRuleContext { + public: + ExprContext(antlr4::ParserRuleContext *parent, size_t invokingState); + + ExprContext() = default; + void copyFrom(ExprContext *context); + using antlr4::ParserRuleContext::copyFrom; + + virtual size_t getRuleIndex() const override; + + + }; + + class IdentifierContext : public ExprContext { + public: + IdentifierContext(ExprContext *ctx); + + antlr4::tree::TerminalNode *IDENTIFIER(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class NegationContext : public ExprContext { + public: + NegationContext(ExprContext *ctx); + + ExprContext *expr(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ExpressionContext : public ExprContext { + public: + ExpressionContext(ExprContext *ctx); + + ExprContext *expr(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class ComparisonContext : public ExprContext { + public: + ComparisonContext(ExprContext *ctx); + + std::vector expr(); + ExprContext* expr(size_t i); + antlr4::tree::TerminalNode *COMPARISON(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class AddsubContext : public ExprContext { + public: + AddsubContext(ExprContext *ctx); + + antlr4::Token *op = nullptr; + std::vector expr(); + ExprContext* expr(size_t i); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class PortFieldContext : public ExprContext { + public: + PortFieldContext(ExprContext *ctx); + + std::vector IDENTIFIER(); + antlr4::tree::TerminalNode* IDENTIFIER(size_t i); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class MuldivContext : public ExprContext { + public: + MuldivContext(ExprContext *ctx); + + antlr4::Token *op = nullptr; + std::vector expr(); + ExprContext* expr(size_t i); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class NumberContext : public ExprContext { + public: + NumberContext(ExprContext *ctx); + + antlr4::tree::TerminalNode *NUMBER(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TimeIndexContext : public ExprContext { + public: + TimeIndexContext(ExprContext *ctx); + + antlr4::tree::TerminalNode *IDENTIFIER(); + antlr4::tree::TerminalNode *LBRACKET(); + std::vector expr(); + ExprContext* expr(size_t i); + antlr4::tree::TerminalNode *RBRACKET(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TimeShiftContext : public ExprContext { + public: + TimeShiftContext(ExprContext *ctx); + + antlr4::tree::TerminalNode *IDENTIFIER(); + antlr4::tree::TerminalNode *LBRACKET(); + std::vector shift(); + ShiftContext* shift(size_t i); + antlr4::tree::TerminalNode *RBRACKET(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class FunctionContext : public ExprContext { + public: + FunctionContext(ExprContext *ctx); + + antlr4::tree::TerminalNode *IDENTIFIER(); + ExprContext *expr(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TimeShiftRangeContext : public ExprContext { + public: + TimeShiftRangeContext(ExprContext *ctx); + + ExprParser::ShiftContext *shift1 = nullptr; + ExprParser::ShiftContext *shift2 = nullptr; + antlr4::tree::TerminalNode *IDENTIFIER(); + antlr4::tree::TerminalNode *LBRACKET(); + antlr4::tree::TerminalNode *RBRACKET(); + std::vector shift(); + ShiftContext* shift(size_t i); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + class TimeRangeContext : public ExprContext { + public: + TimeRangeContext(ExprContext *ctx); + + antlr4::tree::TerminalNode *IDENTIFIER(); + antlr4::tree::TerminalNode *LBRACKET(); + std::vector expr(); + ExprContext* expr(size_t i); + antlr4::tree::TerminalNode *RBRACKET(); + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + }; + + ExprContext* expr(); + ExprContext* expr(int precedence); + + bool sempred(antlr4::RuleContext *_localctx, size_t ruleIndex, size_t predicateIndex) override; + + bool exprSempred(ExprContext *_localctx, size_t predicateIndex); + + // By default the static state used to implement the parser is lazily initialized during the first + // call to the constructor. You can call this function if you wish to initialize the static state + // ahead of time. + static void initialize(); + +private: +}; + diff --git a/src/libs/antares/antlr-interface/ExprVisitor.cpp b/src/libs/antares/antlr-interface/ExprVisitor.cpp new file mode 100644 index 0000000000..c214f0f76f --- /dev/null +++ b/src/libs/antares/antlr-interface/ExprVisitor.cpp @@ -0,0 +1,7 @@ + +// Generated from Expr.g4 by ANTLR 4.13.1 + + +#include "ExprVisitor.h" + + diff --git a/src/libs/antares/antlr-interface/ExprVisitor.h b/src/libs/antares/antlr-interface/ExprVisitor.h new file mode 100644 index 0000000000..c064d6d54a --- /dev/null +++ b/src/libs/antares/antlr-interface/ExprVisitor.h @@ -0,0 +1,54 @@ + +// Generated from Expr.g4 by ANTLR 4.13.1 + +#pragma once + + +#include "antlr4-runtime.h" +#include "ExprParser.h" + + + +/** + * This class defines an abstract visitor for a parse tree + * produced by ExprParser. + */ +class ExprVisitor : public antlr4::tree::AbstractParseTreeVisitor { +public: + + /** + * Visit parse trees produced by ExprParser. + */ + virtual std::any visitFullexpr(ExprParser::FullexprContext *context) = 0; + + virtual std::any visitShift(ExprParser::ShiftContext *context) = 0; + + virtual std::any visitIdentifier(ExprParser::IdentifierContext *context) = 0; + + virtual std::any visitNegation(ExprParser::NegationContext *context) = 0; + + virtual std::any visitExpression(ExprParser::ExpressionContext *context) = 0; + + virtual std::any visitComparison(ExprParser::ComparisonContext *context) = 0; + + virtual std::any visitAddsub(ExprParser::AddsubContext *context) = 0; + + virtual std::any visitPortField(ExprParser::PortFieldContext *context) = 0; + + virtual std::any visitMuldiv(ExprParser::MuldivContext *context) = 0; + + virtual std::any visitNumber(ExprParser::NumberContext *context) = 0; + + virtual std::any visitTimeIndex(ExprParser::TimeIndexContext *context) = 0; + + virtual std::any visitTimeShift(ExprParser::TimeShiftContext *context) = 0; + + virtual std::any visitFunction(ExprParser::FunctionContext *context) = 0; + + virtual std::any visitTimeShiftRange(ExprParser::TimeShiftRangeContext *context) = 0; + + virtual std::any visitTimeRange(ExprParser::TimeRangeContext *context) = 0; + + +}; + diff --git a/src/libs/antares/yaml-parser/CMakeLists.txt b/src/libs/antares/yaml-parser/CMakeLists.txt index 2db4287747..9fbe52fdeb 100644 --- a/src/libs/antares/yaml-parser/CMakeLists.txt +++ b/src/libs/antares/yaml-parser/CMakeLists.txt @@ -1,5 +1,6 @@ find_package(yaml-cpp CONFIG REQUIRED) +find_package(antlr4-runtime CONFIG REQUIRED) Set(SRCS main.cpp ) @@ -9,5 +10,13 @@ add_executable(${execname} ${SRCS}) # FILE yaml-parser-testConfig.cmake # DESTINATION cmake # ) +# add antlr4cpp artifacts to project environment +target_link_libraries(${execname} PUBLIC yaml-cpp antlr4_shared) # The library or executable that require yaml-cpp -target_link_libraries(${execname} PUBLIC yaml-cpp) # The library or executable that require yaml-cpp library + +#ugly see https://github.com/antlr/antlr4/pull/1612 +get_target_property(antlr4_lib antlr4_shared IMPORTED_IMPLIB_DEBUG) +set(antlr4_include "${antlr4_lib}/../../../include/antlr4-runtime") +message ("************* ${antlr4_include} ***************** ") + +target_include_directories(${execname} PUBLIC ${antlr4_include}) \ No newline at end of file diff --git a/src/libs/antares/yaml-parser/main.cpp b/src/libs/antares/yaml-parser/main.cpp index 673a489ee8..623c80bcde 100644 --- a/src/libs/antares/yaml-parser/main.cpp +++ b/src/libs/antares/yaml-parser/main.cpp @@ -4,6 +4,16 @@ #include #include +#include "antlr4-runtime.h" +// #include "TLexer.h" +// #include "TParser.h" + +// #include + +#pragma execution_character_set("utf-8") + +using namespace antlr4; + // our data types struct Vec3 { @@ -147,12 +157,29 @@ int main() - name: Staff damage: 3)"; YAML::Node doc = YAML::Load(my_yaml); + std::vector monsters; for (unsigned i = 0; i < doc.size(); i++) { - Monster monster; - monster = doc[i].as(); + monsters.push_back(doc[i].as()); + const Monster& monster = monsters.back(); std::cout << monster.name << "\n"; + std::cout << "Position: " << monster.position.x << ", " << monster.position.y << ", " + << monster.position.z << "\n"; + std::cout << "Powers: \n"; + for (const auto power : monster.powers) + { + std::cout << power.name << " " << power.damage << "\n"; + } } + // YAML::Node doc_to_write = ; + ANTLRInputStream input("a = b + \"c\";(((x * d))) * e + f; a + (x * (y ? 0 : 1) + z);"); + // TLexer lexer(&input); + // CommonTokenStream tokens(&lexer); + + // TParser parser(&tokens); + // tree::ParseTree* tree = parser.main(); + // auto s = tree->toStringTree(&parser); + // std::cout << "Parse Tree: " << s << std::endl; return 0; } \ No newline at end of file From 1239d87369beb57dfbb90d62462f3eeb6d358dea Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 12:12:50 +0100 Subject: [PATCH 04/50] fix ubuntu --- .github/workflows/ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 6f2041b4ad..66ff113456 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -56,7 +56,7 @@ jobs: sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev sudo apt-get install libboost-test-dev sudo apt-get install g++-10 gcc-10 - sudo apt-get install libyaml-cpp-dev antlr4 + sudo apt-get install libyaml-cpp-dev libantlr4-runtime-dev - name: Read antares-deps version id: antares-deps-version From dda2b4c9382ee0fe58294e58bc48a4ec9570bdf8 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 14:00:50 +0100 Subject: [PATCH 05/50] undo ugly fix --- src/libs/antares/antlr-interface/CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/libs/antares/antlr-interface/CMakeLists.txt b/src/libs/antares/antlr-interface/CMakeLists.txt index f357c9aeed..032afe50a6 100644 --- a/src/libs/antares/antlr-interface/CMakeLists.txt +++ b/src/libs/antares/antlr-interface/CMakeLists.txt @@ -16,9 +16,6 @@ add_library(${lib_name} ${SRCS}) target_link_libraries(${lib_name} PUBLIC antlr4_shared) # The library or executable that require yaml-cpp library -#ugly see https://github.com/antlr/antlr4/pull/1612 -get_target_property(antlr4_lib antlr4_shared IMPORTED_IMPLIB_DEBUG) -set(antlr4_include "${antlr4_lib}/../../../include/antlr4-runtime") -message ("************* ${antlr4_include} ***************** ") +message ("************* ${ANTLR4_INCLUDE_DIR} ********++++++********* ") -target_include_directories(${lib_name} PUBLIC ${antlr4_include}) \ No newline at end of file +target_include_directories(${lib_name} PUBLIC ${ANTLR4_INCLUDE_DIR}) \ No newline at end of file From 8491564f562b0a4ef37079ab18f410b8e2953074 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 14:22:39 +0100 Subject: [PATCH 06/50] ub: use vcpkg for new deps --- .github/workflows/ubuntu.yml | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 66ff113456..535280b793 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -28,6 +28,9 @@ env: RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }} RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + vcpkgPackages: yaml-cpp antlr4 + triplet: x64-linux jobs: @@ -50,13 +53,42 @@ jobs: with: key: ${{ env.os }} + - name : Init VCPKG submodule + run: | + git submodule update --init vcpkg + + # Restore both vcpkg and its artifacts from the GitHub cache service. + - name: Restore vcpkg and its artifacts. + uses: actions/cache@v4 + with: + # The first path is the location of vcpkg (it contains the vcpkg executable and data files). + # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). + key: | + ${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ env.triplet }} + + - name : Install deps with VCPKG + run: | + cd vcpkg + ./bootstrap-vcpkg.sh + vcpkg install ${{env.vcpkgPackages}} --triplet ${{env.triplet}} + rm -rf buildtrees packages downloads + shell: bash + - name: Install libraries run: | sudo apt-get update sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev sudo apt-get install libboost-test-dev sudo apt-get install g++-10 gcc-10 - sudo apt-get install libyaml-cpp-dev libantlr4-runtime-dev + # sudo apt-get install libyaml-cpp-dev libantlr4-runtime-dev - name: Read antares-deps version id: antares-deps-version @@ -98,6 +130,8 @@ jobs: run: | cmake -B _build -S src \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ + -DVCPKG_TARGET_TRIPLET=${{ env.triplet }} \ -DCMAKE_C_COMPILER=/usr/bin/gcc-10 \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \ From 6e67662328554a428119b642efea171d412c7897 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 14:29:11 +0100 Subject: [PATCH 07/50] don't mix --- src/libs/antares/yaml-parser/CMakeLists.txt | 9 +-------- src/libs/antares/yaml-parser/main.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/libs/antares/yaml-parser/CMakeLists.txt b/src/libs/antares/yaml-parser/CMakeLists.txt index 9fbe52fdeb..2221b67b83 100644 --- a/src/libs/antares/yaml-parser/CMakeLists.txt +++ b/src/libs/antares/yaml-parser/CMakeLists.txt @@ -1,6 +1,5 @@ find_package(yaml-cpp CONFIG REQUIRED) -find_package(antlr4-runtime CONFIG REQUIRED) Set(SRCS main.cpp ) @@ -11,12 +10,6 @@ add_executable(${execname} ${SRCS}) # DESTINATION cmake # ) # add antlr4cpp artifacts to project environment -target_link_libraries(${execname} PUBLIC yaml-cpp antlr4_shared) # The library or executable that require yaml-cpp +target_link_libraries(${execname} PUBLIC yaml-cpp ) # The library or executable that require yaml-cpp -#ugly see https://github.com/antlr/antlr4/pull/1612 -get_target_property(antlr4_lib antlr4_shared IMPORTED_IMPLIB_DEBUG) -set(antlr4_include "${antlr4_lib}/../../../include/antlr4-runtime") -message ("************* ${antlr4_include} ***************** ") - -target_include_directories(${execname} PUBLIC ${antlr4_include}) \ No newline at end of file diff --git a/src/libs/antares/yaml-parser/main.cpp b/src/libs/antares/yaml-parser/main.cpp index 623c80bcde..2d0d1549fc 100644 --- a/src/libs/antares/yaml-parser/main.cpp +++ b/src/libs/antares/yaml-parser/main.cpp @@ -4,15 +4,15 @@ #include #include -#include "antlr4-runtime.h" +// #include "antlr4-runtime.h" // #include "TLexer.h" // #include "TParser.h" // #include -#pragma execution_character_set("utf-8") +// #pragma execution_character_set("utf-8") -using namespace antlr4; +// using namespace antlr4; // our data types struct Vec3 @@ -172,7 +172,7 @@ int main() } } // YAML::Node doc_to_write = ; - ANTLRInputStream input("a = b + \"c\";(((x * d))) * e + f; a + (x * (y ? 0 : 1) + z);"); + // ANTLRInputStream input("a = b + \"c\";(((x * d))) * e + f; a + (x * (y ? 0 : 1) + z);"); // TLexer lexer(&input); // CommonTokenStream tokens(&lexer); From 592f33e294bcb91260904edda274798249bdea43 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 14:36:09 +0100 Subject: [PATCH 08/50] disable search for Wx --- src/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 65d8479140..e067770091 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -331,11 +331,12 @@ find_package(minizip REQUIRED) # endif() #wxWidget not needed for all library find is done in ui CMakeLists.txt -if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) - #Add cmake directory to CMAKE_MODULE_PATH to use specific FindwxWidgets package needed for vcpkg - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/wxWidgets") +if(MSVC) + if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) + #Add cmake directory to CMAKE_MODULE_PATH to use specific FindwxWidgets package needed for vcpkg + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/wxWidgets") + endif() endif() - # TODO : review Standard Settings include(cmake/common-settings.cmake) From 875f399d597e41a8601b89f07a7a67af215e947d Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 15:53:32 +0100 Subject: [PATCH 09/50] ub: use Wx from the system package manager --- .github/workflows/ubuntu.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 535280b793..9763ad84a7 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -89,7 +89,13 @@ jobs: sudo apt-get install libboost-test-dev sudo apt-get install g++-10 gcc-10 # sudo apt-get install libyaml-cpp-dev libantlr4-runtime-dev - + + - name: use wxWidget from system manager + run: | + mkdir -p ${{github.workspace}}/overlays/wxWidgets + echo "set(VCPKG_POLICY_EMPTY_PACKAGE enabled)" >> ${{github.workspace}}/overlays/wxWidgets/portfile.cmake + cat ${{github.workspace}}/overlays/wxWidgets/portfile.cmake + - name: Read antares-deps version id: antares-deps-version uses: notiz-dev/github-action-json-property@release From cd6e68e57c51c5bdd4d30f3d167e0529a68623ce Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 16:05:42 +0100 Subject: [PATCH 10/50] test --- .github/workflows/branchNameValidation.yml | 3 +-- .github/workflows/sonarcloud.yml | 3 --- .github/workflows/ubuntu.yml | 3 ++- .github/workflows/windows-vcpkg.yml | 7 ------- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/branchNameValidation.yml b/.github/workflows/branchNameValidation.yml index 6249133c10..e333cb0b8f 100644 --- a/.github/workflows/branchNameValidation.yml +++ b/.github/workflows/branchNameValidation.yml @@ -1,7 +1,6 @@ name: Branch name validation -on: - push: + jobs: valid-branch-name: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 9c061abe15..37265ce32c 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -1,8 +1,5 @@ name: SonarCloud -on: - pull_request: - jobs: sonarcloud: name: SonarCloud diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 9763ad84a7..7d24e38758 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -95,7 +95,7 @@ jobs: mkdir -p ${{github.workspace}}/overlays/wxWidgets echo "set(VCPKG_POLICY_EMPTY_PACKAGE enabled)" >> ${{github.workspace}}/overlays/wxWidgets/portfile.cmake cat ${{github.workspace}}/overlays/wxWidgets/portfile.cmake - + - name: Read antares-deps version id: antares-deps-version uses: notiz-dev/github-action-json-property@release @@ -136,6 +136,7 @@ jobs: run: | cmake -B _build -S src \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DVCPKG_OVERLAY_PORTS=${{github.workspace}}/overlays/ \ -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ -DVCPKG_TARGET_TRIPLET=${{ env.triplet }} \ -DCMAKE_C_COMPILER=/usr/bin/gcc-10 \ diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 60f456ccae..0d8d0998ea 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -4,13 +4,6 @@ on: push: branches: - develop - - feature/* - - features/* - - fix/* - - issue-* - - release/* - - doc/* - - dependabot/* schedule: - cron: '21 2 * * *' workflow_call: From 98950589a021a8a356ff3679439dabcf3e08dd15 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 17:42:14 +0100 Subject: [PATCH 11/50] exxport env variable --- .github/workflows/branchNameValidation.yml | 3 ++- .github/workflows/sonarcloud.yml | 3 +++ .github/workflows/ubuntu.yml | 7 ------- .github/workflows/windows-vcpkg.yml | 7 +++++++ config-build.sh | 15 +++++++++++++++ src/CMakeLists.txt | 9 ++++----- 6 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 config-build.sh diff --git a/.github/workflows/branchNameValidation.yml b/.github/workflows/branchNameValidation.yml index e333cb0b8f..6249133c10 100644 --- a/.github/workflows/branchNameValidation.yml +++ b/.github/workflows/branchNameValidation.yml @@ -1,6 +1,7 @@ name: Branch name validation - +on: + push: jobs: valid-branch-name: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 37265ce32c..9c061abe15 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -1,5 +1,8 @@ name: SonarCloud +on: + pull_request: + jobs: sonarcloud: name: SonarCloud diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 7d24e38758..535280b793 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -89,12 +89,6 @@ jobs: sudo apt-get install libboost-test-dev sudo apt-get install g++-10 gcc-10 # sudo apt-get install libyaml-cpp-dev libantlr4-runtime-dev - - - name: use wxWidget from system manager - run: | - mkdir -p ${{github.workspace}}/overlays/wxWidgets - echo "set(VCPKG_POLICY_EMPTY_PACKAGE enabled)" >> ${{github.workspace}}/overlays/wxWidgets/portfile.cmake - cat ${{github.workspace}}/overlays/wxWidgets/portfile.cmake - name: Read antares-deps version id: antares-deps-version @@ -136,7 +130,6 @@ jobs: run: | cmake -B _build -S src \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DVCPKG_OVERLAY_PORTS=${{github.workspace}}/overlays/ \ -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ -DVCPKG_TARGET_TRIPLET=${{ env.triplet }} \ -DCMAKE_C_COMPILER=/usr/bin/gcc-10 \ diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 0d8d0998ea..60f456ccae 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -4,6 +4,13 @@ on: push: branches: - develop + - feature/* + - features/* + - fix/* + - issue-* + - release/* + - doc/* + - dependabot/* schedule: - cron: '21 2 * * *' workflow_call: diff --git a/config-build.sh b/config-build.sh new file mode 100644 index 0000000000..6ace52581c --- /dev/null +++ b/config-build.sh @@ -0,0 +1,15 @@ +#!/bin/bash +cmake -S src/ -B _build \ + -DCMAKE_TOOLCHAIN_FILE="/c/Users/bari1/Desktop/work/Antares_Simulator/vcpkg/scripts/buildsystems/vcpkg.cmake" \ + -DBUILD_TESTING=ON \ + -DVCPKG_TARGET_TRIPLET=x64-windows \ + -DCMAKE_INSTALL_PREFIX=_install \ + -DCMAKE_BUILD_TYPE=Release \ + -DDEPS_INSTALL_DIR="/c/Users/bari1/Desktop/work/Simulator-rte-antares-deps-Release/" \ + -DBUILD_UI=OFF \ + -DBUILD_not_system=OFF \ + -DBUILD_ortools=ON \ + -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT="ProgramDatabase" \ + -DCMAKE_PREFIX_PATH="/c/Users/bari1/Desktop/work/sirius_install/;/c/Users/bari1/Desktop/work/ortools-install/" \ + -DCMAKE_EXE_LINKER_FLAGS_RELEASE="/INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF" && cmake --build _build --config Release -j 2 --target all + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e067770091..65d8479140 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -331,12 +331,11 @@ find_package(minizip REQUIRED) # endif() #wxWidget not needed for all library find is done in ui CMakeLists.txt -if(MSVC) - if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) - #Add cmake directory to CMAKE_MODULE_PATH to use specific FindwxWidgets package needed for vcpkg - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/wxWidgets") - endif() +if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) + #Add cmake directory to CMAKE_MODULE_PATH to use specific FindwxWidgets package needed for vcpkg + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/wxWidgets") endif() + # TODO : review Standard Settings include(cmake/common-settings.cmake) From bdfb4050ea8fddd186742147b2233d7cfcf3d618 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 17:45:52 +0100 Subject: [PATCH 12/50] export env variable --- .github/workflows/ubuntu.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 535280b793..13cb9ce9d9 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -125,7 +125,12 @@ jobs: run: | git submodule update --init src/antares-deps git submodule update --init --remote --recursive src/tests/resources/Antares_Simulator_Tests - + + - name: export wxWidgets script + shell: bash + run: | + export WX_CONFIG=/usr/bin/wx-config + - name: Configure run: | cmake -B _build -S src \ From 4942014d295c8a3006ded04b588962be40e12d5c Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 17:46:48 +0100 Subject: [PATCH 13/50] install boost test with vcpkg --- .github/workflows/ubuntu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 13cb9ce9d9..b8781a8c50 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -29,7 +29,7 @@ env: RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} VCPKG_ROOT: ${{ github.workspace }}/vcpkg - vcpkgPackages: yaml-cpp antlr4 + vcpkgPackages: yaml-cpp antlr4 boost-test triplet: x64-linux jobs: @@ -86,7 +86,7 @@ jobs: run: | sudo apt-get update sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev - sudo apt-get install libboost-test-dev + # sudo apt-get install libboost-test-dev sudo apt-get install g++-10 gcc-10 # sudo apt-get install libyaml-cpp-dev libantlr4-runtime-dev From 17f3ac4aea6f63c5c571207b93a025e5652e4ddb Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 17:48:00 +0100 Subject: [PATCH 14/50] fix --- .github/workflows/ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index b8781a8c50..bec1fb6c26 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -81,7 +81,7 @@ jobs: vcpkg install ${{env.vcpkgPackages}} --triplet ${{env.triplet}} rm -rf buildtrees packages downloads shell: bash - + - name: Install libraries run: | sudo apt-get update From f45c8e4454e8cd736d7c2d2aa07d52b055328371 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 17:50:35 +0100 Subject: [PATCH 15/50] . --- .github/workflows/ubuntu.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index bec1fb6c26..e7944aca1d 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -81,12 +81,11 @@ jobs: vcpkg install ${{env.vcpkgPackages}} --triplet ${{env.triplet}} rm -rf buildtrees packages downloads shell: bash - + - name: Install libraries run: | sudo apt-get update sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev - # sudo apt-get install libboost-test-dev sudo apt-get install g++-10 gcc-10 # sudo apt-get install libyaml-cpp-dev libantlr4-runtime-dev From a5a98fa6a5da5ea6fe5177da7fdc7aa03f77c1d2 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 17:58:16 +0100 Subject: [PATCH 16/50] .. --- .github/workflows/ubuntu.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index e7944aca1d..2ae4674fff 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -31,6 +31,7 @@ env: VCPKG_ROOT: ${{ github.workspace }}/vcpkg vcpkgPackages: yaml-cpp antlr4 boost-test triplet: x64-linux + WX_CONFIG: /usr/bin/wx-config jobs: @@ -53,6 +54,14 @@ jobs: with: key: ${{ env.os }} + - name: export wxWidgets script + shell: bash + run: | + echo ${{ env.WX_CONFIG}} + cat ${{ env.WX_CONFIG}} + export WX_CONFIG=/usr/bin/wx-config + cat $WX_CONFIG + - name : Init VCPKG submodule run: | git submodule update --init vcpkg @@ -125,10 +134,7 @@ jobs: git submodule update --init src/antares-deps git submodule update --init --remote --recursive src/tests/resources/Antares_Simulator_Tests - - name: export wxWidgets script - shell: bash - run: | - export WX_CONFIG=/usr/bin/wx-config + - name: Configure run: | From 99de02d342238276de6c3dedcf2547970535d545 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 18:00:07 +0100 Subject: [PATCH 17/50] print env vars --- .github/workflows/ubuntu.yml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 2ae4674fff..c43057cf1d 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -54,13 +54,6 @@ jobs: with: key: ${{ env.os }} - - name: export wxWidgets script - shell: bash - run: | - echo ${{ env.WX_CONFIG}} - cat ${{ env.WX_CONFIG}} - export WX_CONFIG=/usr/bin/wx-config - cat $WX_CONFIG - name : Init VCPKG submodule run: | @@ -83,6 +76,21 @@ jobs: key: | ${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ env.triplet }} + - name: Install libraries + run: | + sudo apt-get update + sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev + sudo apt-get install g++-10 gcc-10 + # sudo apt-get install libyaml-cpp-dev libantlr4-runtime-dev + + - name: export wxWidgets script + shell: bash + run: | + echo ${{ env.WX_CONFIG}} + cat ${{ env.WX_CONFIG}} + export WX_CONFIG=/usr/bin/wx-config + cat $WX_CONFIG + - name : Install deps with VCPKG run: | cd vcpkg @@ -91,13 +99,6 @@ jobs: rm -rf buildtrees packages downloads shell: bash - - name: Install libraries - run: | - sudo apt-get update - sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev - sudo apt-get install g++-10 gcc-10 - # sudo apt-get install libyaml-cpp-dev libantlr4-runtime-dev - - name: Read antares-deps version id: antares-deps-version uses: notiz-dev/github-action-json-property@release From cef9408ccb65aea811933a850e874c577c7dee5f Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 18:12:47 +0100 Subject: [PATCH 18/50] boost needs x64-linux-dynamic --- .github/workflows/ubuntu.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c43057cf1d..885df8e5cb 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -29,7 +29,7 @@ env: RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} VCPKG_ROOT: ${{ github.workspace }}/vcpkg - vcpkgPackages: yaml-cpp antlr4 boost-test + vcpkgPackages: yaml-cpp antlr4 triplet: x64-linux WX_CONFIG: /usr/bin/wx-config @@ -96,6 +96,7 @@ jobs: cd vcpkg ./bootstrap-vcpkg.sh vcpkg install ${{env.vcpkgPackages}} --triplet ${{env.triplet}} + vcpkg install boost-test --triplet x64-linux-dynamic rm -rf buildtrees packages downloads shell: bash @@ -139,6 +140,7 @@ jobs: - name: Configure run: | + export WX_CONFIG=${{env.WX_CONFIG}} cmake -B _build -S src \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ From 996013bbce42a46b02ed6d31d01132490b60217f Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 13 Mar 2024 18:22:50 +0100 Subject: [PATCH 19/50] rvert & update --- .github/workflows/ubuntu.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 885df8e5cb..6c96c409b8 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -29,8 +29,8 @@ env: RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} VCPKG_ROOT: ${{ github.workspace }}/vcpkg - vcpkgPackages: yaml-cpp antlr4 - triplet: x64-linux + vcpkgPackages: yaml-cpp antlr4 boost-test + triplet: x64-linux-dynamic WX_CONFIG: /usr/bin/wx-config jobs: @@ -96,7 +96,6 @@ jobs: cd vcpkg ./bootstrap-vcpkg.sh vcpkg install ${{env.vcpkgPackages}} --triplet ${{env.triplet}} - vcpkg install boost-test --triplet x64-linux-dynamic rm -rf buildtrees packages downloads shell: bash From e4664635f6e5fa744069c7820393ed55cccea34e Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 14 Mar 2024 10:59:50 +0100 Subject: [PATCH 20/50] add yaml-parser Unit tests --- src/libs/antares/CMakeLists.txt | 1 - src/libs/antares/yaml-parser/CMakeLists.txt | 15 ---- src/tests/src/libs/antares/CMakeLists.txt | 1 + .../libs/antares/yaml-parser/CMakeLists.txt | 22 ++++++ .../antares/yaml-parser/test_yaml_parser.cpp} | 78 +++++++++---------- 5 files changed, 59 insertions(+), 58 deletions(-) delete mode 100644 src/libs/antares/yaml-parser/CMakeLists.txt create mode 100644 src/tests/src/libs/antares/yaml-parser/CMakeLists.txt rename src/{libs/antares/yaml-parser/main.cpp => tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp} (66%) diff --git a/src/libs/antares/CMakeLists.txt b/src/libs/antares/CMakeLists.txt index 5579c86f53..143e382ff1 100644 --- a/src/libs/antares/CMakeLists.txt +++ b/src/libs/antares/CMakeLists.txt @@ -26,7 +26,6 @@ add_subdirectory(study) add_subdirectory(sys) add_subdirectory(utils) add_subdirectory(writer) -add_subdirectory(yaml-parser) add_subdirectory(antlr-interface) set(HEADERS diff --git a/src/libs/antares/yaml-parser/CMakeLists.txt b/src/libs/antares/yaml-parser/CMakeLists.txt deleted file mode 100644 index 2221b67b83..0000000000 --- a/src/libs/antares/yaml-parser/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ - -find_package(yaml-cpp CONFIG REQUIRED) -Set(SRCS main.cpp -) - -set(execname "yaml-parser-test") -add_executable(${execname} ${SRCS}) -# INSTALL(EXPORT ${execname} -# FILE yaml-parser-testConfig.cmake -# DESTINATION cmake -# ) -# add antlr4cpp artifacts to project environment -target_link_libraries(${execname} PUBLIC yaml-cpp ) # The library or executable that require yaml-cpp - - diff --git a/src/tests/src/libs/antares/CMakeLists.txt b/src/tests/src/libs/antares/CMakeLists.txt index fd4666cc29..9468aa94c8 100644 --- a/src/tests/src/libs/antares/CMakeLists.txt +++ b/src/tests/src/libs/antares/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(concurrency) add_subdirectory(writer) add_subdirectory(study) +add_subdirectory(yaml-parser) set(src_libs_antares "${CMAKE_SOURCE_DIR}/libs/antares") diff --git a/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt b/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt new file mode 100644 index 0000000000..8b8eb1b2ea --- /dev/null +++ b/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt @@ -0,0 +1,22 @@ + +find_package(yaml-cpp CONFIG REQUIRED) +Set(SRCS test_yaml_parser.cpp +) + +set(execname "yaml-parser-test") +add_executable(${execname} ${SRCS}) +# INSTALL(EXPORT ${execname} +# FILE yaml-parser-testConfig.cmake +# DESTINATION cmake +# ) +# add antlr4cpp artifacts to project environment +target_link_libraries(${execname} + PRIVATE + yaml-cpp + Boost::unit_test_framework + ) # The library or executable that require yaml-cpp + + +add_test(NAME yaml-parser COMMAND ${execname}) + +set_tests_properties(yaml-parser PROPERTIES LABELS unit) diff --git a/src/libs/antares/yaml-parser/main.cpp b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp similarity index 66% rename from src/libs/antares/yaml-parser/main.cpp rename to src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp index 2d0d1549fc..193e46f115 100644 --- a/src/libs/antares/yaml-parser/main.cpp +++ b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp @@ -1,3 +1,27 @@ +/* +** Copyright 2007-2024, RTE (https://www.rte-france.com) +** See AUTHORS.txt +** SPDX-License-Identifier: MPL-2.0 +** This file is part of Antares-Simulator, +** Adequacy and Performance assessment for interconnected energy networks. +** +** Antares_Simulator is free software: you can redistribute it and/or modify +** it under the terms of the Mozilla Public Licence 2.0 as published by +** the Mozilla Foundation, either version 2 of the License, or +** (at your option) any later version. +** +** Antares_Simulator is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** Mozilla Public Licence 2.0 for more details. +** +** You should have received a copy of the Mozilla Public Licence 2.0 +** along with Antares_Simulator. If not, see . +*/ +#define BOOST_TEST_MODULE test - writer tests +#define BOOST_TEST_DYN_LINK +#include +#include #include "yaml-cpp/yaml.h" #include #include @@ -104,37 +128,8 @@ struct convert }; } // namespace YAML -// // now the extraction operators for these types -// void operator>>(const YAML::Node& node, Vec3& v) -// { -// node[0] >> v.x; -// node[1] >> v.y; -// node[2] >> v.z; -// } - -// void operator>>(const YAML::Node& node, Power& power) -// { -// node["name"] >> power.name; -// node["damage"] >> power.damage; -// } - -// void operator>>(const YAML::Node& node, Monster& monster) -// { -// node["name"] >> monster.name; -// node["position"] >> monster.position; -// const YAML::Node& powers = node["powers"]; -// for (unsigned i = 0; i < powers.size(); i++) -// { -// Power power; -// powers[i] >> power; -// monster.powers.push_back(power); -// } -// } - -// int main(int argc, char** argv) -int main() +BOOST_AUTO_TEST_CASE(test_yaml_parser) { - // YAML::Node doc = YAML::LoadFile(argv[1]); std::string my_yaml = R"(- name: Ogre position: [0, 5, 0] powers: @@ -162,7 +157,6 @@ int main() { monsters.push_back(doc[i].as()); const Monster& monster = monsters.back(); - std::cout << monster.name << "\n"; std::cout << "Position: " << monster.position.x << ", " << monster.position.y << ", " << monster.position.z << "\n"; std::cout << "Powers: \n"; @@ -171,15 +165,15 @@ int main() std::cout << power.name << " " << power.damage << "\n"; } } - // YAML::Node doc_to_write = ; - // ANTLRInputStream input("a = b + \"c\";(((x * d))) * e + f; a + (x * (y ? 0 : 1) + z);"); - // TLexer lexer(&input); - // CommonTokenStream tokens(&lexer); - - // TParser parser(&tokens); - // tree::ParseTree* tree = parser.main(); - - // auto s = tree->toStringTree(&parser); - // std::cout << "Parse Tree: " << s << std::endl; - return 0; + BOOST_CHECK(monsters.size() == 3); + auto ogre = monsters[0]; + BOOST_CHECK(ogre.name == "Ogre"); + BOOST_CHECK(ogre.position.x == 0); + BOOST_CHECK(ogre.position.y == 5); + BOOST_CHECK(ogre.position.z == 0); + auto ogre_powers = ogre.powers; + BOOST_CHECK(ogre_powers.size() == 2); + auto ogre_power_Club = ogre_powers[0]; + BOOST_CHECK(ogre_power_Club.name == "Club"); + BOOST_CHECK(ogre_power_Club.damage == 10); } \ No newline at end of file From e9c8e12faffbde63ff1b7c4ecb9aa4d4fdf2033b Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 14 Mar 2024 12:12:10 +0100 Subject: [PATCH 21/50] add test --- .../antares/antlr-interface/CMakeLists.txt | 30 +++++++---- src/tests/src/libs/antares/CMakeLists.txt | 1 + .../antares/antlr4-interface/CMakeLists.txt | 20 ++++++++ .../antlr4-interface/test_antlr_interface.cpp | 50 +++++++++++++++++++ 4 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 src/tests/src/libs/antares/antlr4-interface/CMakeLists.txt create mode 100644 src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp diff --git a/src/libs/antares/antlr-interface/CMakeLists.txt b/src/libs/antares/antlr-interface/CMakeLists.txt index 032afe50a6..735e8f7701 100644 --- a/src/libs/antares/antlr-interface/CMakeLists.txt +++ b/src/libs/antares/antlr-interface/CMakeLists.txt @@ -1,21 +1,33 @@ -find_package(antlr4-runtime CONFIG REQUIRED) +set(PROJ antlr-interface) +set(HEADERS + ExprBaseVisitor.h + ExprLexer.h + ExprParser.h + ExprVisitor.h +) + Set(SRCS -ExprBaseVisitor.h ExprBaseVisitor.cpp -ExprLexer.h ExprLexer.cpp -ExprParser.h ExprParser.cpp -ExprVisitor.h ExprVisitor.cpp ) +find_package(antlr4-runtime CONFIG REQUIRED) -set(lib_name "antlr-interface") -add_library(${lib_name} ${SRCS}) +add_library(${PROJ} ${SRCS}) +add_library(Antares::${PROJ} ALIAS ${PROJ}) -target_link_libraries(${lib_name} PUBLIC antlr4_shared) # The library or executable that require yaml-cpp library +target_link_libraries(${PROJ} PUBLIC antlr4_shared) # The library or executable that require yaml-cpp library message ("************* ${ANTLR4_INCLUDE_DIR} ********++++++********* ") -target_include_directories(${lib_name} PUBLIC ${ANTLR4_INCLUDE_DIR}) \ No newline at end of file +target_include_directories(${PROJ} + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE + ${ANTLR4_INCLUDE_DIR}) + +install(FILES ${HEADERS} + DESTINATION "include" +) \ No newline at end of file diff --git a/src/tests/src/libs/antares/CMakeLists.txt b/src/tests/src/libs/antares/CMakeLists.txt index 9468aa94c8..c71e8519e7 100644 --- a/src/tests/src/libs/antares/CMakeLists.txt +++ b/src/tests/src/libs/antares/CMakeLists.txt @@ -2,6 +2,7 @@ add_subdirectory(concurrency) add_subdirectory(writer) add_subdirectory(study) add_subdirectory(yaml-parser) +add_subdirectory(antlr4-interface) set(src_libs_antares "${CMAKE_SOURCE_DIR}/libs/antares") diff --git a/src/tests/src/libs/antares/antlr4-interface/CMakeLists.txt b/src/tests/src/libs/antares/antlr4-interface/CMakeLists.txt new file mode 100644 index 0000000000..f74e12981c --- /dev/null +++ b/src/tests/src/libs/antares/antlr4-interface/CMakeLists.txt @@ -0,0 +1,20 @@ + +find_package(antlr4-runtime CONFIG REQUIRED) +Set(SRCS test_antlr_interface.cpp +) + +set(execname "antlr-interface-test") +add_executable(${execname} ${SRCS}) +target_link_libraries(${execname} + PRIVATE + antlr-interface + Boost::unit_test_framework + ) + + +target_include_directories(${execname} + PRIVATE + ${ANTLR4_INCLUDE_DIR}) +add_test(NAME antlr-interface COMMAND ${execname}) + +set_tests_properties(antlr-interface PROPERTIES LABELS unit) diff --git a/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp b/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp new file mode 100644 index 0000000000..7e5b03216c --- /dev/null +++ b/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp @@ -0,0 +1,50 @@ +/* +** Copyright 2007-2024, RTE (https://www.rte-france.com) +** See AUTHORS.txt +** SPDX-License-Identifier: MPL-2.0 +** This file is part of Antares-Simulator, +** Adequacy and Performance assessment for interconnected energy networks. +** +** Antares_Simulator is free software: you can redistribute it and/or modify +** it under the terms of the Mozilla Public Licence 2.0 as published by +** the Mozilla Foundation, either version 2 of the License, or +** (at your option) any later version. +** +** Antares_Simulator is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** Mozilla Public Licence 2.0 for more details. +** +** You should have received a copy of the Mozilla Public Licence 2.0 +** along with Antares_Simulator. If not, see . +*/ +#define BOOST_TEST_MODULE test - writer tests +#define BOOST_TEST_DYN_LINK +#include +#include +#include "antlr4-runtime.h" +#include + +#include "ExprLexer.h" +#include "ExprParser.h" +// #pragma execution_character_set("utf-8") +using namespace antlr4; +BOOST_AUTO_TEST_CASE(test_antlr_interface) +{ + const std::string my_input = "y = b + ax"; + ANTLRInputStream input(my_input); + ExprLexer lexer(&input); + CommonTokenStream tokens(&lexer); + tokens.fill(); + for (auto token : tokens.getTokens()) + { + std::cout << token->toString() << std::endl; + } + BOOST_CHECK(tokens.getTokens().size() == 6); + // ExprParser parser(&tokens); + // tree::ParseTree* tree = parser.main(); + + // auto s = tree->toStringTree(&parser); + // auto input_stream = parser.getInputStream(); + // BOOST_CHECK(input_stream->size() == my_input.size()); +} \ No newline at end of file From 92a7b3b2c9b3b2395d10ed8d1548ca8a18ca7fd0 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 14 Mar 2024 12:15:14 +0100 Subject: [PATCH 22/50] [skip ci] clean --- src/CMakeLists.txt | 14 -------------- src/libs/antares/antlr-interface/CMakeLists.txt | 1 - 2 files changed, 15 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 65d8479140..00836af2a7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -316,20 +316,6 @@ endif() find_package(minizip REQUIRED) - -# FetchContent_Declare( -# yaml-cpp -# GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git -# GIT_TAG 0.8.0 # Can be a tag (yaml-cpp-x.x.x), a commit hash, or a branch name (master) -# ) -# FetchContent_GetProperties(yaml-cpp) - -# if(NOT yaml-cpp_POPULATED) -# message(STATUS "Fetching yaml-cpp...") -# FetchContent_Populate(yaml-cpp) -# add_subdirectory(${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR}) -# endif() - #wxWidget not needed for all library find is done in ui CMakeLists.txt if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) #Add cmake directory to CMAKE_MODULE_PATH to use specific FindwxWidgets package needed for vcpkg diff --git a/src/libs/antares/antlr-interface/CMakeLists.txt b/src/libs/antares/antlr-interface/CMakeLists.txt index 735e8f7701..62f6360c62 100644 --- a/src/libs/antares/antlr-interface/CMakeLists.txt +++ b/src/libs/antares/antlr-interface/CMakeLists.txt @@ -20,7 +20,6 @@ add_library(Antares::${PROJ} ALIAS ${PROJ}) target_link_libraries(${PROJ} PUBLIC antlr4_shared) # The library or executable that require yaml-cpp library -message ("************* ${ANTLR4_INCLUDE_DIR} ********++++++********* ") target_include_directories(${PROJ} PUBLIC From ed78c001497b3be1eff81b2e8079f351c2ce6dae Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 14 Mar 2024 12:31:11 +0100 Subject: [PATCH 23/50] update tests --- .../antlr4-interface/test_antlr_interface.cpp | 4 ++-- .../libs/antares/yaml-parser/test_yaml_parser.cpp | 12 +----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp b/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp index 7e5b03216c..f454d6e235 100644 --- a/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp +++ b/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp @@ -18,7 +18,7 @@ ** You should have received a copy of the Mozilla Public Licence 2.0 ** along with Antares_Simulator. If not, see . */ -#define BOOST_TEST_MODULE test - writer tests +#define BOOST_TEST_MODULE antlr_interface tests #define BOOST_TEST_DYN_LINK #include #include @@ -27,7 +27,7 @@ #include "ExprLexer.h" #include "ExprParser.h" -// #pragma execution_character_set("utf-8") + using namespace antlr4; BOOST_AUTO_TEST_CASE(test_antlr_interface) { diff --git a/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp index 193e46f115..1279055444 100644 --- a/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp +++ b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp @@ -18,7 +18,7 @@ ** You should have received a copy of the Mozilla Public Licence 2.0 ** along with Antares_Simulator. If not, see . */ -#define BOOST_TEST_MODULE test - writer tests +#define BOOST_TEST_MODULE yamlcpp tests #define BOOST_TEST_DYN_LINK #include #include @@ -28,16 +28,6 @@ #include #include -// #include "antlr4-runtime.h" -// #include "TLexer.h" -// #include "TParser.h" - -// #include - -// #pragma execution_character_set("utf-8") - -// using namespace antlr4; - // our data types struct Vec3 { From cf850b764abfcdcc11cde6199877ae1572a7ae23 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Thu, 14 Mar 2024 12:50:35 +0100 Subject: [PATCH 24/50] [skip ci] remove local file --- config-build.sh | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 config-build.sh diff --git a/config-build.sh b/config-build.sh deleted file mode 100644 index 6ace52581c..0000000000 --- a/config-build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -cmake -S src/ -B _build \ - -DCMAKE_TOOLCHAIN_FILE="/c/Users/bari1/Desktop/work/Antares_Simulator/vcpkg/scripts/buildsystems/vcpkg.cmake" \ - -DBUILD_TESTING=ON \ - -DVCPKG_TARGET_TRIPLET=x64-windows \ - -DCMAKE_INSTALL_PREFIX=_install \ - -DCMAKE_BUILD_TYPE=Release \ - -DDEPS_INSTALL_DIR="/c/Users/bari1/Desktop/work/Simulator-rte-antares-deps-Release/" \ - -DBUILD_UI=OFF \ - -DBUILD_not_system=OFF \ - -DBUILD_ortools=ON \ - -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT="ProgramDatabase" \ - -DCMAKE_PREFIX_PATH="/c/Users/bari1/Desktop/work/sirius_install/;/c/Users/bari1/Desktop/work/ortools-install/" \ - -DCMAKE_EXE_LINKER_FLAGS_RELEASE="/INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF" && cmake --build _build --config Release -j 2 --target all - From db86a5b3175631862ef00b95733dbf6f7339d5e9 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Fri, 15 Mar 2024 11:02:57 +0100 Subject: [PATCH 25/50] boost-static 1st attempt --- src/libs/antares/antlr-interface/CMakeLists.txt | 4 ++-- .../libs/antares/antlr4-interface/test_antlr_interface.cpp | 3 +-- src/tests/src/libs/antares/concurrency/test_concurrency.cpp | 1 - src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/libs/antares/antlr-interface/CMakeLists.txt b/src/libs/antares/antlr-interface/CMakeLists.txt index 62f6360c62..3531ca91ce 100644 --- a/src/libs/antares/antlr-interface/CMakeLists.txt +++ b/src/libs/antares/antlr-interface/CMakeLists.txt @@ -18,7 +18,7 @@ find_package(antlr4-runtime CONFIG REQUIRED) add_library(${PROJ} ${SRCS}) add_library(Antares::${PROJ} ALIAS ${PROJ}) -target_link_libraries(${PROJ} PUBLIC antlr4_shared) # The library or executable that require yaml-cpp library +target_link_libraries(${PROJ} PUBLIC antlr4_static) # The library or executable that require yaml-cpp library target_include_directories(${PROJ} @@ -29,4 +29,4 @@ target_include_directories(${PROJ} install(FILES ${HEADERS} DESTINATION "include" -) \ No newline at end of file +) diff --git a/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp b/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp index f454d6e235..4c2a5153ff 100644 --- a/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp +++ b/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE antlr_interface tests -#define BOOST_TEST_DYN_LINK #include #include #include "antlr4-runtime.h" @@ -47,4 +46,4 @@ BOOST_AUTO_TEST_CASE(test_antlr_interface) // auto s = tree->toStringTree(&parser); // auto input_stream = parser.getInputStream(); // BOOST_CHECK(input_stream->size() == my_input.size()); -} \ No newline at end of file +} diff --git a/src/tests/src/libs/antares/concurrency/test_concurrency.cpp b/src/tests/src/libs/antares/concurrency/test_concurrency.cpp index 6920a7e684..4a053d569e 100644 --- a/src/tests/src/libs/antares/concurrency/test_concurrency.cpp +++ b/src/tests/src/libs/antares/concurrency/test_concurrency.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test-concurrency tests -#define BOOST_TEST_DYN_LINK #include #include diff --git a/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp index 1279055444..a4ae23ee90 100644 --- a/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp +++ b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE yamlcpp tests -#define BOOST_TEST_DYN_LINK #include #include #include "yaml-cpp/yaml.h" @@ -166,4 +165,4 @@ BOOST_AUTO_TEST_CASE(test_yaml_parser) auto ogre_power_Club = ogre_powers[0]; BOOST_CHECK(ogre_power_Club.name == "Club"); BOOST_CHECK(ogre_power_Club.damage == 10); -} \ No newline at end of file +} From ee904af7071ac89f3ee3b9c69301c886002d9edb Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Fri, 15 Mar 2024 11:07:14 +0100 Subject: [PATCH 26/50] dual --- .github/workflows/ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 6c96c409b8..2fdfd90d27 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -30,7 +30,7 @@ env: REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} VCPKG_ROOT: ${{ github.workspace }}/vcpkg vcpkgPackages: yaml-cpp antlr4 boost-test - triplet: x64-linux-dynamic + triplet: x64-linux WX_CONFIG: /usr/bin/wx-config jobs: From de0530b157e8b2ee94fcd23d1b3e4c2f16843fc0 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Fri, 15 Mar 2024 11:25:26 +0100 Subject: [PATCH 27/50] find/delete --- .../end-to-end/binding_constraints/test_binding_constraints.cpp | 1 - src/tests/end-to-end/simple_study/simple-study.cpp | 1 - src/tests/src/libs/antares/array/tests-matrix-load.cpp | 1 - src/tests/src/libs/antares/array/tests-matrix-save.cpp | 1 - .../libs/antares/study/area/test-save-area-optimization-ini.cpp | 1 - .../src/libs/antares/study/area/test-save-link-properties.cpp | 1 - src/tests/src/libs/antares/study/constraint/test_constraint.cpp | 1 - src/tests/src/libs/antares/study/constraint/test_group.cpp | 1 - src/tests/src/libs/antares/study/output-folder/study.cpp | 1 - .../src/libs/antares/study/parts/hydro/test-hydro-series.cpp | 1 - .../libs/antares/study/parts/hydro/test-hydroreader-class.cpp | 1 - .../study/scenario-builder/test-sc-builder-file-read-line.cpp | 1 - .../antares/study/scenario-builder/test-sc-builder-file-save.cpp | 1 - src/tests/src/libs/antares/study/series/timeseries-tests.cpp | 1 - .../short-term-storage-input/short-term-storage-input-output.cpp | 1 - src/tests/src/libs/antares/study/test_study.cpp | 1 - .../study/thermal-price-definition/thermal-price-definition.cpp | 1 - src/tests/src/libs/antares/test_utils.cpp | 1 - src/tests/src/libs/antares/writer/test_zip_writer.cpp | 1 - .../test-unfeasible-problem-analyzer.cpp | 1 - src/tests/src/solver/optimisation/adequacy_patch.cpp | 1 - src/tests/src/solver/simulation/test-store-timeseries-number.cpp | 1 - src/tests/src/solver/simulation/test-time_series.cpp | 1 - src/tests/src/solver/simulation/tests-ts-numbers.cpp | 1 - 24 files changed, 24 deletions(-) diff --git a/src/tests/end-to-end/binding_constraints/test_binding_constraints.cpp b/src/tests/end-to-end/binding_constraints/test_binding_constraints.cpp index def2099bbf..3428625f0a 100644 --- a/src/tests/end-to-end/binding_constraints/test_binding_constraints.cpp +++ b/src/tests/end-to-end/binding_constraints/test_binding_constraints.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test-end-to-end tests_binding_constraints -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN #include #include diff --git a/src/tests/end-to-end/simple_study/simple-study.cpp b/src/tests/end-to-end/simple_study/simple-study.cpp index e34407c645..3c3d2e06d4 100644 --- a/src/tests/end-to-end/simple_study/simple-study.cpp +++ b/src/tests/end-to-end/simple_study/simple-study.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test-end-to-end tests -#define BOOST_TEST_DYN_LINK #include #include diff --git a/src/tests/src/libs/antares/array/tests-matrix-load.cpp b/src/tests/src/libs/antares/array/tests-matrix-load.cpp index a079c6b51f..9463f1542c 100644 --- a/src/tests/src/libs/antares/array/tests-matrix-load.cpp +++ b/src/tests/src/libs/antares/array/tests-matrix-load.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test-lib-antares-matrix tests -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/array/tests-matrix-save.cpp b/src/tests/src/libs/antares/array/tests-matrix-save.cpp index ffc4f100e8..7d4195d578 100644 --- a/src/tests/src/libs/antares/array/tests-matrix-save.cpp +++ b/src/tests/src/libs/antares/array/tests-matrix-save.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test-lib-antares-matrix tests -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/study/area/test-save-area-optimization-ini.cpp b/src/tests/src/libs/antares/study/area/test-save-area-optimization-ini.cpp index e33688877f..e1818500d8 100644 --- a/src/tests/src/libs/antares/study/area/test-save-area-optimization-ini.cpp +++ b/src/tests/src/libs/antares/study/area/test-save-area-optimization-ini.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test save area optimization.ini -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/study/area/test-save-link-properties.cpp b/src/tests/src/libs/antares/study/area/test-save-link-properties.cpp index ab6324101e..53363409e6 100644 --- a/src/tests/src/libs/antares/study/area/test-save-link-properties.cpp +++ b/src/tests/src/libs/antares/study/area/test-save-link-properties.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test save link properties.ini -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/study/constraint/test_constraint.cpp b/src/tests/src/libs/antares/study/constraint/test_constraint.cpp index bf7ab69ebe..43121a2a01 100644 --- a/src/tests/src/libs/antares/study/constraint/test_constraint.cpp +++ b/src/tests/src/libs/antares/study/constraint/test_constraint.cpp @@ -24,7 +24,6 @@ #define WIN32_LEAN_AND_MEAN #define BOOST_TEST_MODULE binding_constraints -#define BOOST_TEST_DYN_LINK #include diff --git a/src/tests/src/libs/antares/study/constraint/test_group.cpp b/src/tests/src/libs/antares/study/constraint/test_group.cpp index 3816aa744f..480b49e6b1 100644 --- a/src/tests/src/libs/antares/study/constraint/test_group.cpp +++ b/src/tests/src/libs/antares/study/constraint/test_group.cpp @@ -22,7 +22,6 @@ // Created by marechaljas on 28/06/23. // #define BOOST_TEST_MODULE binding_constraints_groups -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN #include #include diff --git a/src/tests/src/libs/antares/study/output-folder/study.cpp b/src/tests/src/libs/antares/study/output-folder/study.cpp index ca08b60c87..374d95a589 100644 --- a/src/tests/src/libs/antares/study/output-folder/study.cpp +++ b/src/tests/src/libs/antares/study/output-folder/study.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE output folder -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/study/parts/hydro/test-hydro-series.cpp b/src/tests/src/libs/antares/study/parts/hydro/test-hydro-series.cpp index bfe80d14e1..27868475ec 100644 --- a/src/tests/src/libs/antares/study/parts/hydro/test-hydro-series.cpp +++ b/src/tests/src/libs/antares/study/parts/hydro/test-hydro-series.cpp @@ -1,5 +1,4 @@ #define BOOST_TEST_MODULE test hydro series -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/study/parts/hydro/test-hydroreader-class.cpp b/src/tests/src/libs/antares/study/parts/hydro/test-hydroreader-class.cpp index d8ddafbdbd..bd3d9bf995 100644 --- a/src/tests/src/libs/antares/study/parts/hydro/test-hydroreader-class.cpp +++ b/src/tests/src/libs/antares/study/parts/hydro/test-hydroreader-class.cpp @@ -1,5 +1,4 @@ #define BOOST_TEST_MODULE test hydro reader -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp b/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp index 0460eecbfa..4617d4d9b2 100644 --- a/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp +++ b/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test read scenario-builder.dat -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-save.cpp b/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-save.cpp index bd76b027c0..3163967585 100644 --- a/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-save.cpp +++ b/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-save.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test save scenario - builder.dat -#define BOOST_TEST_DYN_LINK #include #include diff --git a/src/tests/src/libs/antares/study/series/timeseries-tests.cpp b/src/tests/src/libs/antares/study/series/timeseries-tests.cpp index ec3f172759..61bb294a7d 100644 --- a/src/tests/src/libs/antares/study/series/timeseries-tests.cpp +++ b/src/tests/src/libs/antares/study/series/timeseries-tests.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE "test time series" -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/study/short-term-storage-input/short-term-storage-input-output.cpp b/src/tests/src/libs/antares/study/short-term-storage-input/short-term-storage-input-output.cpp index c2e290d787..276b3daba9 100644 --- a/src/tests/src/libs/antares/study/short-term-storage-input/short-term-storage-input-output.cpp +++ b/src/tests/src/libs/antares/study/short-term-storage-input/short-term-storage-input-output.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE "test short term storage" -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/study/test_study.cpp b/src/tests/src/libs/antares/study/test_study.cpp index 1474f85178..c67dfd5209 100644 --- a/src/tests/src/libs/antares/study/test_study.cpp +++ b/src/tests/src/libs/antares/study/test_study.cpp @@ -20,7 +20,6 @@ */ #define BOOST_TEST_MODULE study -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN #include diff --git a/src/tests/src/libs/antares/study/thermal-price-definition/thermal-price-definition.cpp b/src/tests/src/libs/antares/study/thermal-price-definition/thermal-price-definition.cpp index 23fe483e0c..64e82fea38 100644 --- a/src/tests/src/libs/antares/study/thermal-price-definition/thermal-price-definition.cpp +++ b/src/tests/src/libs/antares/study/thermal-price-definition/thermal-price-definition.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE "test thermal price definition" -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/libs/antares/test_utils.cpp b/src/tests/src/libs/antares/test_utils.cpp index ac87da4671..7dc0f9501b 100644 --- a/src/tests/src/libs/antares/test_utils.cpp +++ b/src/tests/src/libs/antares/test_utils.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test utils -#define BOOST_TEST_DYN_LINK #include #include diff --git a/src/tests/src/libs/antares/writer/test_zip_writer.cpp b/src/tests/src/libs/antares/writer/test_zip_writer.cpp index d05e0b4fcf..75810eaf24 100644 --- a/src/tests/src/libs/antares/writer/test_zip_writer.cpp +++ b/src/tests/src/libs/antares/writer/test_zip_writer.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test-writer tests -#define BOOST_TEST_DYN_LINK #include #include diff --git a/src/tests/src/solver/infeasible-problem-analysis/test-unfeasible-problem-analyzer.cpp b/src/tests/src/solver/infeasible-problem-analysis/test-unfeasible-problem-analyzer.cpp index 2f838995ae..9f845ee38c 100644 --- a/src/tests/src/solver/infeasible-problem-analysis/test-unfeasible-problem-analyzer.cpp +++ b/src/tests/src/solver/infeasible-problem-analysis/test-unfeasible-problem-analyzer.cpp @@ -20,7 +20,6 @@ */ #define WIN32_LEAN_AND_MEAN #define BOOST_TEST_MODULE unfeasible_problem_analyzer -#define BOOST_TEST_DYN_LINK #include #include diff --git a/src/tests/src/solver/optimisation/adequacy_patch.cpp b/src/tests/src/solver/optimisation/adequacy_patch.cpp index 4309ec9582..786cf57537 100644 --- a/src/tests/src/solver/optimisation/adequacy_patch.cpp +++ b/src/tests/src/solver/optimisation/adequacy_patch.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test adequacy patch functions -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/solver/simulation/test-store-timeseries-number.cpp b/src/tests/src/solver/simulation/test-store-timeseries-number.cpp index cdd26a923f..2fc782619a 100644 --- a/src/tests/src/solver/simulation/test-store-timeseries-number.cpp +++ b/src/tests/src/solver/simulation/test-store-timeseries-number.cpp @@ -22,7 +22,6 @@ // Created by marechaljas on 15/03/23. // #define BOOST_TEST_MODULE store-timeseries-number -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN diff --git a/src/tests/src/solver/simulation/test-time_series.cpp b/src/tests/src/solver/simulation/test-time_series.cpp index 2f18a90f4b..7075bd2272 100644 --- a/src/tests/src/solver/simulation/test-time_series.cpp +++ b/src/tests/src/solver/simulation/test-time_series.cpp @@ -22,7 +22,6 @@ // Created by marechaljas on 07/04/23. // #define BOOST_TEST_MODULE rhsTimeSeries -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN #include diff --git a/src/tests/src/solver/simulation/tests-ts-numbers.cpp b/src/tests/src/solver/simulation/tests-ts-numbers.cpp index 8652a16d26..646142853f 100644 --- a/src/tests/src/solver/simulation/tests-ts-numbers.cpp +++ b/src/tests/src/solver/simulation/tests-ts-numbers.cpp @@ -19,7 +19,6 @@ ** along with Antares_Simulator. If not, see . */ #define BOOST_TEST_MODULE test solver simulation things -#define BOOST_TEST_DYN_LINK #define WIN32_LEAN_AND_MEAN From 71470d2a86da20763272d9266a3866896a3dfff6 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Fri, 15 Mar 2024 11:45:21 +0100 Subject: [PATCH 28/50] shift --- src/libs/antares/antlr-interface/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/antares/antlr-interface/CMakeLists.txt b/src/libs/antares/antlr-interface/CMakeLists.txt index 3531ca91ce..f5a08a3796 100644 --- a/src/libs/antares/antlr-interface/CMakeLists.txt +++ b/src/libs/antares/antlr-interface/CMakeLists.txt @@ -24,8 +24,7 @@ target_link_libraries(${PROJ} PUBLIC antlr4_static) # The library or executable target_include_directories(${PROJ} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE - ${ANTLR4_INCLUDE_DIR}) + ${ANTLR4_INCLUDE_DIR}) install(FILES ${HEADERS} DESTINATION "include" From b515cc9fddf7c2378a8aa7a4b598ab763cd64265 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Fri, 15 Mar 2024 14:49:11 +0100 Subject: [PATCH 29/50] static & dynamic linking --- src/libs/antares/antlr-interface/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/antares/antlr-interface/CMakeLists.txt b/src/libs/antares/antlr-interface/CMakeLists.txt index f5a08a3796..4cd06fef3b 100644 --- a/src/libs/antares/antlr-interface/CMakeLists.txt +++ b/src/libs/antares/antlr-interface/CMakeLists.txt @@ -18,8 +18,11 @@ find_package(antlr4-runtime CONFIG REQUIRED) add_library(${PROJ} ${SRCS}) add_library(Antares::${PROJ} ALIAS ${PROJ}) -target_link_libraries(${PROJ} PUBLIC antlr4_static) # The library or executable that require yaml-cpp library - +if(MSVC) + target_link_libraries(${PROJ} PUBLIC antlr4_shared) # vcpkg triplet x64-windows provides shared lib +else() + target_link_libraries(${PROJ} PUBLIC antlr4_static) # vcpkg triplet x64-linux provides static lib +endif() target_include_directories(${PROJ} PUBLIC From ef816f82f614d13c8c618815a7d47c325fdd5562 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 26 Mar 2024 10:22:33 +0100 Subject: [PATCH 30/50] update tests --- .../antlr4-interface/test_antlr_interface.cpp | 14 ++------------ .../src/libs/antares/yaml-parser/CMakeLists.txt | 7 +------ .../libs/antares/yaml-parser/test_yaml_parser.cpp | 8 -------- 3 files changed, 3 insertions(+), 26 deletions(-) diff --git a/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp b/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp index 4c2a5153ff..e97f4e3524 100644 --- a/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp +++ b/src/tests/src/libs/antares/antlr4-interface/test_antlr_interface.cpp @@ -30,20 +30,10 @@ using namespace antlr4; BOOST_AUTO_TEST_CASE(test_antlr_interface) { - const std::string my_input = "y = b + ax"; + const std::string my_input = "y = b + a*x"; ANTLRInputStream input(my_input); ExprLexer lexer(&input); CommonTokenStream tokens(&lexer); tokens.fill(); - for (auto token : tokens.getTokens()) - { - std::cout << token->toString() << std::endl; - } - BOOST_CHECK(tokens.getTokens().size() == 6); - // ExprParser parser(&tokens); - // tree::ParseTree* tree = parser.main(); - - // auto s = tree->toStringTree(&parser); - // auto input_stream = parser.getInputStream(); - // BOOST_CHECK(input_stream->size() == my_input.size()); + BOOST_CHECK(tokens.getTokens().size() == 8); } diff --git a/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt b/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt index 8b8eb1b2ea..1f33518fc3 100644 --- a/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt +++ b/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt @@ -5,16 +5,11 @@ Set(SRCS test_yaml_parser.cpp set(execname "yaml-parser-test") add_executable(${execname} ${SRCS}) -# INSTALL(EXPORT ${execname} -# FILE yaml-parser-testConfig.cmake -# DESTINATION cmake -# ) -# add antlr4cpp artifacts to project environment target_link_libraries(${execname} PRIVATE yaml-cpp Boost::unit_test_framework - ) # The library or executable that require yaml-cpp + ) add_test(NAME yaml-parser COMMAND ${execname}) diff --git a/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp index a4ae23ee90..771278f645 100644 --- a/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp +++ b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp @@ -145,14 +145,6 @@ BOOST_AUTO_TEST_CASE(test_yaml_parser) for (unsigned i = 0; i < doc.size(); i++) { monsters.push_back(doc[i].as()); - const Monster& monster = monsters.back(); - std::cout << "Position: " << monster.position.x << ", " << monster.position.y << ", " - << monster.position.z << "\n"; - std::cout << "Powers: \n"; - for (const auto power : monster.powers) - { - std::cout << power.name << " " << power.damage << "\n"; - } } BOOST_CHECK(monsters.size() == 3); auto ogre = monsters[0]; From 570c872fd6bdd980f3953c822dcb5098c1efa238 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 26 Mar 2024 10:25:48 +0100 Subject: [PATCH 31/50] update --- src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp index 771278f645..ebfbc4bba8 100644 --- a/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp +++ b/src/tests/src/libs/antares/yaml-parser/test_yaml_parser.cpp @@ -140,6 +140,7 @@ BOOST_AUTO_TEST_CASE(test_yaml_parser) damage: 50 - name: Staff damage: 3)"; + YAML::Node doc = YAML::Load(my_yaml); std::vector monsters; for (unsigned i = 0; i < doc.size(); i++) From b9aa0b919c3dfe71904e5915c00ea35914bfa560 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 26 Mar 2024 10:27:59 +0100 Subject: [PATCH 32/50] clean ub wf --- .github/workflows/ubuntu.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 2fdfd90d27..05872b3531 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -86,10 +86,7 @@ jobs: - name: export wxWidgets script shell: bash run: | - echo ${{ env.WX_CONFIG}} - cat ${{ env.WX_CONFIG}} - export WX_CONFIG=/usr/bin/wx-config - cat $WX_CONFIG + export WX_CONFIG=${{env.WX_CONFIG}} - name : Install deps with VCPKG run: | @@ -139,7 +136,6 @@ jobs: - name: Configure run: | - export WX_CONFIG=${{env.WX_CONFIG}} cmake -B _build -S src \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ From 0df4f94833cd01327b805275c156976cde6b6bef Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 26 Mar 2024 10:37:52 +0100 Subject: [PATCH 33/50] [skip ci] --- .github/workflows/ubuntu.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 05872b3531..549d09e3a2 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -81,7 +81,6 @@ jobs: sudo apt-get update sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev sudo apt-get install g++-10 gcc-10 - # sudo apt-get install libyaml-cpp-dev libantlr4-runtime-dev - name: export wxWidgets script shell: bash From 6db6c36a0f9d362af8d955c7ae207db86186c818 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 3 Apr 2024 14:51:51 +0200 Subject: [PATCH 34/50] make antrl4 build optional --- src/libs/antares/CMakeLists.txt | 4 +++- src/tests/src/libs/antares/CMakeLists.txt | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libs/antares/CMakeLists.txt b/src/libs/antares/CMakeLists.txt index 143e382ff1..4bb09369ee 100644 --- a/src/libs/antares/CMakeLists.txt +++ b/src/libs/antares/CMakeLists.txt @@ -26,7 +26,9 @@ add_subdirectory(study) add_subdirectory(sys) add_subdirectory(utils) add_subdirectory(writer) -add_subdirectory(antlr-interface) +if(WITH_ANTLR4) + add_subdirectory(antlr-interface) +endif() set(HEADERS include/antares/antares/antares.h diff --git a/src/tests/src/libs/antares/CMakeLists.txt b/src/tests/src/libs/antares/CMakeLists.txt index c71e8519e7..cc5af72ed6 100644 --- a/src/tests/src/libs/antares/CMakeLists.txt +++ b/src/tests/src/libs/antares/CMakeLists.txt @@ -2,7 +2,10 @@ add_subdirectory(concurrency) add_subdirectory(writer) add_subdirectory(study) add_subdirectory(yaml-parser) -add_subdirectory(antlr4-interface) + +if(WITH_ANTLR4) + add_subdirectory(antlr-interface) +endif() set(src_libs_antares "${CMAKE_SOURCE_DIR}/libs/antares") From 33ebaea32367677ba83a2c1ad3953f6ff67f2fea Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 3 Apr 2024 15:07:23 +0200 Subject: [PATCH 35/50] add with_yamlcpp option --- src/tests/src/libs/antares/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tests/src/libs/antares/CMakeLists.txt b/src/tests/src/libs/antares/CMakeLists.txt index cc5af72ed6..9234d9e3a4 100644 --- a/src/tests/src/libs/antares/CMakeLists.txt +++ b/src/tests/src/libs/antares/CMakeLists.txt @@ -1,10 +1,12 @@ add_subdirectory(concurrency) add_subdirectory(writer) add_subdirectory(study) -add_subdirectory(yaml-parser) +if(WITH_YAMLCPP) + add_subdirectory(yaml-parser) +endif() if(WITH_ANTLR4) - add_subdirectory(antlr-interface) + add_subdirectory(antlr-interface) endif() set(src_libs_antares "${CMAKE_SOURCE_DIR}/libs/antares") From f4c769ad6ae8c8f24eaa3f3cd526e1f63e8e54f0 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 3 Apr 2024 15:07:59 +0200 Subject: [PATCH 36/50] [skip ci] --- src/tests/src/libs/antares/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/src/libs/antares/CMakeLists.txt b/src/tests/src/libs/antares/CMakeLists.txt index 9234d9e3a4..1af455dfdd 100644 --- a/src/tests/src/libs/antares/CMakeLists.txt +++ b/src/tests/src/libs/antares/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(concurrency) add_subdirectory(writer) add_subdirectory(study) + if(WITH_YAMLCPP) add_subdirectory(yaml-parser) endif() From 82b0e44fb917c3b66a063f5047a6bc6824c1cd71 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 3 Apr 2024 15:12:20 +0200 Subject: [PATCH 37/50] print new optins at config --- src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 00836af2a7..07b6b0b0aa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -185,6 +185,12 @@ message(STATUS "Build OR-Tools: ${BUILD_ORTOOLS}") option(BUILD_MINIZIP "Build minizip" OFF) message(STATUS "Build minizip: ${BUILD_MINIZIP}") +option(WITH_ANTLR4 "With antlr4" OFF) +message(STATUS "With antlr4: ${WITH_ANTLR4}") + +option(BUILD_YAMLCPP "With yaml-cpp" OFF) +message(STATUS "With yaml-cpp: ${BUILD_YAMLCPP}") + option(BUILD_MERSENNE_TWISTER_PYBIND11 "Build pybind11 bindings for Mersenne-Twister" OFF) if (${BUILD_MERSENNE_TWISTER_PYBIND11}) find_package(pybind11 REQUIRED) From d7861e746a710595852d07668618096104829949 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Mon, 8 Apr 2024 14:00:44 +0200 Subject: [PATCH 38/50] Fix option to build yaml test --- src/CMakeLists.txt | 4 ++-- src/tests/src/libs/antares/yaml-parser/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 07b6b0b0aa..ec683017ff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -188,8 +188,8 @@ message(STATUS "Build minizip: ${BUILD_MINIZIP}") option(WITH_ANTLR4 "With antlr4" OFF) message(STATUS "With antlr4: ${WITH_ANTLR4}") -option(BUILD_YAMLCPP "With yaml-cpp" OFF) -message(STATUS "With yaml-cpp: ${BUILD_YAMLCPP}") +option(WITH_YAMLCPP "With yaml-cpp" OFF) +message(STATUS "With yaml-cpp: ${WITH_YAMLCPP}") option(BUILD_MERSENNE_TWISTER_PYBIND11 "Build pybind11 bindings for Mersenne-Twister" OFF) if (${BUILD_MERSENNE_TWISTER_PYBIND11}) diff --git a/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt b/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt index 1f33518fc3..1633966826 100644 --- a/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt +++ b/src/tests/src/libs/antares/yaml-parser/CMakeLists.txt @@ -9,7 +9,7 @@ target_link_libraries(${execname} PRIVATE yaml-cpp Boost::unit_test_framework - ) + ) add_test(NAME yaml-parser COMMAND ${execname}) From ebc539a8b6c7c23eea904c635dfcc79f0b08129d Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Mon, 8 Apr 2024 14:39:13 +0200 Subject: [PATCH 39/50] Fix dir name --- src/tests/src/libs/antares/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/src/libs/antares/CMakeLists.txt b/src/tests/src/libs/antares/CMakeLists.txt index 1af455dfdd..4fc2ef7708 100644 --- a/src/tests/src/libs/antares/CMakeLists.txt +++ b/src/tests/src/libs/antares/CMakeLists.txt @@ -7,7 +7,7 @@ if(WITH_YAMLCPP) endif() if(WITH_ANTLR4) - add_subdirectory(antlr-interface) + add_subdirectory(antlr4-interface) endif() set(src_libs_antares "${CMAKE_SOURCE_DIR}/libs/antares") From bf98872f8ac7b328dbc0b814b78537e97e85ea70 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 23 Apr 2024 09:56:52 +0200 Subject: [PATCH 40/50] test with minizip --- .github/workflows/ubuntu.yml | 2 +- .github/workflows/windows-vcpkg.yml | 2 +- src/CMakeLists.txt | 58 ++++++++++++++--------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 0da76c34fb..0740629bad 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -29,7 +29,7 @@ env: RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} VCPKG_ROOT: ${{ github.workspace }}/vcpkg - vcpkgPackages: yaml-cpp antlr4 boost-test + vcpkgPackages: yaml-cpp antlr4 boost-test minizip-ng triplet: x64-linux WX_CONFIG: /usr/bin/wx-config diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index fb5c972180..3346cd5d9c 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -39,7 +39,7 @@ jobs: ORTOOLS_DIR: ${{ github.workspace }}/or-tools os: windows-latest test-platform: windows-2022 - vcpkgPackages: wxwidgets boost-test yaml-cpp antlr4 + vcpkgPackages: wxwidgets boost-test yaml-cpp antlr4 minizip-ng triplet: x64-windows runs-on: windows-latest diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index adfa646d54..10937f77db 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -290,35 +290,35 @@ message(STATUS "OR-Tools tag ${ORTOOLS_TAG}") FetchContent_MakeAvailable(ortools) endif() -find_package(minizip QUIET) - -if(NOT minizip_FOUND OR BUILD_MINIZIP) - if (NOT minizip_FOUND) - message("minizip not found, downloading") - endif () - if (BUILD_MINIZIP) - message("BUILD_MINIZIP set, downloading") - endif () - # Repository + tag - set(MZ_REPOSITORY "https://github.com/zlib-ng/minizip-ng.git") - set(MZ_TAG "4.0.1") - # CMake flags - set(MZ_LZMA "OFF" CACHE INTERNAL "") - set(MZ_ZSTD "OFF" CACHE INTERNAL "") - set(MZ_BZIP2 "OFF" CACHE INTERNAL "") - set(MZ_PKCRYPT "OFF" CACHE INTERNAL "") - set(MZ_WZAES "OFF" CACHE INTERNAL "") - set(MZ_OPENSSL "OFF" CACHE INTERNAL "") - set(MZ_ICONV "OFF" CACHE INTERNAL "") - - FetchContent_Declare(minizip - GIT_REPOSITORY ${MZ_REPOSITORY} - GIT_TAG ${MZ_TAG} - OVERRIDE_FIND_PACKAGE - ) - - FetchContent_MakeAvailable(minizip) -endif() +# find_package(minizip QUIET) + +# if(NOT minizip_FOUND OR BUILD_MINIZIP) +# if (NOT minizip_FOUND) +# message("minizip not found, downloading") +# endif () +# if (BUILD_MINIZIP) +# message("BUILD_MINIZIP set, downloading") +# endif () +# # Repository + tag +# set(MZ_REPOSITORY "https://github.com/zlib-ng/minizip-ng.git") +# set(MZ_TAG "4.0.1") +# # CMake flags +# set(MZ_LZMA "OFF" CACHE INTERNAL "") +# set(MZ_ZSTD "OFF" CACHE INTERNAL "") +# set(MZ_BZIP2 "OFF" CACHE INTERNAL "") +# set(MZ_PKCRYPT "OFF" CACHE INTERNAL "") +# set(MZ_WZAES "OFF" CACHE INTERNAL "") +# set(MZ_OPENSSL "OFF" CACHE INTERNAL "") +# set(MZ_ICONV "OFF" CACHE INTERNAL "") + +# FetchContent_Declare(minizip +# GIT_REPOSITORY ${MZ_REPOSITORY} +# GIT_TAG ${MZ_TAG} +# OVERRIDE_FIND_PACKAGE +# ) + +# FetchContent_MakeAvailable(minizip) +# endif() find_package(minizip REQUIRED) From 606de3d41f1a8a9c4e805d5770e5624227e33a47 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 23 Apr 2024 10:05:02 +0200 Subject: [PATCH 41/50] update --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 10937f77db..b99e1b6a25 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -319,7 +319,7 @@ endif() # FetchContent_MakeAvailable(minizip) # endif() -find_package(minizip REQUIRED) +find_package(minizip-ng REQUIRED) #wxWidget not needed for all library find is done in ui CMakeLists.txt From d5c16e798ad1d228474a66fc3613cc8bb81c862a Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 23 Apr 2024 10:16:58 +0200 Subject: [PATCH 42/50] ... --- src/libs/antares/writer/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/antares/writer/CMakeLists.txt b/src/libs/antares/writer/CMakeLists.txt index 2a35d9c00e..bd9a943bb0 100644 --- a/src/libs/antares/writer/CMakeLists.txt +++ b/src/libs/antares/writer/CMakeLists.txt @@ -1,5 +1,5 @@ project(result-writer) -find_package(minizip) +find_package(minizip-ng) add_library(result_writer # Helper class From 6f8938a8bad68a4d0ce90a5ffc7db18c3b07924b Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 23 Apr 2024 11:09:34 +0200 Subject: [PATCH 43/50] .... --- src/config.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/config.h diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000000..6b88cd3a85 --- /dev/null +++ b/src/config.h @@ -0,0 +1,44 @@ +#ifndef __ANTARES_CONFIG_H__ +# define __ANTARES_CONFIG_H__ + + +//! The Hi version +# define ANTARES_VERSION_HI 8 +//! The Lo version +# define ANTARES_VERSION_LO 8 +//! Build (Revision) of Antares +# define ANTARES_VERSION_BUILD 3 +//! Canonical version +# define ANTARES_VERSION "8.8" +//! Date of publication +# define ANTARES_VERSION_YEAR 2024 + +//! Version in CString format +# define ANTARES_VERSION_STR "8.8.3" + +//! Version + Publisher +# define ANTARES_VERSION_PUB_STR "8.8.3 (RTE France)" + + +# define ANTARES_VERSION_BUILD_DATE __DATE__ + +//! The Publisher +# define ANTARES_PUBLISHER "RTE France" +//! The Website for RTE +# define ANTARES_WEBSITE "https://antares-simulator.org/" +//! URL for the online documentation +#define ANTARES_ONLINE_DOC "https://antares-simulator.readthedocs.io/" + +// ---------------------------------------------------------------------------- + +//! Beta version +/* #undef ANTARES_BETA */ + +//! RC version +/* #undef ANTARES_RC */ + +//! git revision (SHA-1) +#define GIT_SHA1_SHORT_STRING "7be66dc-dirty" + +#endif // __ANTARES_CONFIG_H__ + From 753bc3b5016550c2e666ea0158ad485fdf80a8f4 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 23 Apr 2024 11:18:48 +0200 Subject: [PATCH 44/50] .... --- src/packaging/CMakeLists.txt | 2 +- src/packaging/Config.cmake.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/packaging/CMakeLists.txt b/src/packaging/CMakeLists.txt index b2a8709db9..fcb66ccfff 100644 --- a/src/packaging/CMakeLists.txt +++ b/src/packaging/CMakeLists.txt @@ -52,7 +52,7 @@ set(TARGET_LIBS #No alias # signal-handling antares-solver-variable-info - minizip + minizip-ng ) install(TARGETS ${TARGET_LIBS} diff --git a/src/packaging/Config.cmake.in b/src/packaging/Config.cmake.in index be7a1a62fa..dc37f5d9cd 100644 --- a/src/packaging/Config.cmake.in +++ b/src/packaging/Config.cmake.in @@ -2,7 +2,7 @@ include(CMakeFindDependencyMacro) find_dependency(ortools) -find_dependency(minizip) +find_dependency(minizip-ng) include("${CMAKE_CURRENT_LIST_DIR}/AntaresTargets.cmake") From 69d34bc42030a7afb8765913c15ccb1c10f017a3 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 23 Apr 2024 11:50:44 +0200 Subject: [PATCH 45/50] fix target name --- src/libs/antares/writer/CMakeLists.txt | 2 +- src/packaging/CMakeLists.txt | 2 +- src/tests/src/libs/antares/writer/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/antares/writer/CMakeLists.txt b/src/libs/antares/writer/CMakeLists.txt index bd9a943bb0..ad7c3c0ac7 100644 --- a/src/libs/antares/writer/CMakeLists.txt +++ b/src/libs/antares/writer/CMakeLists.txt @@ -35,7 +35,7 @@ target_link_libraries(result_writer Antares::benchmarking yuni-static-core PRIVATE - MINIZIP::minizip + MINIZIP::minizip-ng logs inifile io diff --git a/src/packaging/CMakeLists.txt b/src/packaging/CMakeLists.txt index fcb66ccfff..ae5b00b3ec 100644 --- a/src/packaging/CMakeLists.txt +++ b/src/packaging/CMakeLists.txt @@ -52,7 +52,7 @@ set(TARGET_LIBS #No alias # signal-handling antares-solver-variable-info - minizip-ng + #minizip-ng ) install(TARGETS ${TARGET_LIBS} diff --git a/src/tests/src/libs/antares/writer/CMakeLists.txt b/src/tests/src/libs/antares/writer/CMakeLists.txt index 6fe90ee1fd..27cdf7b606 100644 --- a/src/tests/src/libs/antares/writer/CMakeLists.txt +++ b/src/tests/src/libs/antares/writer/CMakeLists.txt @@ -8,7 +8,7 @@ target_link_libraries(test-writer Boost::unit_test_framework Antares::result_writer test_utils_unit - MINIZIP::minizip + MINIZIP::minizip-ng ) add_test(NAME writer COMMAND test-writer) From b2c295341b5def6b33e566a38f6675ab135de4ef Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 23 Apr 2024 14:35:32 +0200 Subject: [PATCH 46/50] disable unused features --- .github/workflows/ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 0740629bad..f290fec118 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -29,7 +29,7 @@ env: RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} VCPKG_ROOT: ${{ github.workspace }}/vcpkg - vcpkgPackages: yaml-cpp antlr4 boost-test minizip-ng + vcpkgPackages: yaml-cpp antlr4 boost-test minizip-ng[core,zlib] triplet: x64-linux WX_CONFIG: /usr/bin/wx-config From 24a8a6cb739d356d1a2b86c87099ab948b285368 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 23 Apr 2024 15:15:44 +0200 Subject: [PATCH 47/50] fix sonar --- .github/workflows/sonarcloud.yml | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 9c061abe15..96f20fd4dd 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -15,6 +15,10 @@ jobs: env: SONAR_SERVER_URL: "https://sonarcloud.io" ORTOOLS_DIR: ${{ github.workspace }}/or-tools + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + vcpkgPackages: yaml-cpp antlr4 boost-test minizip-ng[core,zlib] + triplet: x64-linux + WX_CONFIG: /usr/bin/wx-config steps: - uses: actions/checkout@v4 @@ -33,6 +37,28 @@ jobs: with: key: sonarcloud-${{ env.SONAR_SCANNER_VERSION }} + + - name : Init VCPKG submodule + run: | + git submodule update --init vcpkg + + # Restore both vcpkg and its artifacts from the GitHub cache service. + - name: Restore vcpkg and its artifacts. + uses: actions/cache@v4 + with: + # The first path is the location of vcpkg (it contains the vcpkg executable and data files). + # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). + key: | + ${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ env.triplet }} + - name: Install libraries run: | sudo apt-get update @@ -40,6 +66,19 @@ jobs: sudo apt-get install libboost-test-dev sudo apt-get install g++-10 gcc-10 + - name: export wxWidgets script + shell: bash + run: | + export WX_CONFIG=${{env.WX_CONFIG}} + + - name : Install deps with VCPKG + run: | + cd vcpkg + ./bootstrap-vcpkg.sh + vcpkg install ${{env.vcpkgPackages}} --triplet ${{env.triplet}} + rm -rf buildtrees packages downloads + shell: bash + - name: Read antares-deps version id: antares-deps-version uses: notiz-dev/github-action-json-property@release @@ -78,6 +117,8 @@ jobs: run: | cmake -B _build -S src \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ + -DVCPKG_TARGET_TRIPLET=${{ env.triplet }} \ -DCMAKE_C_COMPILER=/usr/bin/gcc-10 \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \ From 1b22bc246b58098ecfecf03c5be477026b520512 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 23 Apr 2024 15:20:33 +0200 Subject: [PATCH 48/50] fix YAML --- .github/workflows/sonarcloud.yml | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 96f20fd4dd..eb62ac47c8 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -38,26 +38,26 @@ jobs: key: sonarcloud-${{ env.SONAR_SCANNER_VERSION }} - - name : Init VCPKG submodule - run: | - git submodule update --init vcpkg - - # Restore both vcpkg and its artifacts from the GitHub cache service. - - name: Restore vcpkg and its artifacts. - uses: actions/cache@v4 - with: - # The first path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. - path: | - ${{ env.VCPKG_ROOT }} - !${{ env.VCPKG_ROOT }}/buildtrees - !${{ env.VCPKG_ROOT }}/packages - !${{ env.VCPKG_ROOT }}/downloads - # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. - # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. - # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). - key: | - ${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ env.triplet }} + - name : Init VCPKG submodule + run: | + git submodule update --init vcpkg + + # Restore both vcpkg and its artifacts from the GitHub cache service. + - name: Restore vcpkg and its artifacts. + uses: actions/cache@v4 + with: + # The first path is the location of vcpkg (it contains the vcpkg executable and data files). + # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). + key: | + ${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ env.triplet }} - name: Install libraries run: | From c636cb6782d989a835c0b1ad0c39517d51287586 Mon Sep 17 00:00:00 2001 From: abdoulbari zaher <32519851+a-zakir@users.noreply.github.com> Date: Thu, 25 Apr 2024 08:31:21 +0000 Subject: [PATCH 49/50] delete conf file --- src/config.h | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 src/config.h diff --git a/src/config.h b/src/config.h deleted file mode 100644 index 6b88cd3a85..0000000000 --- a/src/config.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __ANTARES_CONFIG_H__ -# define __ANTARES_CONFIG_H__ - - -//! The Hi version -# define ANTARES_VERSION_HI 8 -//! The Lo version -# define ANTARES_VERSION_LO 8 -//! Build (Revision) of Antares -# define ANTARES_VERSION_BUILD 3 -//! Canonical version -# define ANTARES_VERSION "8.8" -//! Date of publication -# define ANTARES_VERSION_YEAR 2024 - -//! Version in CString format -# define ANTARES_VERSION_STR "8.8.3" - -//! Version + Publisher -# define ANTARES_VERSION_PUB_STR "8.8.3 (RTE France)" - - -# define ANTARES_VERSION_BUILD_DATE __DATE__ - -//! The Publisher -# define ANTARES_PUBLISHER "RTE France" -//! The Website for RTE -# define ANTARES_WEBSITE "https://antares-simulator.org/" -//! URL for the online documentation -#define ANTARES_ONLINE_DOC "https://antares-simulator.readthedocs.io/" - -// ---------------------------------------------------------------------------- - -//! Beta version -/* #undef ANTARES_BETA */ - -//! RC version -/* #undef ANTARES_RC */ - -//! git revision (SHA-1) -#define GIT_SHA1_SHORT_STRING "7be66dc-dirty" - -#endif // __ANTARES_CONFIG_H__ - From 1ddd84694782fbb65a1b91e6bf861dcc9f872fe3 Mon Sep 17 00:00:00 2001 From: abdoulbari zaher <32519851+a-zakir@users.noreply.github.com> Date: Thu, 25 Apr 2024 08:33:28 +0000 Subject: [PATCH 50/50] clean --- src/CMakeLists.txt | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b99e1b6a25..fe637acb46 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -290,35 +290,7 @@ message(STATUS "OR-Tools tag ${ORTOOLS_TAG}") FetchContent_MakeAvailable(ortools) endif() -# find_package(minizip QUIET) - -# if(NOT minizip_FOUND OR BUILD_MINIZIP) -# if (NOT minizip_FOUND) -# message("minizip not found, downloading") -# endif () -# if (BUILD_MINIZIP) -# message("BUILD_MINIZIP set, downloading") -# endif () -# # Repository + tag -# set(MZ_REPOSITORY "https://github.com/zlib-ng/minizip-ng.git") -# set(MZ_TAG "4.0.1") -# # CMake flags -# set(MZ_LZMA "OFF" CACHE INTERNAL "") -# set(MZ_ZSTD "OFF" CACHE INTERNAL "") -# set(MZ_BZIP2 "OFF" CACHE INTERNAL "") -# set(MZ_PKCRYPT "OFF" CACHE INTERNAL "") -# set(MZ_WZAES "OFF" CACHE INTERNAL "") -# set(MZ_OPENSSL "OFF" CACHE INTERNAL "") -# set(MZ_ICONV "OFF" CACHE INTERNAL "") - -# FetchContent_Declare(minizip -# GIT_REPOSITORY ${MZ_REPOSITORY} -# GIT_TAG ${MZ_TAG} -# OVERRIDE_FIND_PACKAGE -# ) - -# FetchContent_MakeAvailable(minizip) -# endif() + find_package(minizip-ng REQUIRED)