mirror of
https://github.com/minetest/minetestmapper.git
synced 2024-11-22 07:23:46 +01:00
Automatically use C++11 features when available and remove USE_CXX11 flag
This commit is contained in:
parent
13b485a75f
commit
877b514971
@ -2,9 +2,6 @@ language: cpp
|
|||||||
compiler:
|
compiler:
|
||||||
- gcc
|
- gcc
|
||||||
- clang
|
- clang
|
||||||
env:
|
|
||||||
- CXX11=1
|
|
||||||
- CXX11=0
|
|
||||||
sudo: false
|
sudo: false
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
|
@ -13,14 +13,6 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build.")
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build.")
|
||||||
endif()
|
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_RELEASE "-O3 -Wall")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g2 -Wall")
|
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g2 -Wall")
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#if USE_CXX11
|
#if __cplusplus >= 201103L
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#else
|
#else
|
||||||
@ -43,7 +43,7 @@ struct ColorEntry {
|
|||||||
class TileGenerator
|
class TileGenerator
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
#if USE_CXX11
|
#if __cplusplus >= 201103L
|
||||||
typedef std::unordered_map<std::string, ColorEntry> ColorMap;
|
typedef std::unordered_map<std::string, ColorEntry> ColorMap;
|
||||||
typedef std::unordered_map<int, std::string> NameMap;
|
typedef std::unordered_map<int, std::string> NameMap;
|
||||||
typedef std::unordered_set<std::string> NameSet;
|
typedef std::unordered_set<std::string> NameSet;
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#define USE_LEVELDB @USE_LEVELDB@
|
#define USE_LEVELDB @USE_LEVELDB@
|
||||||
#define USE_REDIS @USE_REDIS@
|
#define USE_REDIS @USE_REDIS@
|
||||||
|
|
||||||
#define USE_CXX11 @USE_CXX11@
|
|
||||||
|
|
||||||
#define SHAREDIR "@SHAREDIR@"
|
#define SHAREDIR "@SHAREDIR@"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
11
config.h
11
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
|
#if MSDOS || __OS2__ || __NT__ || _WIN32
|
||||||
#define PATH_SEPARATOR '\\'
|
#define PATH_SEPARATOR '\\'
|
||||||
#else
|
#else
|
||||||
@ -21,5 +12,5 @@
|
|||||||
#define USE_LEVELDB 0
|
#define USE_LEVELDB 0
|
||||||
#define USE_REDIS 0
|
#define USE_REDIS 0
|
||||||
|
|
||||||
#define USE_CXX11 0
|
#define SHAREDIR "/usr/share/minetest"
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,7 +9,7 @@ mkdir -p travisbuild
|
|||||||
cd travisbuild
|
cd travisbuild
|
||||||
|
|
||||||
cmake \
|
cmake \
|
||||||
-DENABLE_LEVELDB=1 -DUSE_CXX11=$CXX11 \
|
-DENABLE_LEVELDB=1 \
|
||||||
-DLEVELDB_LIBRARY=../libleveldb/lib/libleveldb.so \
|
-DLEVELDB_LIBRARY=../libleveldb/lib/libleveldb.so \
|
||||||
-DLEVELDB_INCLUDE_DIR=../libleveldb/include \
|
-DLEVELDB_INCLUDE_DIR=../libleveldb/include \
|
||||||
..
|
..
|
||||||
|
Loading…
Reference in New Issue
Block a user