From a2edfccdb6c743c39abfb40fbbf52ae4087ae7f1 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 24 Oct 2016 23:07:28 -0700 Subject: [PATCH] moved to C++11 as default --- .travis.yml | 4 +--- CHANGELOG.md | 3 +++ GRT/Util/GRTTypedefs.h | 4 ---- GRT/Util/Random.h | 9 --------- build/CMakeLists.txt | 29 ++++++----------------------- 5 files changed, 10 insertions(+), 39 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1d7ab180..75bccae2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,6 @@ compiler: env: - CONFIG=Release - CONFIG=Debug - - CXX11=ON - - CXX11=OFF before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test ; fi @@ -25,7 +23,7 @@ before_script: - cd build - mkdir build - cd build - - cmake .. -DCMAKE_BUILD_TYPE=$CONFIG -DENABLE_CXX11_SUPPORT=$CXX11 + - cmake .. -DCMAKE_BUILD_TYPE=$CONFIG script: - make -j2 - make test diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ad9792d..6d13b2ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ This file contains some notes about significant changes to the GRT. # Version 0.2.3 +## 24th October 2016 +- **C++11:** moved to using C++11 as default + ## 22nd October 2016 - **backend updates:** set all classification, regression, cluster, preprocessing, and postprocessing modules to use new ID and base class functionality - **unit tests:** working to improve and extend all GRT unit tests diff --git a/GRT/Util/GRTTypedefs.h b/GRT/Util/GRTTypedefs.h index a0b16881..6b51be29 100644 --- a/GRT/Util/GRTTypedefs.h +++ b/GRT/Util/GRTTypedefs.h @@ -232,10 +232,6 @@ abort(); \ #else // !NDEBUG #define grt_assert(x) #endif // !NDEBUG - -#ifndef GRT_CXX11_ENABLED -#define override ///Define the empty override macro -#endif //Declare typedefs for the legacy data types class ClassificationData; diff --git a/GRT/Util/Random.h b/GRT/Util/Random.h index 43ac87b3..4b20be8b 100755 --- a/GRT/Util/Random.h +++ b/GRT/Util/Random.h @@ -34,17 +34,8 @@ #include "../DataStructures/Vector.h" #include "../DataStructures/VectorFloat.h" #include "IndexedDouble.h" - -#ifdef GRT_CXX11_ENABLED -#include -/* #include -#define GRT_USE_CXX11_RANDOM_ALGO 1 -*/ //Disable teh new random algo until it is fully tested -#define GRT_USE_CXX11_RANDOM_ALGO 1 -#else #define GRT_USE_CXX11_RANDOM_ALGO 0 -#endif GRT_BEGIN_NAMESPACE diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 051d2bce..42c771f5 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -11,13 +11,15 @@ option(BUILD_TESTS “build-unit-tests” ON) option(BUILD_EXAMPLES “build-examples” ON) option(BUILD_TOOLS “build-tools” ON) option(BUILD_SHARED_LIB "build-shared-lib" ON) -option(ENABLE_CXX11_SUPPORT "enable-c++11-support" ON) option(EXCLUDE_FROM_INSTALL "exclude-from-install" OFF) #setup the default build flags set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ") +#Define that we are now using C++11 by default +add_definitions(-DGRT_CXX11_ENABLED) + #Setup if the library should be built as static or shared, default is SHARED, turning shared off will make a static build if(BUILD_SHARED_LIB MATCHES ON) set(LIB_BUILD_TYPE SHARED) @@ -29,12 +31,6 @@ else() #setup for static build set(BUILD_SHARED_LIB OFF) #Make sure the shared lib is off endif() -#If C++11 is enabled, then define the relevant flag -if( ENABLE_CXX11_SUPPORT MATCHES ON) - message(STATUS "Building with C++11") - add_definitions(-DGRT_CXX11_ENABLED) -endif() - #If static lib is enabled, then define the relevant flag if( BUILD_STATIC_LIB MATCHES ON ) add_definitions(-DGRT_STATIC_LIB) @@ -50,36 +46,23 @@ endif() if(APPLE) message(STATUS "Building " ${LIB_BUILD_TYPE_INFO} " library for OSX") configure_file(grt.pc.in ${CMAKE_CURRENT_BINARY_DIR}/grt.pc @ONLY) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall") - - #Add C++11 and multithreading support - if( ENABLE_CXX11_SUPPORT MATCHES ON ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") - endif() else() #Add any custom Linux definitions if(UNIX) message(STATUS "Building " ${LIB_BUILD_TYPE_INFO} " library for UNIX/Linux") configure_file(grt.pc.in ${CMAKE_CURRENT_BINARY_DIR}/grt.pc @ONLY) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall") - - #Add C++11 and multithreading support - if( ENABLE_CXX11_SUPPORT MATCHES ON ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11") - endif() - endif() if(MINGW) message(STATUS "Building " ${LIB_BUILD_TYPE_INFO} " library for Windows/MinGW") configure_file(grt.pc.in ${CMAKE_CURRENT_BINARY_DIR}/grt.pc @ONLY) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall") - - #Add C++11 and multithreading support - if( ENABLE_CXX11_SUPPORT MATCHES ON ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11") - endif() endif() endif() #end of else(APPLE)