diff --git a/conanfile.py b/conanfile.py index 0a80c7ada..9565ec1e2 100644 --- a/conanfile.py +++ b/conanfile.py @@ -93,12 +93,6 @@ def _use_libfmt(self): std_support = compiler == "msvc" and version >= 193 and compiler.cppstd == 23 return not std_support - @property - def _use_range_v3(self): - compiler = self.settings.compiler - version = Version(self.settings.compiler.version) - return "clang" in compiler and compiler.libcxx == "libc++" and version < 14 - def set_version(self): content = load(self, os.path.join(self.recipe_folder, "src/CMakeLists.txt")) version = re.search( @@ -110,8 +104,6 @@ def requirements(self): self.requires("gsl-lite/0.40.0") if self._use_libfmt: self.requires("fmt/10.1.0") - if self._use_range_v3: - self.requires("range-v3/0.11.0") def build_requirements(self): if self._build_all: @@ -174,8 +166,6 @@ def package_info(self): self.cpp_info.components["core"].requires = ["gsl-lite::gsl-lite"] if compiler == "msvc": self.cpp_info.components["core"].cxxflags = ["/utf-8"] - if self._use_range_v3: - self.cpp_info.components["core"].requires.append("range-v3::range-v3") # rest self.cpp_info.components["core-io"].requires = ["core"] diff --git a/src/cmake/CheckLibcxxInUse.cmake b/src/cmake/CheckLibcxxInUse.cmake deleted file mode 100644 index 7335da5c0..000000000 --- a/src/cmake/CheckLibcxxInUse.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2018 Mateusz Pusz -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -cmake_minimum_required(VERSION 3.15) - -function(check_libcxx_in_use variable) - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - message(CHECK_START "Checking if libc++ is being used") - list(APPEND CMAKE_MESSAGE_INDENT " ") - - include(CheckCXXSymbolExists) - check_cxx_symbol_exists(_LIBCPP_VERSION "ciso646" ${variable}) - set(${variable} ${${variable}} PARENT_SCOPE) - - list(POP_BACK CMAKE_MESSAGE_INDENT) - if(${variable}) - message(CHECK_PASS "found") - else() - message(CHECK_FAIL "not found") - endif() - endif() -endfunction() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 49e52bcd6..edfd2331c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -27,10 +27,6 @@ if(NOT TARGET gsl::gsl-lite) find_package(gsl-lite CONFIG REQUIRED) endif() -# check if libc++ is being used -include(CheckLibcxxInUse) -check_libcxx_in_use(${projectPrefix}LIBCXX) - # core library definition add_library( mp-units-core @@ -78,14 +74,7 @@ target_include_directories( $ ) -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if(${projectPrefix}LIBCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14") - if(NOT TARGET range-v3::range-v3) - find_package(range-v3 CONFIG REQUIRED) - endif() - target_link_libraries(mp-units-core INTERFACE range-v3::range-v3) - endif() -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") target_compile_options( mp-units-core INTERFACE /utf-8 # Specifies both the source character set and the execution character set as UTF-8 diff --git a/src/core/include/mp-units/bits/external/hacks.h b/src/core/include/mp-units/bits/external/hacks.h index 4bd4d0a43..b685e5540 100644 --- a/src/core/include/mp-units/bits/external/hacks.h +++ b/src/core/include/mp-units/bits/external/hacks.h @@ -70,34 +70,10 @@ #define MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED #endif -#if _LIBCPP_VERSION -#define MP_UNITS_LIBCXX _LIBCPP_VERSION -#endif - -#if MP_UNITS_LIBCXX - -#if MP_UNITS_LIBCXX < 13000 - -#include -#include -#include -#include -#include -#include -#include - -#elif MP_UNITS_LIBCXX < 14000 - -#include - -#endif - -#endif - #include #include -#if MP_UNITS_COMP_MSVC || (MP_UNITS_COMP_CLANG && MP_UNITS_COMP_CLANG < 16) +#if MP_UNITS_COMP_MSVC #define MP_UNITS_TYPENAME typename @@ -145,124 +121,6 @@ namespace std { template concept default_constructible = constructible_from; -#elif MP_UNITS_LIBCXX - -#if MP_UNITS_LIBCXX < 13000 - -// concepts -using concepts::common_with; -using concepts::constructible_from; -using concepts::convertible_to; -using concepts::copy_constructible; -using concepts::derived_from; -using concepts::equality_comparable; -using concepts::equality_comparable_with; -using concepts::integral; -using concepts::move_constructible; -using concepts::regular; -using concepts::three_way_comparable; -using concepts::three_way_comparable_with; -using concepts::totally_ordered; - -using ranges::compare_three_way; - -using ranges::input_iterator; -using ranges::iter_value_t; -using ranges::sentinel_for; - -namespace ranges { - -using ::ranges::begin; -using ::ranges::distance; -using ::ranges::end; - -using ::ranges::input_range; -using ::ranges::range_value_t; - -using ::ranges::lower_bound; -using ::ranges::transform; - -} // namespace ranges - -// missing in Range-v3 -template -concept floating_point = std::is_floating_point_v; - -template -concept default_initializable = - std::constructible_from && requires { T{}; } && requires { ::new (static_cast(nullptr)) T; }; - -template -concept invocable = requires(F&& f, Args&&... args) { std::invoke(std::forward(f), std::forward(args)...); }; - -template -concept regular_invocable = invocable; - -template -constexpr bool cmp_equal(T t, U u) noexcept -{ - using UT = std::make_unsigned_t; - using UU = std::make_unsigned_t; - if constexpr (std::is_signed_v == std::is_signed_v) - return t == u; - else if constexpr (std::is_signed_v) - return t < 0 ? false : UT(t) == u; - else - return u < 0 ? false : t == UU(u); -} - -template -constexpr bool cmp_not_equal(T t, U u) noexcept -{ - return !cmp_equal(t, u); -} - -template -constexpr bool cmp_less(T t, U u) noexcept -{ - using UT = std::make_unsigned_t; - using UU = std::make_unsigned_t; - if constexpr (std::is_signed_v == std::is_signed_v) - return t < u; - else if constexpr (std::is_signed_v) - return t < 0 ? true : UT(t) < u; - else - return u < 0 ? false : t < UU(u); -} - -template -constexpr bool cmp_greater(T t, U u) noexcept -{ - return cmp_less(u, t); -} - -template -constexpr bool cmp_less_equal(T t, U u) noexcept -{ - return !cmp_greater(t, u); -} - -template -constexpr bool cmp_greater_equal(T t, U u) noexcept -{ - return !cmp_less(t, u); -} - -template -constexpr bool in_range(T t) noexcept -{ - return std::cmp_greater_equal(t, std::numeric_limits::min()) && - std::cmp_less_equal(t, std::numeric_limits::max()); -} - -#elif MP_UNITS_LIBCXX < 14000 - -using concepts::three_way_comparable; -using concepts::three_way_comparable_with; -using ::ranges::compare_three_way; - -#endif - #endif } // namespace std diff --git a/src/mp-unitsConfig.cmake b/src/mp-unitsConfig.cmake index 10f82a823..519b180b7 100644 --- a/src/mp-unitsConfig.cmake +++ b/src/mp-unitsConfig.cmake @@ -20,25 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -function(__check_libcxx_in_use variable) - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - message(CHECK_START "Checking if libc++ is being used") - list(APPEND CMAKE_MESSAGE_INDENT " ") - - include(CheckCXXSymbolExists) - check_cxx_symbol_exists(_LIBCPP_VERSION "ciso646" ${variable}) - set(${variable} ${${variable}} PARENT_SCOPE) - - list(POP_BACK CMAKE_MESSAGE_INDENT) - - if(${variable}) - message(CHECK_PASS "found") - else() - message(CHECK_FAIL "not found") - endif() - endif() -endfunction() - include(CMakeFindDependencyMacro) if(MP_UNITS_USE_LIBFMT) @@ -47,15 +28,4 @@ endif() find_dependency(gsl-lite) -# add range-v3 dependency only for clang + libc++ -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - __check_libcxx_in_use(__units_libcxx) - - if(__units_libcxx AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14") - find_dependency(range-v3) - endif() - - unset(__units_libcxx) -endif() - include("${CMAKE_CURRENT_LIST_DIR}/mp-unitsTargets.cmake")