Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rapidyaml: remove internal c4core #9061

Merged
merged 5 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/rapidyaml/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ sources:
"0.3.0":
url: "https://github.com/biojppm/rapidyaml/releases/download/v0.3.0/rapidyaml-0.3.0-src.tgz"
sha256: "38854b8359eaf42cc27352f4b7321f509f6775445a3e2746cc8cd1e468a52aa9"
patches:
"0.3.0":
- patch_file: "patches/001-remove-internal-c4core.patch"
base_path: "source_subfolder"
17 changes: 12 additions & 5 deletions recipes/rapidyaml/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class RapidYAMLConan(ConanFile):
homepage = "https://github.com/biojppm/rapidyaml"
license = "MIT",
settings = "os", "arch", "compiler", "build_type"
exports_sources = ["CMakeLists.txt"]
options = {
"shared": [True, False],
"fPIC": [True, False],
Expand All @@ -23,8 +22,7 @@ class RapidYAMLConan(ConanFile):
"fPIC": True,
"with_default_callbacks": True,
}

generators = "cmake"
generators = "cmake", "cmake_find_package_multi"

_compiler_required_cpp11 = {
"Visual Studio": "13",
Expand All @@ -38,6 +36,11 @@ class RapidYAMLConan(ConanFile):
def _source_subfolder(self):
return "source_subfolder"

def export_sources(self):
self.copy("CMakeLists.txt")
for patch in self.conan_data.get("patches", {}).get(self.version, []):
self.copy(patch["patch_file"])

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
Expand All @@ -46,6 +49,9 @@ def configure(self):
if self.options.shared:
del self.options.fPIC

def requirements(self):
self.requires("c4core/0.1.8")

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
tools.check_min_cppstd(self, 11)
Expand Down Expand Up @@ -73,6 +79,8 @@ def _configure_cmake(self):
return self._cmake

def build(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
cmake = self._configure_cmake()
cmake.build()

Expand All @@ -87,8 +95,7 @@ def package(self):
def package_info(self):
self.cpp_info.set_property("cmake_file_name", "ryml")
self.cpp_info.set_property("cmake_target_name", "ryml::ryml")
# TODO: create c4core recipe
self.cpp_info.libs = ["ryml", "c4core"]
self.cpp_info.libs = ["ryml"]

self.cpp_info.names["cmake_find_package"] = "ryml"
self.cpp_info.names["cmake_find_package_multi"] = "ryml"
38 changes: 38 additions & 0 deletions recipes/rapidyaml/all/patches/001-remove-internal-c4core.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a75251a..48e35c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,10 +15,9 @@ option(RYML_BUILD_API "Enable API generation (python, etc)" OFF)
option(RYML_DBG "Enable (very verbose) ryml debug prints." OFF)


-#-------------------------------------------------------
+find_package(c4core REQUIRED CONFIG)

-c4_require_subproject(c4core INCORPORATE
- SUBDIRECTORY ${RYML_EXT_DIR}/c4core)
+#-------------------------------------------------------

c4_add_library(ryml
SOURCES
@@ -50,10 +49,10 @@ c4_add_library(ryml
ryml.natvis
SOURCE_ROOT ${RYML_SRC_DIR}
INC_DIRS
+ $<BUILD_INTERFACE:${C4CORE_INCLUDE_DIR}>
$<BUILD_INTERFACE:${RYML_SRC_DIR}>
$<INSTALL_INTERFACE:include>
- LIBS c4core
- INCORPORATE c4core
+ LIBS c4core::c4core
)

if(NOT RYML_DEFAULT_CALLBACKS)
@@ -68,7 +67,6 @@ endif()
#-------------------------------------------------------

c4_install_target(ryml)
-c4_install_exports(DEPENDENCIES c4core)
c4_pack_project()