Skip to content

Commit

Permalink
moved to C++11 as default
Browse files Browse the repository at this point in the history
  • Loading branch information
ngillian-google committed Oct 25, 2016
1 parent 170129e commit a2edfcc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 39 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions GRT/Util/GRTTypedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions GRT/Util/Random.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,8 @@
#include "../DataStructures/Vector.h"
#include "../DataStructures/VectorFloat.h"
#include "IndexedDouble.h"

#ifdef GRT_CXX11_ENABLED
#include <random>
/*
#include <random>
#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

Expand Down
29 changes: 6 additions & 23 deletions build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit a2edfcc

Please sign in to comment.