C++11: Do CMake-less C++11 checking.
This commit is contained in:
@@ -77,7 +77,7 @@
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
#ifdef CPP11_ENABLED
|
||||
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
#include <array>
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
@@ -92,7 +92,7 @@ namespace OpenMesh {
|
||||
//== CLASS DEFINITION =========================================================
|
||||
|
||||
|
||||
#if CPP11_ENABLED
|
||||
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
/*
|
||||
* Helpers for VectorT
|
||||
*/
|
||||
@@ -121,7 +121,7 @@ struct are_convertible_to<To, From> : public std::is_convertible<From, To> {};
|
||||
*/
|
||||
template<typename Scalar, int N> class VectorDataT {
|
||||
public:
|
||||
#ifdef CPP11_ENABLED
|
||||
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
VectorDataT() {}
|
||||
|
||||
template<typename... T>
|
||||
@@ -141,7 +141,7 @@ template<typename Scalar, int N> class VectorDataT {
|
||||
/// This specialization enables us to use aligned SSE instructions.
|
||||
template<> class VectorDataT<float, 4> {
|
||||
public:
|
||||
#ifdef CPP11_ENABLED
|
||||
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
VectorDataT() {}
|
||||
|
||||
template<typename... T>
|
||||
@@ -152,7 +152,7 @@ template<> class VectorDataT<float, 4> {
|
||||
#endif
|
||||
union {
|
||||
__m128 m128;
|
||||
#ifdef CPP11_ENABLED
|
||||
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
std::array<float, 4> values_;
|
||||
#else
|
||||
float values_[4];
|
||||
@@ -432,7 +432,7 @@ typedef VectorT<double,6> Vec6d;
|
||||
//=============================================================================
|
||||
|
||||
|
||||
#ifdef CPP11_ENABLED
|
||||
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
/**
|
||||
* Literal operator for inline specification of colors in HTML syntax.
|
||||
*
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
/// default constructor creates uninitialized values.
|
||||
inline VectorT() {}
|
||||
|
||||
#ifdef CPP11_ENABLED
|
||||
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
explicit inline VectorT(const Scalar &v) {
|
||||
vectorize(v);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
// /// cast to const Scalar array
|
||||
// inline operator const Scalar*() const { return Base::values_; }
|
||||
|
||||
#ifdef CPP11_ENABLED
|
||||
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
/// access to Scalar array
|
||||
inline Scalar* data() { return Base::values_.data(); }
|
||||
|
||||
|
||||
@@ -22,16 +22,6 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
||||
# set additional link directories
|
||||
link_directories(${GTEST_LIBRARY_DIR} )
|
||||
|
||||
set(INHIBIT_CXX11_SUPPORT OFF CACHE BOOL "Do not use C++11 even if it is available. (This is mainly useful for unit testing.)")
|
||||
|
||||
if (NOT INHIBIT_CXX11_SUPPORT)
|
||||
find_package (CXX11)
|
||||
|
||||
if (CXX11_FOUND)
|
||||
add_definitions(${CXX11_FLAGS} -DCPP11_ENABLED)
|
||||
endif (CXX11_FOUND)
|
||||
endif (NOT INHIBIT_CXX11_SUPPORT)
|
||||
|
||||
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
|
||||
add_definitions( /D _VARIADIC_MAX=10 )
|
||||
endif()
|
||||
|
||||
@@ -83,7 +83,7 @@ TEST_F(OpenMeshVectorTest, VectorCasting) {
|
||||
|
||||
}
|
||||
|
||||
#ifdef CPP11_ENABLED
|
||||
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
TEST_F(OpenMeshVectorTest, cpp11_constructors) {
|
||||
OpenMesh::Vec3d vec1 { 1.2, 2.0, 3.0 };
|
||||
|
||||
@@ -113,6 +113,8 @@ TEST_F(OpenMeshVectorTest, cpp11_constructors) {
|
||||
}
|
||||
|
||||
TEST_F(OpenMeshVectorTest, cpp11_htmlColorLiteral) {
|
||||
static constexpr OpenMesh::Vec4f rose = 0xFFC7F1FF_htmlColor;
|
||||
|
||||
const OpenMesh::Vec4f light_blue = 0x1FCFFFFF_htmlColor;
|
||||
EXPECT_LE((OpenMesh::Vec4f(0.1215686274f, 0.8117647058f, 1.0f, 1.0f)
|
||||
- light_blue).sqrnorm(), 1e-10);
|
||||
|
||||
Reference in New Issue
Block a user