From 9c7bdbd641daff0ebfcf56985d856e5bd3de9106 Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 14 May 2024 00:45:09 +0900 Subject: [PATCH] cpp-validator: add version 2.1.1 --- recipes/cpp-validator/all/conandata.yml | 3 +++ recipes/cpp-validator/all/conanfile.py | 5 ++++- recipes/cpp-validator/all/test_package/CMakeLists.txt | 7 +++++-- recipes/cpp-validator/all/test_package/test_package.cpp | 6 ++++++ recipes/cpp-validator/config.yml | 2 ++ 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/recipes/cpp-validator/all/conandata.yml b/recipes/cpp-validator/all/conandata.yml index 77d92b9be932b..8a9f73ab23200 100644 --- a/recipes/cpp-validator/all/conandata.yml +++ b/recipes/cpp-validator/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.1.1": + url: "https://github.com/evgeniums/cpp-validator/archive/refs/tags/v2.1.1.tar.gz" + sha256: "3a9e63c529a9b69092597077111b81fd7f0ab7ffa1a80b0f15fb24270cb9acdc" "2.0.3": url: "https://github.com/evgeniums/cpp-validator/archive/refs/tags/v2.0.3.tar.gz" sha256: "0afc607377518edd6adc1612962ed5d5808d96e5b40944d9ce7e91a1aa9ab1d8" diff --git a/recipes/cpp-validator/all/conanfile.py b/recipes/cpp-validator/all/conanfile.py index befec7e45358b..cc038a1d3db50 100644 --- a/recipes/cpp-validator/all/conanfile.py +++ b/recipes/cpp-validator/all/conanfile.py @@ -26,7 +26,10 @@ class CPPValidatorConan(ConanFile): def _min_cppstd(self): # cpp-validator rquires C++17 on MSVC # https://github.com/evgeniums/cpp-validator/blob/v2.0.3/CMakeLists.txt#L241 - return "17" if is_msvc(self) else "14" + if is_msvc(self) or Version(self.version) >= "2.1.1": + return "17" + else: + return "14" @property def _compilers_minimum_version(self): diff --git a/recipes/cpp-validator/all/test_package/CMakeLists.txt b/recipes/cpp-validator/all/test_package/CMakeLists.txt index aaf79983c7d60..941387bb02153 100644 --- a/recipes/cpp-validator/all/test_package/CMakeLists.txt +++ b/recipes/cpp-validator/all/test_package/CMakeLists.txt @@ -4,9 +4,12 @@ project(test_package LANGUAGES CXX) find_package(cpp-validator REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cpp-validator::cpp-validator) -if(MSVC) +target_link_libraries(${PROJECT_NAME} PRIVATE cpp-validator::cpp-validator) +if(MSVC OR cpp-validator_VERSION VERSION_GREATER_EQUAL "2.1.1") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) else() target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) endif() +if(cpp-validator_VERSION VERSION_LESS "2.1.1") + target_compile_definitions(${PROJECT_NAME} PRIVATE CPP_VALIDATOR_2_0) +endif() diff --git a/recipes/cpp-validator/all/test_package/test_package.cpp b/recipes/cpp-validator/all/test_package/test_package.cpp index 9b71de3f6c7ab..6956d5a3cb408 100644 --- a/recipes/cpp-validator/all/test_package/test_package.cpp +++ b/recipes/cpp-validator/all/test_package/test_package.cpp @@ -1,8 +1,14 @@ #include +#ifdef CPP_VALIDATOR_2_0 #include "dracosha/validator/validator.hpp" #include "dracosha/validator/validate.hpp" using namespace DRACOSHA_VALIDATOR_NAMESPACE; +#else +#include "hatn/validator/validator.hpp" +#include "hatn/validator/validate.hpp" +using namespace HATN_VALIDATOR_NAMESPACE; +#endif int main() { diff --git a/recipes/cpp-validator/config.yml b/recipes/cpp-validator/config.yml index 7f57148a20478..b337c3b9e4619 100644 --- a/recipes/cpp-validator/config.yml +++ b/recipes/cpp-validator/config.yml @@ -1,3 +1,5 @@ versions: + "2.1.1": + folder: all "2.0.3": folder: all