diff --git a/Autowiring.nuspec.in b/Autowiring.nuspec.in index 9525f586a..f1e2f2cc3 100644 --- a/Autowiring.nuspec.in +++ b/Autowiring.nuspec.in @@ -9,7 +9,7 @@ false A C++11 Concurrent Inversion of Control framework Autowiring is an inversion-of-control framework for C++11. It provides a declarative way to manage resources through dependency injection. - Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. + Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. en-US c++ ioc concurrent c++11 @@ -18,27 +18,17 @@ - - - - - - - - - - @@ -189,4 +179,4 @@ - \ No newline at end of file + diff --git a/src/autowiring/C++11/boost_atomic.h b/src/autowiring/C++11/boost_atomic.h deleted file mode 100644 index 90b74e3eb..000000000 --- a/src/autowiring/C++11/boost_atomic.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include -namespace std { - using autoboost::atomic; - using autoboost::atomic_flag; - using autoboost::atomic_thread_fence; - using autoboost::memory_order_relaxed; - using autoboost::memory_order_consume; - using autoboost::memory_order_acquire; - using autoboost::memory_order_release; - using autoboost::memory_order_acq_rel; - using autoboost::memory_order_seq_cst; -#if !defined(ATOMIC_FLAG_INIT) -#define ATOMIC_FLAG_INIT -#endif -} diff --git a/src/autowiring/C++11/boost_chrono.h b/src/autowiring/C++11/boost_chrono.h deleted file mode 100644 index 8118c7910..000000000 --- a/src/autowiring/C++11/boost_chrono.h +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include - -namespace std { - namespace chrono { - using namespace autoboost::chrono; - } -} diff --git a/src/autowiring/C++11/boost_mutex.h b/src/autowiring/C++11/boost_mutex.h deleted file mode 100644 index 63469cb19..000000000 --- a/src/autowiring/C++11/boost_mutex.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace std { - using autoboost::mutex; - using autoboost::recursive_mutex; - using autoboost::lock_guard; - using autoboost::unique_lock; - using autoboost::condition_variable; - using autoboost::condition_variable_any; - using autoboost::cv_status; - using autoboost::once_flag; - using autoboost::call_once; -} diff --git a/src/autowiring/C++11/boost_rvalue.h b/src/autowiring/C++11/boost_rvalue.h deleted file mode 100644 index 7080d97bd..000000000 --- a/src/autowiring/C++11/boost_rvalue.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include - -namespace std { - using autoboost::forward; - using autoboost::move; -} diff --git a/src/autowiring/C++11/boost_system_error.h b/src/autowiring/C++11/boost_system_error.h deleted file mode 100644 index d6ff619f5..000000000 --- a/src/autowiring/C++11/boost_system_error.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include -#include - -namespace std { - using autoboost::system::error_category; - using autoboost::system::generic_category; - using autoboost::system::system_error; - - using autoboost::system::is_error_code_enum; - - namespace errc { - using autoboost::system::errc::make_error_code; - } -} diff --git a/src/autowiring/C++11/boost_thread.h b/src/autowiring/C++11/boost_thread.h deleted file mode 100644 index c4a4ec574..000000000 --- a/src/autowiring/C++11/boost_thread.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include - -namespace std { - using autoboost::thread; - namespace this_thread = autoboost::this_thread; -} diff --git a/src/autowiring/C++11/boost_tuple.h b/src/autowiring/C++11/boost_tuple.h deleted file mode 100644 index 1632f3a95..000000000 --- a/src/autowiring/C++11/boost_tuple.h +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include -#include - -namespace std { - template - class tuple; - - template - class tuple { - public: - tuple(void) {} - tuple(const T& ele, const Ts&... eles): - m_tuple(ele, eles...) - {} - virtual ~tuple(void){} - - tuple& operator=(const tuple& other) { - m_tuple = other.m_tuple; - return *this; - } - - template - tuple& operator=(const tuple& other) { - m_tuple = other; - return *this; - } - - bool operator==(const tuple& other) const { - return m_tuple == other.m_tuple; - } - - bool operator<(const tuple& other) const { - return m_tuple < other.m_tuple; - } - - autoboost::tuple m_tuple; - }; - - template<> - class tuple<> { - public: - tuple(void) {} - virtual ~tuple(void){} - - tuple& operator=(const tuple<>& other) { - return *this; - } - - bool operator==(const tuple<>& other) const { - return true; - } - - bool operator<(const tuple<>& other) const { - return false; - } - - autoboost::tuple<> m_tuple; - }; - - template - ::std::tuple tie(const Ts&... val) { - return ::std::tuple(val...) ; - } - - template - auto get(const ::std::tuple& tup) -> decltype(autoboost::get(tup.m_tuple)) { - return autoboost::get(tup.m_tuple); - } - - template - ::std::tuple make_tuple(const Ts&... ele) { - return ::std::tuple(ele...); - } - -}//namespace std diff --git a/src/autowiring/C++11/boost_utility.h b/src/autowiring/C++11/boost_utility.h deleted file mode 100644 index ee73796ad..000000000 --- a/src/autowiring/C++11/boost_utility.h +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include - -namespace std { - using autoboost::declval; -} diff --git a/src/autowiring/C++11/chrono_with_profiling_clock.h b/src/autowiring/C++11/chrono_with_profiling_clock.h index e003d498d..495891e75 100644 --- a/src/autowiring/C++11/chrono_with_profiling_clock.h +++ b/src/autowiring/C++11/chrono_with_profiling_clock.h @@ -1,11 +1,7 @@ // Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. #pragma once -#if STL11_ALLOWED - #include -#else - #include -#endif +#include // This solution taken from http://stackoverflow.com/questions/8386128/how-to-get-the-precision-of-high-resolution-clock // Hopefully it will be able to be depricated when VS2015 hits. diff --git a/src/autowiring/C++11/cpp11.h b/src/autowiring/C++11/cpp11.h index c631100be..981d313e4 100644 --- a/src/autowiring/C++11/cpp11.h +++ b/src/autowiring/C++11/cpp11.h @@ -2,25 +2,15 @@ #pragma once // The reason this header exists is due to the asymmetric availability of C++11 on our -// various compiler targets. In particular, none of the typical headers for C++11 support -// exist when building with libstdc++ on Apple, so we have to disable it across the board. -#ifdef __APPLE__ - #include // detect std::lib - #ifdef _LIBCPP_VERSION // clang + libc++ - #define STL11_ALLOWED 1 - #else // clang + libstdc++ - #define STL11_ALLOWED 0 - #endif -#else // gcc or MSVC - #define STL11_ALLOWED 1 -#endif +// various compiler targets. #define IS_CLANG defined(__clang_major__) #define CLANG_CHECK(maj, min) (__clang_major__ == maj && __clang_minor__ >= min || __clang_major__ > maj) #define GCC_CHECK(maj, min) (__GNUC__ == maj && __GNUC_MINOR__ >= min || __GNUC__ > maj) -// If Boost.Thread is used, we want it to provide the new name for its class -#define BOOST_THREAD_PROVIDES_FUTURE +#if IS_CLANG && !CLANG_CHECK(3, 6) + #error Autowiring is not supported on clang 3.5 or older +#endif #ifdef AUTOWIRING_IS_BEING_BUILT // We know that we're using deprecated stuff in our unit tests, but the tests still @@ -61,28 +51,14 @@ /********************* * Location of the unordered_set header *********************/ -#if defined(__APPLE__) && !defined(_LIBCPP_VERSION) - #define STL_UNORDERED_SET - #define STL_UNORDERED_MAP -#else - #define STL_UNORDERED_SET - #define STL_UNORDERED_MAP -#endif +#define STL_UNORDERED_SET +#define STL_UNORDERED_MAP /********************* * initializer_list header *********************/ -#if IS_CLANG - #define HAS_INITIALIZER_LIST __has_feature(cxx_generalized_initializers) - #if HAS_INITIALIZER_LIST - #define INITIALIZER_LIST_HEADER - #else - #define INITIALIZER_LIST_HEADER - #endif -#else - #define HAS_INITIALIZER_LIST 1 - #define INITIALIZER_LIST_HEADER -#endif +#define HAS_INITIALIZER_LIST 1 +#define INITIALIZER_LIST_HEADER /********************* * Check override keyword availability @@ -94,7 +70,7 @@ /********************* * static_assert availability *********************/ -#if CLANG_CHECK(2, 9) || GCC_CHECK(4, 3) +#if IS_CLANG || GCC_CHECK(4, 3) #define HAS_STATIC_ASSERT 1 #elif _MSC_VER >= 1500 #define HAS_STATIC_ASSERT 1 @@ -102,7 +78,7 @@ #define HAS_STATIC_ASSERT 0 #endif -#if !HAS_STATIC_ASSERT || !STL11_ALLOWED +#if !HAS_STATIC_ASSERT // Static assert completely disabled if it's not available #define static_assert(...) #endif @@ -114,16 +90,12 @@ /********************* * system error availability *********************/ -#if STL11_ALLOWED - #define SYSTEM_ERROR_HEADER -#else - #define SYSTEM_ERROR_HEADER -#endif +#define SYSTEM_ERROR_HEADER /********************* * future availability *********************/ -#if (_MSC_VER >= 1700 || (STL11_ALLOWED)) && (!__ANDROID__ || (GCC_CHECK(4, 9) && __aarch64__)) +#if (!__ANDROID__ || (GCC_CHECK(4, 9) && __aarch64__)) #define FUTURE_HEADER #else // As of NDK r10, we still don't have an implementation of "future" for Android @@ -133,19 +105,14 @@ /** * type_index support */ -// Supported natively on any platform except Mac/libstdc++ -#if STL11_ALLOWED - #define TYPE_INDEX_HEADER -#else - #define TYPE_INDEX_HEADER -#endif +#define TYPE_INDEX_HEADER /********************* * Decide what version of type_traits we are going to use *********************/ #if _MSC_VER >= 1500 #define TYPE_TRAITS_AVAILABLE 1 -#elif __GXX_EXPERIMENTAL_CXX0X__ && STL11_ALLOWED +#elif __GXX_EXPERIMENTAL_CXX0X__ #define TYPE_TRAITS_AVAILABLE 1 #else #define TYPE_TRAITS_AVAILABLE 0 @@ -170,40 +137,18 @@ #define SHARED_PTR_IN_STL 0 #endif -#if SHARED_PTR_IN_STL && STL11_ALLOWED +#if SHARED_PTR_IN_STL #define MEMORY_HEADER #else #define MEMORY_HEADER #endif -// Nullptr_t has odd availability -#ifdef _MSC_VER - #define HAS_NULLPTR_T 1 -#elif IS_CLANG - #define HAS_NULLPTR_T (STL11_ALLOWED && __has_feature(cxx_nullptr)) -#elif __cplusplus > 199711L - #define HAS_NULLPTR_T 1 -#else - // No idea--better safe than sorry! - #define HAS_NULLPTR_T 1 -#endif - -#if ! HAS_NULLPTR_T - // Have to provide our own dummy type, then, there's no header for this one - namespace std { typedef decltype(nullptr) nullptr_t; } -#endif - +#define HAS_NULLPTR_T 1 /********************* * Specific support for is_constructible *********************/ -#ifdef _MSC_VER - #define AUTOWIRE_cxx_is_constructible 1 -#elif IS_CLANG - #define AUTOWIRE_cxx_is_constructible STL11_ALLOWED -#else - #define AUTOWIRE_cxx_is_constructible 1 -#endif +#define AUTOWIRE_cxx_is_constructible 1 /********************* * noexcept support @@ -227,18 +172,13 @@ *********************/ #if _MSC_VER >= 1500 #define LAMBDAS_AVAILABLE 1 -#elif CLANG_CHECK(3, 2) - // Only available if we're told we're using at least C++11 - #if __cplusplus >= 201103L - #define LAMBDAS_AVAILABLE 1 - #else - #define LAMBDAS_AVAILABLE 0 - #endif +#elif IS_CLANG + #define LAMBDAS_AVAILABLE 1 #elif __GXX_EXPERIMENTAL_CXX0X__ #define LAMBDAS_AVAILABLE 1 #endif -#if LAMBDAS_AVAILABLE && STL11_ALLOWED +#if LAMBDAS_AVAILABLE #define FUNCTIONAL_HEADER #define _WEBSOCKETPP_CPP11_FUNCTIONAL_ #else @@ -254,7 +194,7 @@ *********************/ #if _MSC_VER >= 1500 #define ARRAYS_AVAILABLE 1 -#elif __GXX_EXPERIMENTAL_CXX0X__ && STL11_ALLOWED +#elif __GXX_EXPERIMENTAL_CXX0X__ #define ARRAYS_AVAILABLE 1 #else #define ARRAYS_AVAILABLE 0 @@ -275,54 +215,29 @@ /** * R-value reference check */ -#if STL11_ALLOWED - #define RVALUE_HEADER - #define _WEBSOCKETPP_CPP11_MEMORY_ -#else - // Remove literal references in order to fix another missing header problem on *nix - // Defined by default on C++11 Clang - #if !defined(__APPLE__) || __cplusplus >= 201103L - #define BOOST_NO_UNICODE_LITERALS 1 - #endif - #define RVALUE_HEADER -#endif +#define RVALUE_HEADER +#define _WEBSOCKETPP_CPP11_MEMORY_ /** * Atomic */ -#if STL11_ALLOWED - #define ATOMIC_HEADER -#else - #define ATOMIC_HEADER -#endif +#define ATOMIC_HEADER /** * Tuple */ -#if STL11_ALLOWED - #define STL_TUPLE_HEADER -#else - #define STL_TUPLE_HEADER -#endif +#define STL_TUPLE_HEADER /** * Mutex */ -#if STL11_ALLOWED - #define MUTEX_HEADER -#else - #define MUTEX_HEADER -#endif +#define MUTEX_HEADER /** * Thread */ -#if STL11_ALLOWED - #define THREAD_HEADER - #define _WEBSOCKETPP_CPP11_THREAD_ -#else - #define THREAD_HEADER -#endif +#define THREAD_HEADER +#define _WEBSOCKETPP_CPP11_THREAD_ /** * Chrono @@ -332,18 +247,12 @@ /** * Utility */ -#if STL11_ALLOWED - #define UTILITY_HEADER -#else - #define UTILITY_HEADER -#endif +#define UTILITY_HEADER /** * System error */ -#if STL11_ALLOWED - #define _WEBSOCKETPP_CPP11_SYSTEM_ERROR_ -#endif +#define _WEBSOCKETPP_CPP11_SYSTEM_ERROR_ /** * Filesystem diff --git a/src/autowiring/C++11/tr1_unordered_map.h b/src/autowiring/C++11/tr1_unordered_map.h deleted file mode 100644 index 96940e863..000000000 --- a/src/autowiring/C++11/tr1_unordered_map.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include - -namespace std { - using std::tr1::unordered_map; - using std::tr1::hash; -} diff --git a/src/autowiring/C++11/tr1_unordered_set.h b/src/autowiring/C++11/tr1_unordered_set.h deleted file mode 100644 index 824498bf0..000000000 --- a/src/autowiring/C++11/tr1_unordered_set.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include - -namespace std { - using std::tr1::unordered_set; - using std::tr1::hash; -} diff --git a/src/autowiring/C++11/type_index.h b/src/autowiring/C++11/type_index.h deleted file mode 100644 index 7907ca081..000000000 --- a/src/autowiring/C++11/type_index.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2012-2016 Leap Motion, Inc. All rights reserved. -#pragma once - -#include TYPE_TRAITS_HEADER -#include -#include - -namespace std { - -class type_index { -public: - type_index(const type_info& info): - _info(&info) - {} - - bool operator==(const type_index& rhs) const { - return *_info == *rhs._info; - } - - bool operator<(const type_index& rhs) const { - return (_info->before(*rhs._info) != 0); - } - - bool operator!=(const type_index& rhs) const { - return !operator==(rhs); - } - - size_t hash_code() const { - return (size_t)_info; - } - - const char* name() const { - return _info->name(); - } - -private: - const type_info* _info; - -}; - -namespace tr1 { - template<> - struct hash: - public std::unary_function - { - size_t operator()(std::type_index val) const { - return val.hash_code(); - } - }; -} - -}; diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index dd5c2f91b..3655fcce1 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -177,30 +177,18 @@ add_conditional_sources( GROUP_NAME "C++11" FILES C++11/boost_array.h - C++11/boost_atomic.h - C++11/boost_chrono.h C++11/boost_exception_ptr.h C++11/boost_functional.h C++11/boost_future.h - C++11/boost_mutex.h - C++11/boost_rvalue.h C++11/boost_shared_ptr.h - C++11/boost_system_error.h - C++11/boost_thread.h - C++11/boost_tuple.h C++11/boost_type_traits.h - C++11/boost_utility.h C++11/chrono_with_profiling_clock.h C++11/cpp11.h - C++11/empty_file.h C++11/filesystem.h C++11/make_unique.h C++11/memory.h C++11/memory_nostl11.h C++11/mutex.h - C++11/tr1_unordered_map.h - C++11/tr1_unordered_set.h - C++11/type_index.h C++11/unique_ptr.h )