]> code.bitgloo.com Git - clyne/entityx.git/commitdiff
Fixed invalid header in python files. Now using chrono instead of boost timer. Remove...
authorAntony Woods <acron1@gmail.com>
Wed, 16 Oct 2013 08:09:22 +0000 (09:09 +0100)
committerAntony Woods <acron1@gmail.com>
Wed, 16 Oct 2013 08:09:22 +0000 (09:09 +0100)
.travis.yml
CMakeLists.txt
CheckCXX11SharedPtr.cmake [deleted file]
CheckNeedGetPointer.cmake [deleted file]
README.md
entityx/config.h.in
entityx/help/Timer.cc
entityx/help/Timer.h
entityx/python/PythonSystem.cc
scripts/travis.sh

index 5b5024fa9e51a6953d42be1a6e369b49cb24b66e..611553aff2c35ce661afd80ddd125a5ef6c314de 100644 (file)
@@ -9,7 +9,6 @@ before_install:
   - sudo apt-add-repository -y ppa:jkeiren/ppa
   - if test $CC = gcc; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
   - sudo apt-get update -qq
-  - sudo apt-get install -y boost1.48 python-dev
   - if test $CC = gcc; then sudo apt-get install gcc-4.7 g++-4.7; fi
   - if test $CC = gcc; then sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 20; fi
   - if test $CC = gcc; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 20; fi
index 6cae7734d628cbfedb064d0277720c805dcba29b..48db06e9212400645b3bcb653e13d410ddad315b 100644 (file)
@@ -13,10 +13,8 @@ set(ENTITYX_RUN_BENCHMARKS false CACHE BOOL "Run benchmarks (in conjunction with
 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_STD_SHARED_PTR true CACHE BOOL "Use std::shared_ptr<T> rather than boost::shared_ptr<T>?")
 set(ENTITYX_BUILD_SHARED false CACHE BOOL "Build shared libraries?")
 set(ENTITYX_BUILD_PYTHON false CACHE BOOL "Build entityx::python?")
-set(ENTITYX_BOOST_SP_DISABLE_THREADS true CACHE BOOL "Disable multi-threading support in boost::shared_ptr")
 
 include(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
 include(CheckCXXSourceCompiles)
@@ -28,12 +26,6 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
 set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
 
-
-if (ENTITYX_BOOST_SP_DISABLE_THREADS)
-    message("-- Disabled multi-threading support in Boost (see http://www.boost.org/doc/libs/1_54_0/libs/smart_ptr/shared_ptr.htm)")
-    add_definitions(-DBOOST_SP_DISABLE_THREADS=1)
-endif ()
-
 # C++11 feature checks
 include(CheckCXX11Features.cmake)
 
@@ -55,9 +47,6 @@ macro(create_test TARGET_NAME SOURCE)
         entityx
         gtest
         gtest_main
-        ${Boost_SYSTEM_LIBRARY}
-        ${Boost_TIMER_LIBRARY}
-        ${Boost_SIGNALS_LIBRARY}
         ${ARGN}
         )
     add_test(${TARGET_NAME} ${TARGET_NAME})
@@ -81,9 +70,6 @@ require(HAS_CXX11_LONG_LONG "C++11 lambdas")
 message("-- Checking misc features")
 require(HAVE_STDINT_H "stdint.h")
 
-set(Boost_USE_STATIC_LIBS OFF)
-set(Boost_USE_MULTITHREADED ON)
-set(Boost_USE_STATIC_RUNTIME OFF)
 if (ENTITYX_BUILD_PYTHON)
     message("-- Building with Python support (-DENTITYX_BUILD_PYTHON=0 to disable)")
     find_package(Boost 1.48.0 COMPONENTS python)
@@ -91,7 +77,6 @@ else (ENTITYX_BUILD_PYTHON)
     message("-- Python support disabled")
 endif (ENTITYX_BUILD_PYTHON)
 
-include_directories(${Boost_INCLUDE_DIR})
 set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
 set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
 set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
@@ -100,8 +85,6 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
 # Things to install
 set(install_libs entityx)
 
-include(CheckCXX11SharedPtr.cmake)
-
 set(sources entityx/tags/TagsComponent.cc entityx/deps/Dependencies.cc entityx/System.cc entityx/Event.cc entityx/Entity.cc entityx/Manager.cc)
 add_library(entityx STATIC ${sources})
 
