aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntony Woods <acron1@gmail.com>2013-11-04 09:09:28 +0000
committerAntony Woods <acron1@gmail.com>2013-11-04 09:09:28 +0000
commit130837fd4d56f84c5d75401ec65938b7ae196c81 (patch)
treef3ce6239a201e8ffa11a99a636a09e30653203ce
parent14ad529438b66acc7967a38073e3a927c433a878 (diff)
Moved stdlib=libc++ test into CMakeLists.txt. Made further modifications to README.md
-rw-r--r--CMakeLists.txt25
-rw-r--r--README.md11
2 files changed, 24 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c0d5d9..104efb1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,8 +11,7 @@ include_directories(${CMAKE_CURRENT_LIST_DIR})
set(ENTITYX_BUILD_TESTING false CACHE BOOL "Enable building of tests.")
set(ENTITYX_RUN_BENCHMARKS false CACHE BOOL "Run benchmarks (in conjunction with -DENTITYX_BUILD_TESTING=1).")
set(ENTITYX_MAX_COMPONENTS 64 CACHE STRING "Set the maximum number of components.")
-set(ENTITYX_USE_CPP11_STDLIB false CACHE BOOL "For Clang, specify whether to use libc++ (-stdlib=libc++).")
-# Check for which shared_ptr implementation to use.
+set(ENTITYX_USE_CPP11_STDLIB true CACHE BOOL "For Clang, specify whether to use libc++ (-stdlib=libc++).")
set(ENTITYX_BUILD_SHARED false CACHE BOOL "Build shared libraries?")
set(ENTITYX_BUILD_PYTHON false CACHE BOOL "Build entityx::python?")
@@ -29,6 +28,28 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
# C++11 feature checks
include(CheckCXX11Features.cmake)
+add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1)
+set(OLD_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
+check_cxx_source_compiles(
+"
+#include <memory>
+
+int main() {
+ std::shared_ptr<int>();
+}
+"
+ENTITYX_HAVE_CXX11_STDLIB
+)
+
+if (NOT ENTITYX_HAVE_CXX11_STDLIB)
+ message("-- Not using -stdlib=libc++ (test failed to build)")
+ set(CMAKE_CXX_FLAGS "${OLD_CMAKE_CXX_FLAGS}")
+else ()
+ message("-- Using -stdlib=libc++")
+endif ()
+
+
# Misc features
check_include_file("stdint.h" HAVE_STDINT_H)
diff --git a/README.md b/README.md
index 13ddcc4..2246804 100644
--- a/README.md
+++ b/README.md
@@ -291,20 +291,12 @@ C++11 support is quite...raw. To make life more interesting, C++ support really
On OSX you must use Clang as the GCC version is practically prehistoric.
-EntityX can build against libstdc++ (GCC with no C++11 library support) or libc++ (Clang with C++11 library support), though you will need to ensure that Boost is built with the same standard library.
-
I use Homebrew, and the following works for me:
For libstdc++:
```bash
-cmake -DENTITYX_BUILD_SHARED=0 -DENTITYX_BUILD_TESTING=1 -DENTITYX_USE_CPP11_STDLIB=0 ..
-```
-
-For libc++ (with C++11 support):
-
-```bash
-cmake -DENTITYX_BUILD_SHARED=0 -DENTITYX_BUILD_TESTING=1 -DENTITYX_USE_CPP11_STDLIB=1 ..
+cmake -DENTITYX_BUILD_SHARED=0 -DENTITYX_BUILD_TESTING=1 ..
```
### Installing on Ubuntu 12.04
@@ -336,7 +328,6 @@ Once these dependencies are installed you should be able to build and install En
- `-DENTITYX_BUILD_PYTHON=1` - Build Python scripting integration.
- `-DENTITYX_BUILD_TESTING=1` - Build tests (run with `make test`).
- `-DENTITYX_RUN_BENCHMARKS=1` - In conjunction with `-DENTITYX_BUILD_TESTING=1`, also build benchmarks.
-- `-DENTITYX_USE_CPP11_STDLIB=1` - For Clang, specify whether to use `-stdlib=libc++`.
- `-DENTITYX_MAX_COMPONENTS=64` - Override the maximum number of components that can be assigned to each entity.
- `-DENTITYX_BUILD_SHARED=1` - Whether to build shared libraries (defaults to 1).
- `-DENTITYX_BUILD_TESTING=0` - Whether to build tests (defaults to 0). Run with "make && make test".