Skip to content

Commit

Permalink
(#23837) rapidyaml: add version 0.7.0
Browse files Browse the repository at this point in the history
* rapidyaml: add version 0.6.0

* add new options

* update 0.7.0

* disable `with_default_callback_uses_exceptions` when `with_default_callbacks` is false.
  • Loading branch information
toge committed Jun 17, 2024
1 parent 55aecb3 commit 5a5a263
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 1 deletion.
7 changes: 7 additions & 0 deletions recipes/rapidyaml/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"0.7.0":
url: "https://github.com/biojppm/rapidyaml/releases/download/v0.7.0/rapidyaml-0.7.0-src.tgz"
sha256: "ef9f89b68de711c561720f1e70d1594e953356a07d297d36b8ccd3ded0589715"
"0.5.0":
url: "https://github.com/biojppm/rapidyaml/releases/download/v0.5.0/rapidyaml-0.5.0-src.tgz"
sha256: "6493557778791a3a2375510ce6c0ecd70163fc8ce4f8ed683acc36e3e55ee881"
Expand All @@ -12,6 +15,10 @@ sources:
url: "https://github.com/biojppm/rapidyaml/releases/download/v0.3.0/rapidyaml-0.3.0-src.tgz"
sha256: "38854b8359eaf42cc27352f4b7321f509f6775445a3e2746cc8cd1e468a52aa9"
patches:
"0.7.0":
- patch_file: "patches/0.7.0-001-remove-internal-c4core.patch"
patch_description: "disable using internal c4core"
patch_type: "conan"
"0.5.0":
- patch_file: "patches/0.5.0-001-remove-internal-c4core.patch"
patch_description: "disable using internal c4core"
Expand Down
18 changes: 17 additions & 1 deletion recipes/rapidyaml/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ class RapidYAMLConan(ConanFile):
"fPIC": [True, False],
"with_default_callbacks": [True, False],
"with_tab_tokens": [True, False],
"with_default_callback_uses_exceptions": [True, False],
"with_assert": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_default_callbacks": True,
"with_tab_tokens": False,
"with_default_callback_uses_exceptions": False,
"with_assert": False,
}

@property
Expand All @@ -41,16 +45,25 @@ def config_options(self):
del self.options.fPIC
if Version(self.version) < "0.4.0":
del self.options.with_tab_tokens
if Version(self.version) < "0.6.0":
del self.options.with_default_callback_uses_exceptions
del self.options.with_assert

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
# with_default_callback_uses_exceptions should only be valid if with_default_callbacks is true
if not self.options.with_default_callbacks:
self.options.rm_safe("with_default_callback_uses_exceptions")

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

def requirements(self):
self.requires("c4core/0.1.11", transitive_headers=True)
if Version(self.version) < "0.6.0":
self.requires("c4core/0.1.11", transitive_headers=True)
else:
self.requires("c4core/0.2.0", transitive_headers=True)

def validate(self):
if self.info.settings.compiler.cppstd:
Expand All @@ -65,6 +78,9 @@ def generate(self):
tc.variables["RYML_DEFAULT_CALLBACKS"] = self.options.with_default_callbacks
if Version(self.version) >= "0.4.0":
tc.variables["RYML_WITH_TAB_TOKENS"] = self.options.with_tab_tokens
if Version(self.version) >= "0.6.0":
tc.variables["RYML_DEFAULT_CALLBACK_USES_EXCEPTIONS"] = self.options.with_default_callback_uses_exceptions
tc.variables["RYML_USE_ASSERT"] = self.options.with_assert
tc.generate()

deps = CMakeDeps(self)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 762bb97..d1bc8a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@ project(ryml
LANGUAGES CXX)
include(./compat.cmake)

-c4_project(VERSION 0.7.0 STANDALONE
+c4_project(VERSION 0.7.0
AUTHOR "Joao Paulo Magalhaes <dev@jpmag.me>")


@@ -27,11 +27,11 @@ option(RYML_INSTALL "Enable install target" ON)

#-------------------------------------------------------

-c4_require_subproject(c4core INCORPORATE
- SUBDIRECTORY ${RYML_EXT_DIR}/c4core
- OVERRIDE C4CORE_INSTALL ${RYML_INSTALL}
-)
-
+# c4_require_subproject(c4core INCORPORATE
+# SUBDIRECTORY ${RYML_EXT_DIR}/c4core
+# OVERRIDE C4CORE_INSTALL ${RYML_INSTALL}
+# )
+find_package(c4core REQUIRED CONFIG)
c4_add_library(ryml
SOURCES
ryml.hpp
@@ -77,10 +77,10 @@ c4_add_library(ryml
INC_DIRS
$<BUILD_INTERFACE:${RYML_SRC_DIR}>
$<INSTALL_INTERFACE:include>
- LIBS c4core
- INCORPORATE c4core
+ # LIBS c4core
+ LIBS c4core::c4core
+ # INCORPORATE c4core
)
-
if(RYML_WITH_TAB_TOKENS)
target_compile_definitions(ryml PUBLIC RYML_WITH_TAB_TOKENS)
endif()
@@ -113,7 +113,7 @@ endif()

if(RYML_INSTALL)
c4_install_target(ryml)
- c4_install_exports(DEPENDENCIES c4core)
+# c4_install_exports(DEPENDENCIES c4core)
c4_pack_project()
endif()

2 changes: 2 additions & 0 deletions recipes/rapidyaml/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"0.7.0":
folder: all
"0.5.0":
folder: all
"0.4.1":
Expand Down

0 comments on commit 5a5a263

Please sign in to comment.