From e569dc47c9ff3c3118cb96427d3ec9a6aced98aa Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Tue, 2 Apr 2013 00:19:30 -0400 Subject: Add support for Travis-CI. Also ditched glog. --- .travis.yml | 17 +++++++++++++++++ CMakeLists.txt | 11 ++++++++--- entityx/Entity.h | 3 +-- entityx/Entity_test.cc | 1 - entityx/Event_test.cc | 1 - entityx/System.h | 6 +++--- entityx/System_test.cc | 1 - gtest-1.6.0/src/gtest-internal-inl.h | 1 - 8 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e7ac9b8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: cpp +compiler: + - clang + - gcc +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 upgrade -y + - sudo apt-get install -y boost1.48 + - 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 + - if test $CC = gcc; then sudo update-alternatives --config gcc; fi + - if test $CC = gcc; then sudo update-alternatives --config g++; fi + +script: cmake -DBUILD_TESTING=1 && make && make test diff --git a/CMakeLists.txt b/CMakeLists.txt index 257bb99..9200f8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.8) project(EntityX) include_directories(${CMAKE_CURRENT_LIST_DIR}) +set(RUN_BENCHMARKS false CACHE BOOL "Run benchmarks") + include(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) # C++11 feature checks include(CheckCXX11Features.cmake) @@ -21,7 +23,6 @@ macro(create_test TARGET_NAME SOURCE) target_link_libraries( ${TARGET_NAME} entityx - glog gtest gtest_main ${Boost_LIBRARIES} @@ -66,7 +67,6 @@ add_library(entityx_shared SHARED ${sources}) target_link_libraries( entityx_shared ${Boost_SIGNALS_LIBRARY} - glog ) set_target_properties(entityx_shared PROPERTIES OUTPUT_NAME entityx) @@ -85,7 +85,12 @@ if (BUILD_TESTING) create_test(component_test entityx/Components_test.cc) create_test(event_test entityx/Event_test.cc) create_test(system_test entityx/System_test.cc) - create_test(benchmarks_test entityx/Benchmarks_test.cc) + if (RUN_BENCHMARKS) + message("-- Running benchmarks") + create_test(benchmarks_test entityx/Benchmarks_test.cc) + else () + message("-- Not running benchmarks (use -DRUN_BENCHMARKS=1 to enable)") + endif () endif (BUILD_TESTING) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/entityx/*.h") diff --git a/entityx/Entity.h b/entityx/Entity.h index 0e6d861..65900b9 100644 --- a/entityx/Entity.h +++ b/entityx/Entity.h @@ -24,7 +24,6 @@ #include #include -#include #include "entityx/Event.h" namespace entityx { @@ -360,7 +359,7 @@ class EntityManager : boost::noncopyable { * Emits EntityDestroyedEvent. */ void destroy(Entity::Id entity) { - CHECK(entity < entity_component_mask_.size()) << "Entity::Id ID outside entity vector range"; + assert(entity < entity_component_mask_.size() && "Entity::Id ID outside entity vector range"); event_manager_.emit(Entity(this, entity)); for (auto &components : entity_components_) { components.at(entity).reset(); diff --git a/entityx/Entity_test.cc b/entityx/Entity_test.cc index d3fcf8e..6443e75 100644 --- a/entityx/Entity_test.cc +++ b/entityx/Entity_test.cc @@ -12,7 +12,6 @@ #include #include #include -#include #include #include "entityx/Entity.h" diff --git a/entityx/Event_test.cc b/entityx/Event_test.cc index 91bdd16..4c16c32 100644 --- a/entityx/Event_test.cc +++ b/entityx/Event_test.cc @@ -10,7 +10,6 @@ #include #include -#include #include #include "entityx/Event.h" diff --git a/entityx/System.h b/entityx/System.h index f1803b1..962fd29 100644 --- a/entityx/System.h +++ b/entityx/System.h @@ -12,10 +12,10 @@ #include +#include #include #include #include -#include #include "entityx/Entity.h" #include "entityx/Event.h" @@ -115,7 +115,7 @@ class SystemManager : boost::noncopyable { template boost::shared_ptr system() { auto it = systems_.find(S::family()); - CHECK(it != systems_.end()); + assert(it != systems_.end()); return it == systems_.end() ? boost::shared_ptr() : boost::static_pointer_cast(it->second); @@ -126,7 +126,7 @@ class SystemManager : boost::noncopyable { */ template void update(double dt) { - CHECK(initialized_) << "SystemManager::configure() not called"; + assert(initialized_ && "SystemManager::configure() not called"); boost::shared_ptr s = system(); s->update(entities_, events_, dt); } diff --git a/entityx/System_test.cc b/entityx/System_test.cc index 85b08da..c4648a0 100644 --- a/entityx/System_test.cc +++ b/entityx/System_test.cc @@ -10,7 +10,6 @@ #include #include -#include #include #include "entityx/Manager.h" #include "entityx/System.h" diff --git a/gtest-1.6.0/src/gtest-internal-inl.h b/gtest-1.6.0/src/gtest-internal-inl.h index 65a2101..6554cfc 100644 --- a/gtest-1.6.0/src/gtest-internal-inl.h +++ b/gtest-1.6.0/src/gtest-internal-inl.h @@ -203,7 +203,6 @@ class GTestFlagSaver { bool list_tests_; String output_; bool print_time_; - bool pretty_; internal::Int32 random_seed_; internal::Int32 repeat_; bool shuffle_; -- cgit v1.2.3