Automatically use C++11 features when available and remove USE_CXX11 flag

This commit is contained in:
sfan5 2016-10-06 00:08:27 +02:00
parent 13b485a75f
commit 877b514971
6 changed files with 4 additions and 26 deletions

View File

@ -2,9 +2,6 @@ language: cpp
compiler:
- gcc
- clang
env:
- CXX11=1
- CXX11=0
sudo: false
addons:
apt:

View File

@ -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")

View File

@ -5,7 +5,7 @@
#include <iosfwd>
#include <list>
#include <config.h>
#if USE_CXX11
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#else
@ -43,7 +43,7 @@ struct ColorEntry {
class TileGenerator
{
private:
#if USE_CXX11
#if __cplusplus >= 201103L
typedef std::unordered_map<std::string, ColorEntry> ColorMap;
typedef std::unordered_map<int, std::string> NameMap;
typedef std::unordered_set<std::string> NameSet;

View File

@ -6,8 +6,6 @@
#define USE_LEVELDB @USE_LEVELDB@
#define USE_REDIS @USE_REDIS@
#define USE_CXX11 @USE_CXX11@
#define SHAREDIR "@SHAREDIR@"
#endif

View File

@ -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

View File

@ -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 \
..