Skip to content

Commit

Permalink
(conan-io#24927) libxmlpp: add version 5.4.0
Browse files Browse the repository at this point in the history
* libxmlpp: add version 5.4.0

* 5.4.0 requires C++17 due to using <variant>

* fix C++17 condition

* Cleanups

* Remofe leftover patch

---------

Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es>
  • Loading branch information
toge and AbrilRBS authored Oct 11, 2024
1 parent fbbf28d commit baa81e3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 76 deletions.
11 changes: 3 additions & 8 deletions recipes/libxmlpp/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"5.4.0":
url: "https://github.com/libxmlplusplus/libxmlplusplus/releases/download/5.4.0/libxml++-5.4.0.tar.xz"
sha256: "e9a23c436686a94698d2138e6bcbaf849121d63bfa0f50dc34fefbfd79566848"
"5.2.0":
url: "https://github.com/libxmlplusplus/libxmlplusplus/releases/download/5.2.0/libxml++-5.2.0.tar.xz"
sha256: "e41b8eae55210511585ae638615f00db7f982c0edea94699865f582daf03b44f"
Expand All @@ -8,9 +11,6 @@ sources:
"5.0.1":
url: "https://github.com/libxmlplusplus/libxmlplusplus/releases/download/5.0.1/libxml++-5.0.1.tar.xz"
sha256: "15c38307a964fa6199f4da6683a599eb7e63cc89198545b36349b87cf9aa0098"
"2.42.1":
url: "https://github.com/libxmlplusplus/libxmlplusplus/releases/download/2.42.1/libxml++-2.42.1.tar.xz"
sha256: "9b59059abe5545d28ceb388a55e341095f197bd219c73e6623aeb6d801e00be8"
patches:
"5.2.0":
- patch_file: "patches/5.2.0-0001-enable_static_builds_on_msvc.patch"
Expand All @@ -27,8 +27,3 @@ patches:
patch_type: "portability"
patch_description: "Manage dllexport correctly to be able to build static libraries on MSVC"
patch_source: "https://github.com/libxmlplusplus/libxmlplusplus/commit/2a2825c67a30ea34f3514659bfd91111db8e009d.patch"
"2.42.1":
- patch_file: "patches/2.42.1-0001-enable_static_builds_on_msvc.patch"
patch_type: "portability"
patch_description: "Manage dllexport correctly to be able to build static libraries on MSVC"
patch_source: "https://github.com/libxmlplusplus/libxmlplusplus/commit/2a2825c67a30ea34f3514659bfd91111db8e009d.patch"
45 changes: 27 additions & 18 deletions recipes/libxmlpp/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,25 @@ class LibXMLPlusPlus(ConanFile):
"fPIC": True,
}

@property
def _min_cppstd(self):
return "17" if Version(self.version) >= "5.4.0" else "11"

@property
def _compilers_minimum_version(self):
return {
"17": {
"gcc": "8",
"clang": "7",
"apple-clang": "12",
"Visual Studio": "16",
"msvc": "192",
},
}.get(self._min_cppstd, {})

@property
def _lib_version(self):
return "2.6" if Version(self.version) <= "2.42.1" else "5.0"
return "5.0"

def export_sources(self):
export_conandata_patches(self)
Expand All @@ -53,31 +69,24 @@ def layout(self):
basic_layout(self, src_folder="src")

def requirements(self):
self.requires("libxml2/2.12.4")
if Version(self.version) <= "2.42.1":
self.requires("glibmm/2.66.4", transitive_headers=True, transitive_libs=True)
else:
self.requires("glibmm/2.75.0")
self.requires("libxml2/[>=2.12.5 <3]")
self.requires("glibmm/2.75.0")

def validate(self):
if hasattr(self, "settings_build") and cross_building(self):
raise ConanInvalidConfiguration("Cross-building not implemented")
if Version(self.version) < "2.91.1":
from conan import conan_version
import sys
if conan_version.major == 2:
# FIXME: linter complains, but function is there
# https://docs.conan.io/2.0/reference/tools/build.html?highlight=check_min_cppstd#conan-tools-build-check-max-cppstd
check_max_cppstd = getattr(sys.modules['conan.tools.build'], 'check_max_cppstd')
# INFO: error: no template named 'auto_ptr' in namespace 'std'. Removed in C++17.
check_max_cppstd(self, 14)
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, 11)
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."
)

def build_requirements(self):
self.tool_requires("meson/1.3.1")
self.tool_requires("meson/[>=1.2.3 <2]")
if not self.conf.get("tools.gnu:pkg_config", check_type=str):
self.tool_requires("pkgconf/2.1.0")
self.tool_requires("pkgconf/[>=2.2 <3]")

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

This file was deleted.

6 changes: 5 additions & 1 deletion recipes/libxmlpp/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ find_package(libxmlpp REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE libxmlpp::libxmlpp)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
if(libxmlpp_VERSION VERSION_GREATER_EQUAL "5.4.0")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
else()
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
endif()
4 changes: 2 additions & 2 deletions recipes/libxmlpp/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
versions:
"5.4.0":
folder: all
"5.2.0":
folder: all
"5.0.3":
folder: all
"5.0.1":
folder: all
"2.42.1":
folder: all

0 comments on commit baa81e3

Please sign in to comment.