Skip to content
Open
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
3 changes: 3 additions & 0 deletions recipes/rmlui/4.x/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ patches:
- patch_file: "patches/4.4-fix-cmake-targets-and-config.patch"
patch_description: "Make external libraries work when provided by conan and remove the generation of a config file"
patch_type: "conan"
- patch_file: "patches/4.4-use-conan-lunasvg.patch"
patch_description: "Use Conan CMakeDeps lunasvg target"
patch_type: "conan"
11 changes: 11 additions & 0 deletions recipes/rmlui/4.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout
from conan.tools.build import check_min_cppstd
from conan.tools.files import get, replace_in_file, copy, export_conandata_patches, apply_conandata_patches
from conan.tools.scm import Version
import os


Expand All @@ -23,6 +24,7 @@ class RmluiConan(ConanFile):
"matrix_mode": ["column_major", "row_major"],
"shared": [True, False],
"with_lua_bindings": [True, False],
"with_svg": [True, False],
"with_thirdparty_containers": [True, False]
}
default_options = {
Expand All @@ -31,6 +33,7 @@ class RmluiConan(ConanFile):
"matrix_mode": "column_major",
"shared": False,
"with_lua_bindings": False,
"with_svg": False,
"with_thirdparty_containers": True
}

Expand Down Expand Up @@ -65,6 +68,9 @@ def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._minimum_cpp_standard)

if self.options.with_svg and Version(self.version) < "4.4":
raise ConanInvalidConfiguration(f"{self.ref} with_svg option is only available for versions >= 4.4")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the option is not existent in earlier versions, we just delete the option in the config_options() method


def lazy_lt_semver(v1, v2):
lv1 = [int(v) for v in v1.split(".")]
lv2 = [int(v) for v in v2.split(".")]
Expand All @@ -86,6 +92,9 @@ def requirements(self):
if self.options.with_lua_bindings:
self.requires("lua/5.3.5")

if self.options.with_svg:
self.requires("lunasvg/2.3.8")

if self.options.with_thirdparty_containers:
self.requires("robin-hood-hashing/3.11.3", transitive_headers=True)

Expand All @@ -106,6 +115,8 @@ def generate(self):
tc.cache_variables["MATRIX_ROW_MAJOR"] = self.options.matrix_mode == "row_major"
tc.cache_variables["NO_FONT_INTERFACE_DEFAULT"] = not self.options.font_interface
tc.cache_variables["NO_THIRDPARTY_CONTAINERS"] = not self.options.with_thirdparty_containers
if Version(self.version) >= "4.4":
tc.cache_variables["ENABLE_SVG_PLUGIN"] = self.options.with_svg
tc.generate()

deps = CMakeDeps(self)
Expand Down
20 changes: 20 additions & 0 deletions recipes/rmlui/4.x/patches/4.4-use-conan-lunasvg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -377,14 +377,12 @@

message("-- Can SVG plugin be enabled - looking for lunasvg library")

- find_package(lunasvg REQUIRED)
-
- list(APPEND CORE_LINK_LIBS ${LUNASVG_LIBRARIES})
- list(APPEND CORE_INCLUDE_DIRS ${LUNASVG_INCLUDE_DIR})
+ find_package(lunasvg REQUIRED CONFIG)
+ list(APPEND CORE_LINK_LIBS lunasvg::lunasvg)
Comment on lines +7 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this patch necessary? Are there errors if this patch is not included?
Conan already configures the build to prefer CONFIG, and LUNASVG_LIBRARIES should be defined to contain lunasvg::lunasvg - however if it isn't, we prefer to do it via the recipe rather than patches:

deps.set_property("lunasvg", "cmake_additional_variables_prefixes", ["LUNASVG"])

(in the generate() method, on the CMakeDeps object)

list(APPEND CORE_PRIVATE_DEFS RMLUI_ENABLE_SVG_PLUGIN)

list(APPEND Core_HDR_FILES ${SVG_HDR_FILES})
list(APPEND Core_PUB_HDR_FILES ${SVG_PUB_HDR_FILES})
list(APPEND Core_SRC_FILES ${SVG_SRC_FILES})

message("-- Can SVG plugin be enabled - yes - lunasvg library found")
endif()