From 877b5149716f2e4673198b73d2297b665e1bef66 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 6 Oct 2016 00:08:27 +0200 Subject: [PATCH] Automatically use C++11 features when available and remove USE_CXX11 flag --- .travis.yml | 3 --- CMakeLists.txt | 8 -------- TileGenerator.h | 4 ++-- cmake_config.h.in | 2 -- config.h | 11 +---------- util/travis/script.sh | 2 +- 6 files changed, 4 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7378147..35d1257 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,6 @@ language: cpp compiler: - gcc - clang -env: - - CXX11=1 - - CXX11=0 sudo: false addons: apt: diff --git a/CMakeLists.txt b/CMakeLists.txt index 75565e6..3a5865f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,14 +13,6 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build.") endif() -option(USE_CXX11 "Use C++11" FALSE) -if(USE_CXX11) - set(CMAKE_CXX_FLAGS "-std=c++11") - set(USE_CXX11 1) # We use this in config.h, it needs to be a valid value -else(USE_CXX11) - set(USE_CXX11 0) -endif(USE_CXX11) - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g2 -Wall") diff --git a/TileGenerator.h b/TileGenerator.h index aaaf4dc..6930cf7 100644 --- a/TileGenerator.h +++ b/TileGenerator.h @@ -5,7 +5,7 @@ #include #include #include -#if USE_CXX11 +#if __cplusplus >= 201103L #include #include #else @@ -43,7 +43,7 @@ struct ColorEntry { class TileGenerator { private: -#if USE_CXX11 +#if __cplusplus >= 201103L typedef std::unordered_map ColorMap; typedef std::unordered_map NameMap; typedef std::unordered_set NameSet; diff --git a/cmake_config.h.in b/cmake_config.h.in index e0d9bb1..2711a45 100644 --- a/cmake_config.h.in +++ b/cmake_config.h.in @@ -6,8 +6,6 @@ #define USE_LEVELDB @USE_LEVELDB@ #define USE_REDIS @USE_REDIS@ -#define USE_CXX11 @USE_CXX11@ - #define SHAREDIR "@SHAREDIR@" #endif diff --git a/config.h b/config.h index c7a37b5..cc09a29 100644 --- a/config.h +++ b/config.h @@ -1,12 +1,3 @@ -/* - * ===================================================================== - * Version: 1.0 - * Created: 01.09.2012 12:58:02 - * Author: Miroslav Bendík - * Company: LinuxOS.sk - * ===================================================================== - */ - #if MSDOS || __OS2__ || __NT__ || _WIN32 #define PATH_SEPARATOR '\\' #else @@ -21,5 +12,5 @@ #define USE_LEVELDB 0 #define USE_REDIS 0 -#define USE_CXX11 0 +#define SHAREDIR "/usr/share/minetest" #endif diff --git a/util/travis/script.sh b/util/travis/script.sh index 1f8889a..16bdad4 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -9,7 +9,7 @@ mkdir -p travisbuild cd travisbuild cmake \ - -DENABLE_LEVELDB=1 -DUSE_CXX11=$CXX11 \ + -DENABLE_LEVELDB=1 \ -DLEVELDB_LIBRARY=../libleveldb/lib/libleveldb.so \ -DLEVELDB_INCLUDE_DIR=../libleveldb/include \ ..