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

Add geographiclib/1.51 #4291

Merged
merged 2 commits into from
Jan 20, 2021
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: 3 additions & 1 deletion recipes/geographiclib/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ sources:
"1.50.1":
url: "https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.50.1.tar.gz"
sha256: "d1765009e068b8cc5e76957e5d6be45ce6cff08c4aad8e5995e84a28354385f1"

"1.51":
url: "https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.51.tar.gz"
sha256: "34370949617df5105bd6961e0b91581aef758dc455fe8629eb5858516022d310"
26 changes: 26 additions & 0 deletions recipes/geographiclib/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
import os

required_conan_version = ">=1.28.0"
Expand All @@ -23,9 +24,34 @@ def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

@property
def _min_compiler_version_default_cxx11(self):
# Minimum compiler version having c++ standard >= 11
return {
"apple-clang": "3.3",
"gcc": "4.9",
"clang": "6",
"Visual Studio": "14", # guess
}.get(str(self.settings.compiler), False)

def configure(self):
if self.options.shared:
del self.options.fPIC
if tools.Version(self.version) >= "1.51":
if self.settings.compiler.cppstd:
tools.min_cppstd(self, 11)

def lazy_lt_semver(v1, v2):
Copy link
Contributor

Choose a reason for hiding this comment

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

Another variant conan-io/conan#8002 (just to keep track of all of them)

lv1 = [int(v) for v in v1.split(".")]
lv2 = [int(v) for v in v2.split(".")]
min_length = min(len(lv1), len(lv2))
return lv1[:min_length] < lv2[:min_length]

minimum_version = self._min_compiler_version_default_cxx11
if not minimum_version:
self.output.warn("geographiclib {} requires C++11 math functions. Your compiler is unknown. Assuming it supports this feature.".format(self.version))
elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version):
raise ConanInvalidConfiguration("geographiclib {} requires C++11 math functions, which your compiler does not support.".format(self.version))

def source(self):
tools.get(**self.conan_data["sources"][self.version])
Expand Down
4 changes: 4 additions & 0 deletions recipes/geographiclib/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ find_package(geographiclib CONFIG REQUIRED)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} GeographicLib::GeographicLib)

if(geographiclib_VERSION VERSION_GREATER_EQUAL "1.51")
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
endif()
2 changes: 2 additions & 0 deletions recipes/geographiclib/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"1.50.1":
folder: all
"1.51":
folder: all