@@ -110,14 +93,11 @@ if (ENTITYX_BUILD_SHARED)
     add_library(entityx_shared SHARED ${sources})
     target_link_libraries(
         entityx_shared
-        ${Boost_SIGNALS_LIBRARY}
         )
     set_target_properties(entityx_shared PROPERTIES OUTPUT_NAME entityx)
     list(APPEND install_libs entityx_shared)
 endif (ENTITYX_BUILD_SHARED)
 
-include_directories(${Boost_INCLUDE_DIR})
-
 if (ENTITYX_BUILD_PYTHON AND Boost_PYTHON_LIBRARY)
     message("-- Found boost::python, building entityx/python")
     find_package(PythonLibs REQUIRED)
@@ -149,7 +129,7 @@ if (ENTITYX_BUILD_PYTHON AND Boost_PYTHON_LIBRARY)
 endif (ENTITYX_BUILD_PYTHON AND Boost_PYTHON_LIBRARY)
 
 if (ENTITYX_BUILD_TESTING)
-    find_package(Boost 1.48.0 REQUIRED COMPONENTS timer system)
+    #find_package(Boost 1.48.0 REQUIRED COMPONENTS timer system)
     add_subdirectory(gtest-1.6.0)
     include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
     enable_testing()
diff --git a/CheckCXX11SharedPtr.cmake b/CheckCXX11SharedPtr.cmake
deleted file mode 100644 (file)
index 0dc3281..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-
-if (ENTITYX_USE_CPP11_STDLIB)
-    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 ()
-else ()
-    message("-- Using default stdlib (try -DENTITYX_USE_CPP11_STDLIB=1 to use -stdlib=libc++)")
-endif ()
-
-check_cxx_source_compiles(
-"
-#include <memory>
-
-int main() { std::shared_ptr<int>(); }
-"
-ENTITYX_HAVE_STD_SHARED_PTR
-)
-
-check_cxx_source_compiles(
-"
-#include <boost/shared_ptr.hpp>
-
-int main() { boost::shared_ptr<int>(); }
-"
-ENTITYX_HAVE_BOOST_SHARED_PTR
-)
-
-if (ENTITYX_HAVE_STD_SHARED_PTR AND ENTITYX_USE_STD_SHARED_PTR)
-    message("-- Using std::shared_ptr<T>")
-else()
-    if (ENTITYX_USE_STD_SHARED_PTR)
-        message("-- Using boost::shared_ptr<T> (std::shared_ptr<T> could not be used)")
-    else()
-        message("-- Using boost::shared_ptr<T> (try -DENTITYX_USE_STD_SHARED_PTR=1 to use std::shared_ptr<T>)")
-    endif()
-endif()
diff --git a/CheckNeedGetPointer.cmake b/CheckNeedGetPointer.cmake
deleted file mode 100644 (file)
index 2e53ac3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-
-check_cxx_source_compiles(
-"
-#include <boost/get_pointer.hpp>
-
-namespace boost {
-template <class T> inline T * get_pointer(const std::shared_ptr<T> &p) {
-  return p.get();
-}
-}
-
-int main() {
-  return 0;
-}
-"
-ENTITYX_NEED_GET_POINTER_SHARED_PTR_SPECIALIZATION
-)
index 1e1f5f14fe9c830d744e6a7958e286aa1a2cccb3..e41d80b0da0e92f330a8905607a0440178bb4646 100644 (file)
--- a/README.md
+++ b/README.md
@@ -282,7 +282,6 @@ EntityX has the following build and runtime requirements:
 
 - A C++ compiler that supports a basic set of C++11 features (ie. Clang >= 3.1, GCC >= 4.7, and maybe (untested) VC++ with the [Nov 2012 CTP](http://www.microsoft.com/en-us/download/details.aspx?id=35515)).
 - [CMake](http://cmake.org/)
-- [Boost](http://boost.org) `1.48.0` (headers only unless using boost::python).
 
 ### C++11 compiler and library support
 
@@ -299,15 +298,13 @@ I use Homebrew, and the following works for me:
 For libstdc++:
 
 ```bash
-brew install boost
-cmake -DENTITYX_BUILD_SHARED=0 -DENTITYX_BUILD_TESTING=1 -DENTITYX_USE_STD_SHARED_PTR=1 -DENTITYX_USE_CPP11_STDLIB=0 ..
+cmake -DENTITYX_BUILD_SHARED=0 -DENTITYX_BUILD_TESTING=1 -DENTITYX_USE_CPP11_STDLIB=0 ..
 ```
 
 For libc++ (with C++11 support):
 
 ```bash
-brew install boost --with-c++11
-cmake -DENTITYX_BUILD_SHARED=0 -DENTITYX_BUILD_TESTING=1 -DENTITYX_USE_STD_SHARED_PTR=1 -DENTITYX_USE_CPP11_STDLIB=1 ..
+cmake -DENTITYX_BUILD_SHARED=0 -DENTITYX_BUILD_TESTING=1 -DENTITYX_USE_CPP11_STDLIB=1 ..
 ```
 
 ### Installing on Ubuntu 12.04
@@ -340,13 +337,10 @@ Once these dependencies are installed you should be able to build and install En
 - `-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_USE_STD_SHARED_PTR=1` - Use `std::shared_ptr<T>` (and friends) rather than the Boost equivalents. This does not eliminate the need for Boost, but is useful if the rest of your application uses `std::shared_ptr<T>`.
 - `-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".
 
-For a production build, you'll typically only need the `-DENTITYX_USE_STD_SHARED_PTR=1` flag, if any.
-
 Once you have selected your flags, build and install with:
 
 ```sh
index de43e8339e1694a05cf3a8633eba3fd750f35c9c..4f9831cf114e48433f98b7ab55fdb0c6f34c3e14 100644 (file)
@@ -1,13 +1,13 @@
 #pragma once
 
-#cmakedefine ENTITYX_HAVE_BOOST_SHARED_PTR 1
-#cmakedefine ENTITYX_HAVE_STD_SHARED_PTR 1
-#cmakedefine ENTITYX_USE_STD_SHARED_PTR 1
 #cmakedefine ENTITYX_MAX_COMPONENTS @ENTITYX_MAX_COMPONENTS@
 #cmakedefine ENTITYX_HAVE_BOOST_PYTHON 1
 #cmakedefine ENTITYX_INSTALLED_PYTHON_PACKAGE_DIR "@ENTITYX_INSTALLED_PYTHON_PACKAGE_DIR@"
 #cmakedefine ENTITYX_NEED_GET_POINTER_SHARED_PTR_SPECIALIZATION "@ENTITYX_NEED_GET_POINTER_SHARED_PTR_SPECIALIZATION@"
 
+#define ENTITYX_USE_STD_SHARED_PTR 1
+#define ENTITYX_HAVE_STD_SHARED_PTR 1
+
 #include <stdint.h>
 #include "entityx/config.h"
 
index de25df0831461095661a2445d845e8f02ba2b804..2de0ef1a35ef85be89072936c9a7dac6b2d6a941 100644 (file)
@@ -25,12 +25,12 @@ Timer::~Timer()
 
 void Timer::restart()
 {
-
+       _start = std::chrono::system_clock::now();
 }
 
 double Timer::elapsed()
 {
-       return 1.0;
+       return std::chrono::duration<double>(std::chrono::system_clock::now() - _start);
 }
 
 } // namespace help
index eaf51ab5f72889c08a732bb46614b2177cc8743b..87a062684143bcc5cac517713a0c2ce45bbbe73e 100644 (file)
@@ -7,9 +7,10 @@
  *
  * Author: Antony Woods <antony@teamwoods.org>
  */
-
 #pragma once
 
+ #include <chrono>
+
 namespace entityx {
 namespace help {
 
@@ -21,6 +22,8 @@ public:
 
        void restart();
        double elapsed();
+private:
+       std::chrono::time_point<std::chrono::system_clock> _start;
 };
 
 } // namespace help
index 032b283aba91162c7dc2fbdc139bc2c46843c5a6..220003b3d210a98d24e7761406b1588034fd2832 100644 (file)
@@ -15,7 +15,7 @@
 #include <iostream>
 #include <sstream>
 #include "entityx/python/PythonSystem.h"
-#include "entityx/help/NonCopyableEvent.h"
+#include "entityx/help/NonCopyable.h"
 
 namespace py = boost::python;
 
index dadc478d33b9eaf189b3459d238c0609ad74132e..b6b7975ff75d3bbc46c949670a9002a81983c260 100755 (executable)
@@ -3,7 +3,7 @@
 CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Debug -DENTITYX_BUILD_TESTING=1"
 
 if [ "$USE_STD_SHARED_PTR" = "1" ]; then
-  CMAKE_ARGS="${CMAKE_ARGS} -DENTITYX_USE_STD_SHARED_PTR=1"
+  CMAKE_ARGS="${CMAKE_ARGS}"
   # This fails on OSX
   if [ "$CXX" = "clang++" ]; then
     CMAKE_ARGS="${CMAKE_ARGS} -DENTITYX_USE_CPP11_STDLIB=1"