Skip to content

Commit c231304

Browse files
authored
(#9061) rapidyaml: remove internal c4core
* rquire c4core * rapidyaml: remove internal c4core * add end line * add find_package * remove TODO comment
1 parent 88b1986 commit c231304

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

recipes/rapidyaml/all/conandata.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ sources:
22
"0.3.0":
33
url: "https://github.com/biojppm/rapidyaml/releases/download/v0.3.0/rapidyaml-0.3.0-src.tgz"
44
sha256: "38854b8359eaf42cc27352f4b7321f509f6775445a3e2746cc8cd1e468a52aa9"
5+
patches:
6+
"0.3.0":
7+
- patch_file: "patches/001-remove-internal-c4core.patch"
8+
base_path: "source_subfolder"

recipes/rapidyaml/all/conanfile.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class RapidYAMLConan(ConanFile):
1212
homepage = "https://github.com/biojppm/rapidyaml"
1313
license = "MIT",
1414
settings = "os", "arch", "compiler", "build_type"
15-
exports_sources = ["CMakeLists.txt"]
1615
options = {
1716
"shared": [True, False],
1817
"fPIC": [True, False],
@@ -23,8 +22,7 @@ class RapidYAMLConan(ConanFile):
2322
"fPIC": True,
2423
"with_default_callbacks": True,
2524
}
26-
27-
generators = "cmake"
25+
generators = "cmake", "cmake_find_package_multi"
2826

2927
_compiler_required_cpp11 = {
3028
"Visual Studio": "13",
@@ -38,6 +36,11 @@ class RapidYAMLConan(ConanFile):
3836
def _source_subfolder(self):
3937
return "source_subfolder"
4038

39+
def export_sources(self):
40+
self.copy("CMakeLists.txt")
41+
for patch in self.conan_data.get("patches", {}).get(self.version, []):
42+
self.copy(patch["patch_file"])
43+
4144
def config_options(self):
4245
if self.settings.os == "Windows":
4346
del self.options.fPIC
@@ -46,6 +49,9 @@ def configure(self):
4649
if self.options.shared:
4750
del self.options.fPIC
4851

52+
def requirements(self):
53+
self.requires("c4core/0.1.8")
54+
4955
def validate(self):
5056
if self.settings.compiler.get_safe("cppstd"):
5157
tools.check_min_cppstd(self, 11)
@@ -73,6 +79,8 @@ def _configure_cmake(self):
7379
return self._cmake
7480

7581
def build(self):
82+
for patch in self.conan_data.get("patches", {}).get(self.version, []):
83+
tools.patch(**patch)
7684
cmake = self._configure_cmake()
7785
cmake.build()
7886

@@ -87,8 +95,7 @@ def package(self):
8795
def package_info(self):
8896
self.cpp_info.set_property("cmake_file_name", "ryml")
8997
self.cpp_info.set_property("cmake_target_name", "ryml::ryml")
90-
# TODO: create c4core recipe
91-
self.cpp_info.libs = ["ryml", "c4core"]
98+
self.cpp_info.libs = ["ryml"]
9299

93100
self.cpp_info.names["cmake_find_package"] = "ryml"
94101
self.cpp_info.names["cmake_find_package_multi"] = "ryml"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index a75251a..48e35c8 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -15,10 +15,9 @@ option(RYML_BUILD_API "Enable API generation (python, etc)" OFF)
6+
option(RYML_DBG "Enable (very verbose) ryml debug prints." OFF)
7+
8+
9+
-#-------------------------------------------------------
10+
+find_package(c4core REQUIRED CONFIG)
11+
12+
-c4_require_subproject(c4core INCORPORATE
13+
- SUBDIRECTORY ${RYML_EXT_DIR}/c4core)
14+
+#-------------------------------------------------------
15+
16+
c4_add_library(ryml
17+
SOURCES
18+
@@ -50,10 +49,10 @@ c4_add_library(ryml
19+
ryml.natvis
20+
SOURCE_ROOT ${RYML_SRC_DIR}
21+
INC_DIRS
22+
+ $<BUILD_INTERFACE:${C4CORE_INCLUDE_DIR}>
23+
$<BUILD_INTERFACE:${RYML_SRC_DIR}>
24+
$<INSTALL_INTERFACE:include>
25+
- LIBS c4core
26+
- INCORPORATE c4core
27+
+ LIBS c4core::c4core
28+
)
29+
30+
if(NOT RYML_DEFAULT_CALLBACKS)
31+
@@ -68,7 +67,6 @@ endif()
32+
#-------------------------------------------------------
33+
34+
c4_install_target(ryml)
35+
-c4_install_exports(DEPENDENCIES c4core)
36+
c4_pack_project()
37+
38+

0 commit comments

Comments
 (0)