Skip to content

Commit

Permalink
g2o: simplify cppstd checks
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Jan 12, 2025
1 parent 5ad6eb3 commit b17da92
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions recipes/g2o/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from conan.tools.build import check_min_cppstd, check_max_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, rm, rmdir, save, export_conandata_patches, apply_conandata_patches, replace_in_file
from conan.tools.scm import Version

required_conan_version = ">=1.53.0"

Expand Down Expand Up @@ -71,23 +70,6 @@ class G2oConan(ConanFile):
"with_csparse": False,
}

@property
def _min_cppstd(self):
return 17

@property
def _max_cppstd(self):
return 17

@property
def _compilers_minimum_version(self):
return {
"msvc": "192",
"gcc": "8",
"clang": "7",
"apple-clang": "12",
}

def export_sources(self):
export_conandata_patches(self)
copy(self, "FindSuiteSparse.cmake", self.recipe_folder, self.export_sources_folder)
Expand Down Expand Up @@ -141,15 +123,10 @@ def requirements(self):
# self.requires("libqglviewer/x.y.z")

def validate(self):
check_min_cppstd(self, self._min_cppstd)
check_min_cppstd(self, 17)
# C++20 fails with
# error: call to non-‘constexpr’ function ‘void fmt::v10::detail::throw_format_error(const char*)’
check_max_cppstd(self, self._max_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."
)
check_max_cppstd(self, 17)

if self.settings.os == "Windows" and self.options.shared:
# Build fails with "unresolved external symbol "public: __cdecl g2o::internal::LoggerInterface::LoggerInterface(void)"
Expand Down

0 comments on commit b17da92

Please sign in to comment.