-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#13959) [json-schema-validator] Conan v2 support
* Bump nlohmann_json/3.11.2 * conan v2: ConanFile, tools, ConanInvalidConfiguration * conan v2: CMakeDeps generator * conan v2: patch order of project and cmake_minimum_version so toolchain works... * fix linter complaint about missing patch_type and patch_description * Delete CMakeLists.txt as no longer required * Apply suggestions from code review Co-authored-by: Uilian Ries <uilianries@gmail.com> * Fix cmake_target_name to complete name * conan v2 test_package Co-authored-by: Uilian Ries <uilianries@gmail.com>
- Loading branch information
1 parent
31f87ec
commit 97175e5
Showing
9 changed files
with
129 additions
and
68 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
recipes/json-schema-validator/all/patches/2.0.0-cmake_minimum_version.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- a/CMakeLists.txt 2019-04-02 10:39:55.000000000 -0000 | ||
+++ b/CMakeLists.txt 2022-11-07 17:09:53.295000000 -0000 | ||
@@ -1,10 +1,10 @@ | ||
+cmake_minimum_required(VERSION 3.2) | ||
+ | ||
project(json-schema-validator | ||
LANGUAGES CXX) | ||
|
||
set(PROJECT_VERSION 2.0.0) | ||
|
||
-cmake_minimum_required(VERSION 3.2) | ||
- | ||
option(BUILD_TESTS "Build tests" ON) | ||
option(BUILD_EXAMPLES "Build examples" ON) | ||
|
15 changes: 15 additions & 0 deletions
15
recipes/json-schema-validator/all/patches/2.1.0-cmake_minimum_version.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- a/CMakeLists.txt 2020-05-15 09:04:12.000000000 -0000 | ||
+++ b/CMakeLists.txt 2022-11-07 16:57:29.655000000 -0000 | ||
@@ -1,10 +1,10 @@ | ||
+cmake_minimum_required(VERSION 3.2) | ||
+ | ||
project(nlohmann_json_schema_validator | ||
LANGUAGES CXX) | ||
|
||
set(PROJECT_VERSION 2.1.0) | ||
|
||
-cmake_minimum_required(VERSION 3.2) | ||
- | ||
option(BUILD_TESTS "Build tests" ON) | ||
option(BUILD_EXAMPLES "Build examples" ON) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(nlohmann_json_schema_validator CONFIG REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) | ||
target_link_libraries(${PROJECT_NAME} nlohmann_json_schema_validator) | ||
target_link_libraries(${PROJECT_NAME} nlohmann_json_schema_validator::nlohmann_json_schema_validator) |
19 changes: 14 additions & 5 deletions
19
recipes/json-schema-validator/all/test_package/conanfile.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
11 changes: 11 additions & 0 deletions
11
recipes/json-schema-validator/all/test_v1_package/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(nlohmann_json_schema_validator CONFIG REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) | ||
target_link_libraries(${PROJECT_NAME} nlohmann_json_schema_validator) |
17 changes: 17 additions & 0 deletions
17
recipes/json-schema-validator/all/test_v1_package/conanfile.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |