Skip to content

Commit

Permalink
confu_json: add v1.1.1 (#25374)
Browse files Browse the repository at this point in the history
* confu_json: add v1.1.0

* confu_json: drop all existing versions

* confu_json: use boost/1.85.0

* Update recipes/confu_json/all/conanfile.py

* confu_json 1.1.1

* remove unused import

---------

Co-authored-by: Abril Rincón Blanco <[email protected]>
Co-authored-by: Luis Caro Campos <[email protected]>
  • Loading branch information
3 people authored Dec 31, 2024
1 parent 7e056a3 commit df43c18
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 101 deletions.
15 changes: 3 additions & 12 deletions recipes/confu_json/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
sources:
"1.0.0":
url: "https://github.com/werto87/confu_json/archive/refs/tags/v1.0.0.tar.gz"
sha256: "f165172220b440d37a7a8301e490cf791b3b25b0cc3f2a08b355609c5f777db0"
"0.0.10":
url: "https://github.com/werto87/confu_json/archive/refs/tags/v0.0.10.tar.gz"
sha256: "b31aab1bce952c0dc0bfc1f955a7b88be5103350b5a5eee1a4586ccec0e51fc1"
"0.0.9":
url: "https://github.com/werto87/confu_json/archive/refs/tags/v0.0.9.tar.gz"
sha256: "29b2940b939cb04f11fdab4964c86bcb23ac75c588550bf54048e024444d2718"
"0.0.5":
url: "https://github.com/werto87/confu_json/archive/refs/tags/v0.0.5.tar.gz"
sha256: "bc506d4b7836a7689b1c6a2d89bb0c3441f774c8f845fef79d85c71099df5bf9"
"1.1.1":
url: "https://github.com/werto87/confu_json/archive/refs/tags/v1.1.1.tar.gz"
sha256: "6b302c7c4b926db8ff0de65254eb0422eab04385a389715b88297bebf5378c35"
61 changes: 10 additions & 51 deletions recipes/confu_json/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,85 +3,44 @@
from conan.tools.build import check_min_cppstd
from conan.tools.files import copy, get
from conan.tools.layout import basic_layout
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version
import os

required_conan_version = ">=1.51.1"
required_conan_version = ">=2.0"


class ConfuJson(ConanFile):
name = "confu_json"
homepage = "https://github.com/werto87/confu_json"
description = "uses boost::fusion to help with serialization; json <-> user defined type"
topics = ("json parse", "serialization", "user defined type")
description = "Uses boost::fusion to help with serialization; json <-> user defined type"
topics = ("json", "serialization", "user-defined-type", "header-only")
license = "BSL-1.0"
url = "https://github.com/conan-io/conan-center-index"
package_type = "header-library"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True

@property
def _min_cppstd(self):
return "20" if Version(self.version) < "1.0.0" else "17"

@property
def _compilers_minimum_version(self):
return {
"17": {
"Visual Studio": "17",
"msvc": "193",
"gcc": "7",
"clang": "7",
},
"20": {
"Visual Studio": "17",
"msvc": "193",
"gcc": "10",
"clang": "10",
},
}.get(self._min_cppstd, {})

def layout(self):
basic_layout(self, src_folder="src")

def requirements(self):
self.requires("boost/1.81.0")
self.requires("magic_enum/0.8.2")
self.requires("boost/1.85.0")
self.requires("magic_enum/0.9.6")

def package_id(self):
self.info.clear()

def validate(self):
if self.settings.compiler == "apple-clang":
raise ConanInvalidConfiguration("apple-clang is not supported. Pull request welcome")

if self.settings.compiler == "gcc" and Version(self.version) < "1.0.0":
raise ConanInvalidConfiguration("gcc is only supported in versions greater than or equal 1.0.0.")

if is_msvc(self) and Version(self.version) < "0.0.9":
raise ConanInvalidConfiguration("Visual Studio is not supported in versions before confu_json/0.0.9")

if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)

minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)
check_min_cppstd(self, 20)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def build(self):
pass

def package(self):
copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
copy(self, "*.h*", src=os.path.join(self.source_folder, "confu_json"),
dst=os.path.join(self.package_folder, "include", "confu_json"))
copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses"))
copy(self, "*.h*", os.path.join(self.source_folder, "confu_json"),
os.path.join(self.package_folder, "include", "confu_json"))

def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []
self.cpp_info.requires = ["boost::headers", "magic_enum::magic_enum"]
8 changes: 2 additions & 6 deletions recipes/confu_json/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)

find_package(confu_json REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE confu_json::confu_json)
if(confu_json_VERSION VERSION_LESS "1.0.0")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
else()
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
endif()
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
8 changes: 0 additions & 8 deletions recipes/confu_json/all/test_v1_package/CMakeLists.txt

This file was deleted.

17 changes: 0 additions & 17 deletions recipes/confu_json/all/test_v1_package/conanfile.py

This file was deleted.

8 changes: 1 addition & 7 deletions recipes/confu_json/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
versions:
"1.0.0":
folder: all
"0.0.10":
folder: all
"0.0.9":
folder: all
"0.0.5":
"1.1.1":
folder: all

0 comments on commit df43c18

Please sign in to comment.