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

geos: add version 3.12.0 #18845

Merged
merged 9 commits into from
Sep 11, 2023
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
9 changes: 9 additions & 0 deletions recipes/geos/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"3.12.0":
url: "https://github.com/libgeos/geos/releases/download/3.12.0/geos-3.12.0.tar.bz2"
sha256: "d96db96011259178a35555a0f6d6e75a739e52a495a6b2aa5efb3d75390fbc39"
"3.11.2":
url: "https://github.com/libgeos/geos/releases/download/3.11.2/geos-3.11.2.tar.bz2"
sha256: "b1f077669481c5a3e62affc49e96eb06f281987a5d36fdab225217e5b825e4cc"
Expand All @@ -14,3 +17,9 @@ sources:
"3.10.2":
url: "https://download.osgeo.org/geos/geos-3.10.2.tar.bz2"
sha256: "50bbc599ac386b4c2b3962dcc411f0040a61f204aaef4eba7225ecdd0cf45715"
patches:
"3.12.0":
- patch_file: "patches/3.12.0-0001-fix-cmake.patch"
patch_description: "Fix CMake on Windows with Visual Studio"
patch_type: "official"
patch_source: "https://github.com/libgeos/geos/pull/945"
33 changes: 30 additions & 3 deletions recipes/geos/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd, stdcpp_library
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, rmdir
from conan.tools.files import copy, get, rmdir, export_conandata_patches, apply_conandata_patches
from conan.tools.scm import Version
import os

Expand Down Expand Up @@ -30,10 +31,29 @@ class GeosConan(ConanFile):
"utils": True,
}

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

@property
def _compilers_minimum_version(self):
return {
"14": {
"gcc": "6",
"clang": "5",
"apple-clang": "10",
"Visual Studio": "15",
"msvc": "191",
},
}.get(self._min_cppstd, {})

@property
def _has_inline_option(self):
return Version(self.version) < "3.11.0"

def export_sources(self):
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
Expand All @@ -48,8 +68,13 @@ def layout(self):
cmake_layout(self, src_folder="src")

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, 11)
if self.settings.compiler.cppstd:
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 source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand All @@ -62,6 +87,7 @@ def generate(self):
tc.cache_variables["BUILD_BENCHMARKS"] = False
else:
tc.variables["BUILD_BENCHMARKS"] = False
tc.cache_variables["CMAKE_BUILD_TYPE"] = str(self.settings.build_type)
if self._has_inline_option:
tc.variables["DISABLE_GEOS_INLINE"] = not self.options.inline
tc.variables["BUILD_TESTING"] = False
Expand All @@ -71,6 +97,7 @@ def generate(self):
tc.generate()

def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand Down
31 changes: 31 additions & 0 deletions recipes/geos/all/patches/3.12.0-0001-fix-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a2906c..cdab138 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -114,8 +114,12 @@ endif()

# Make sure we know our build type
if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE ${DEFAULT_BUILD_TYPE})
- message(STATUS "GEOS: Using default build type: ${CMAKE_BUILD_TYPE}")
+ get_property(_is_multi_config_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if (NOT _is_multi_config_generator)
+ set(CMAKE_BUILD_TYPE ${DEFAULT_BUILD_TYPE})
+ message(STATUS "GEOS: Using default build type: ${CMAKE_BUILD_TYPE}")
+ endif()
+ unset(_is_multi_config_generator)
else()
message(STATUS "GEOS: Build type: ${CMAKE_BUILD_TYPE}")
endif()
@@ -186,6 +190,11 @@ set(CMAKE_CXX_FLAGS_ASAN "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit-
set(CMAKE_EXE_LINKER_FLAGS_ASAN "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS_ASAN "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address")

+get_property(_cmake_build_type_is_cache CACHE CMAKE_BUILD_TYPE PROPERTY TYPE)
+if (_cmake_build_type_is_cache)
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "ASAN")
+endif()
+unset(_cmake_build_type_is_cache)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "ASAN")

#-----------------------------------------------------------------------------
2 changes: 2 additions & 0 deletions recipes/geos/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"3.12.0":
folder: all
"3.11.2":
folder: all
"3.11.1":
Expand Down