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

libkml: add a patch for C++17 compatibility #23678

Closed
wants to merge 2 commits into from
Closed
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/libkml/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
url: "https://github.com/libkml/libkml/archive/1.3.0.zip"
sha256: "ac2a61b4bca105cbed9ad8d0d6d5536dc7c2a11abcecf86431d023e2f3ae96db"
patches:
"1.3.0":
- patch_file: "patches/0001-fix-cmake.patch"

Check warning on line 7 in recipes/libkml/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/0001-fix ... ^ (line: 7)
- patch_file: "patches/0002-fix-for-mingw-and-empty-literal-for-vc.patch"

Check warning on line 8 in recipes/libkml/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/0002-fix ... ^ (line: 8)
- patch_file: "patches/0003-export-extern-symbols-for-msvc.patch"

Check warning on line 9 in recipes/libkml/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/0003-exp ... ^ (line: 9)
- patch_file: "patches/0004-minizip-no-crypt-header.patch"

Check warning on line 10 in recipes/libkml/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - patch_file: patches/0004-min ... ^ (line: 10)
- patch_file: "patches/0005-cpp17-compatibility.patch"
patch_description: "Rmove unnecessary std::unary_function for C++17 compatibility"
patch_type: "portability"
patch_source: "https://github.com/libkml/libkml/pull/275"
7 changes: 5 additions & 2 deletions recipes/libkml/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
from conan.tools.microsoft import is_msvc_static_runtime
import os
import textwrap

Expand Down Expand Up @@ -49,7 +50,9 @@ def requirements(self):
self.requires("zlib/[>=1.2.11 <2]")

def validate(self):
if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, 98)
if self.options.shared and is_msvc_static_runtime(self):
raise ConanInvalidConfiguration(f"{self.ref} shared with Visual Studio and MT runtime is not supported")

def source(self):
Expand Down
22 changes: 22 additions & 0 deletions recipes/libkml/all/patches/0005-cpp17-compatibility.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From b6db3d2e2b916f692bf9d65ca15e3e32926bbfd7 Mon Sep 17 00:00:00 2001
From: Martin Valgur <martin.valgur@gmail.com>
Date: Sat, 20 Apr 2024 16:40:54 +0300
Subject: [PATCH] Remove unnecessary std::unary_function for C++17 support

---
src/kml/xsd/xsd_file.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kml/xsd/xsd_file.cc b/src/kml/xsd/xsd_file.cc
index ac8d184a..30ef6e32 100644
--- a/src/kml/xsd/xsd_file.cc
+++ b/src/kml/xsd/xsd_file.cc
@@ -50,7 +50,7 @@ XsdFile* XsdFile::CreateFromParse(const string& xsd_data,

// TODO: mem_fun might help avoid this functor
typedef std::pair<string, XsdElementPtr> NameElementPair;
-struct GetElement : public std::unary_function<NameElementPair, void> {
+struct GetElement {
GetElement(XsdElementVector* elements)
: elements_(elements) {
}
Loading