Skip to content

Commit

Permalink
Automatically use C++11 features when available and remove USE_CXX11 …
Browse files Browse the repository at this point in the history
…flag
  • Loading branch information
sfan5 committed Oct 5, 2016
1 parent 13b485a commit 877b514
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 26 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Expand Up @@ -2,9 +2,6 @@ language: cpp
compiler:
- gcc
- clang
env:
- CXX11=1
- CXX11=0
sudo: false
addons:
apt:
Expand Down
8 changes: 0 additions & 8 deletions CMakeLists.txt
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions TileGenerator.h
Expand Up @@ -5,7 +5,7 @@
#include <iosfwd>
#include <list>
#include <config.h>
#if USE_CXX11
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#else
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions cmake_config.h.in
Expand Up @@ -6,8 +6,6 @@
#define USE_LEVELDB @USE_LEVELDB@
#define USE_REDIS @USE_REDIS@

#define USE_CXX11 @USE_CXX11@

#define SHAREDIR "@SHAREDIR@"

#endif
Expand Down
11 changes: 1 addition & 10 deletions 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
Expand All @@ -21,5 +12,5 @@
#define USE_LEVELDB 0
#define USE_REDIS 0

#define USE_CXX11 0
#define SHAREDIR "/usr/share/minetest"
#endif
2 changes: 1 addition & 1 deletion util/travis/script.sh
Expand Up @@ -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 \
..
Expand Down

0 comments on commit 877b514

Please sign in to comment.