Preeliminary clang support added
This commit is contained in:
1 parent
876c2ac426
commit
b27a422076
3 files changed
+44
-20
No files matched your search
+11
-4
@@ -60,12 +60,18 @@ target_include_directories(units
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
target_compile_options(units
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
target_link_libraries(units
|
||||
INTERFACE
|
||||
-Wno-literal-suffix
|
||||
-Wno-non-template-friend
|
||||
CONAN_PKG::range-v3
|
||||
)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(units
|
||||
INTERFACE
|
||||
-Wno-literal-suffix
|
||||
-Wno-non-template-friend
|
||||
)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
target_compile_options(units
|
||||
INTERFACE
|
||||
@@ -77,6 +83,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(mp::units ALIAS units)
|
||||
|
||||
# installation info
|
||||
|
||||
+26
-11
@@ -24,6 +24,13 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
#if __clang__
|
||||
#define COMP_CLANG __clang_major__
|
||||
#elif __GNUC__
|
||||
#define COMP_GCC __GNUC__
|
||||
#define COMP_GCC_MINOR __GNUC_MINOR__
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define Expects(cond) (void)(cond);
|
||||
#else
|
||||
@@ -31,23 +38,36 @@
|
||||
#define Expects(cond) assert(cond);
|
||||
#endif
|
||||
|
||||
#if __GNUC__ < 10
|
||||
#if COMP_GCC >= 10 || COMP_CLANG >= 11
|
||||
|
||||
#include <concepts/concepts.hpp>
|
||||
#define AUTO
|
||||
#define SAME_AS(T) T
|
||||
#include <concepts>
|
||||
|
||||
#else
|
||||
|
||||
#include <concepts>
|
||||
#include <concepts/concepts.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
#if COMP_GCC >= 10 || COMP_CLANG >= 11
|
||||
|
||||
#define AUTO auto
|
||||
#define SAME_AS(T) std::same_as<T>
|
||||
|
||||
#else
|
||||
|
||||
#define AUTO
|
||||
#define SAME_AS(T) T
|
||||
|
||||
#endif
|
||||
|
||||
namespace std {
|
||||
|
||||
#if __GNUC__ < 10
|
||||
#if COMP_GCC >= 10
|
||||
|
||||
template<class T>
|
||||
concept default_constructible = constructible_from<T>;
|
||||
|
||||
#else
|
||||
|
||||
// concepts
|
||||
using concepts::common_reference_with;
|
||||
@@ -71,11 +91,6 @@ namespace std {
|
||||
template<class F, class... Args>
|
||||
concept regular_invocable = invocable<F, Args...>;
|
||||
|
||||
#else
|
||||
|
||||
template<class T>
|
||||
concept default_constructible = constructible_from<T>;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
Reference in new issue
Block a user