mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 12:54:25 +02:00
refactor: update Clang 14 to not require range-v3 (#321)
* Revert "refactor: update hacks for LLVM 14"
This reverts commit d142844de7
.
* refactor: update Clang 14 to not require range-v3
This commit is contained in:
committed by
GitHub
parent
eb94f1cc0e
commit
4efed3c6d4
@@ -77,10 +77,11 @@ class UnitsConan(ConanFile):
|
|||||||
|
|
||||||
def requirements(self):
|
def requirements(self):
|
||||||
compiler = self.settings.compiler
|
compiler = self.settings.compiler
|
||||||
|
version = Version(self.settings.compiler.version)
|
||||||
if self._use_libfmt:
|
if self._use_libfmt:
|
||||||
self.requires("fmt/8.0.1")
|
self.requires("fmt/8.0.1")
|
||||||
|
|
||||||
if compiler == "clang" and compiler.libcxx == "libc++":
|
if compiler == "clang" and compiler.libcxx == "libc++" and version < "14.0":
|
||||||
self.requires("range-v3/0.11.0")
|
self.requires("range-v3/0.11.0")
|
||||||
|
|
||||||
def build_requirements(self):
|
def build_requirements(self):
|
||||||
|
@@ -45,7 +45,7 @@ target_include_directories(mp-units-core ${unitsAsSystem} INTERFACE
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
if(${projectPrefix}LIBCXX)
|
if(${projectPrefix}LIBCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14")
|
||||||
find_package(range-v3 CONFIG REQUIRED)
|
find_package(range-v3 CONFIG REQUIRED)
|
||||||
target_link_libraries(mp-units-core INTERFACE range-v3::range-v3)
|
target_link_libraries(mp-units-core INTERFACE range-v3::range-v3)
|
||||||
endif()
|
endif()
|
||||||
|
9
src/core/include/units/bits/external/hacks.h
vendored
9
src/core/include/units/bits/external/hacks.h
vendored
@@ -84,7 +84,7 @@
|
|||||||
#include <range/v3/iterator/concepts.hpp>
|
#include <range/v3/iterator/concepts.hpp>
|
||||||
#include <range/v3/range/concepts.hpp>
|
#include <range/v3/range/concepts.hpp>
|
||||||
|
|
||||||
#elif UNITS_COMP_CLANG == 13 || UNITS_COMP_CLANG == 14
|
#elif UNITS_COMP_CLANG == 13
|
||||||
|
|
||||||
#include <range/v3/functional/comparisons.hpp>
|
#include <range/v3/functional/comparisons.hpp>
|
||||||
|
|
||||||
@@ -228,15 +228,10 @@ constexpr bool in_range(T t) noexcept
|
|||||||
std::cmp_less_equal(t, std::numeric_limits<R>::max());
|
std::cmp_less_equal(t, std::numeric_limits<R>::max());
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif UNITS_COMP_CLANG == 13 || UNITS_COMP_CLANG == 14
|
#elif UNITS_COMP_CLANG == 13
|
||||||
|
|
||||||
#if UNITS_COMP_CLANG == 13
|
|
||||||
|
|
||||||
using concepts::three_way_comparable;
|
using concepts::three_way_comparable;
|
||||||
using concepts::three_way_comparable_with;
|
using concepts::three_way_comparable_with;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using ::ranges::compare_three_way;
|
using ::ranges::compare_three_way;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -383,7 +383,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// CTAD
|
// CTAD
|
||||||
#if !UNITS_COMP_CLANG || UNITS_COMP_CLANG > 13
|
#if !UNITS_COMP_CLANG || UNITS_COMP_CLANG > 14
|
||||||
template<typename D, typename U, typename Rep>
|
template<typename D, typename U, typename Rep>
|
||||||
explicit(false) quantity(Rep&&) -> quantity<D, U, Rep>;
|
explicit(false) quantity(Rep&&) -> quantity<D, U, Rep>;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -45,7 +45,7 @@ find_dependency(gsl-lite)
|
|||||||
# add range-v3 dependency only for clang + libc++
|
# add range-v3 dependency only for clang + libc++
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
__check_libcxx_in_use(__units_libcxx)
|
__check_libcxx_in_use(__units_libcxx)
|
||||||
if(__units_libcxx)
|
if(__units_libcxx AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14")
|
||||||
find_dependency(range-v3)
|
find_dependency(range-v3)
|
||||||
endif()
|
endif()
|
||||||
unset(__units_libcxx)
|
unset(__units_libcxx)
|
||||||
|
@@ -273,7 +273,7 @@ static_assert(get_length_derived_quantity() == 1_q_m);
|
|||||||
// CTAD
|
// CTAD
|
||||||
/////////
|
/////////
|
||||||
|
|
||||||
#if UNITS_COMP_GCC >= 11 || UNITS_COMP_CLANG > 13
|
#if UNITS_COMP_GCC >= 11 || UNITS_COMP_CLANG > 14
|
||||||
static_assert(std::is_same_v<decltype(units::aliases::isq::si::m(123))::rep, int>);
|
static_assert(std::is_same_v<decltype(units::aliases::isq::si::m(123))::rep, int>);
|
||||||
static_assert(std::is_same_v<decltype(units::aliases::isq::si::m(123.))::rep, double>);
|
static_assert(std::is_same_v<decltype(units::aliases::isq::si::m(123.))::rep, double>);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user