From e88636d40577776db26d34d8adacddbba5bd6da8 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Fri, 19 Oct 2012 14:48:55 -0400 Subject: A bunch of minor build fixes. Started README. --- .clang_complete | 2 + .gitignore | 1 + CMakeLists.txt | 94 +++-- CheckCXX11Features.cmake | 8 +- Makefile | 407 --------------------- README.md | 2 + c++11/c++11-test-__func__-N2340.cpp | 8 - c++11/c++11-test-auto-N2546.cpp | 12 - c++11/c++11-test-constexpr-N2235.cpp | 19 - c++11/c++11-test-cstdint.cpp | 10 - c++11/c++11-test-decltype-N2343.cpp | 11 - c++11/c++11-test-lambda-N2927.cpp | 5 - c++11/c++11-test-long_long-N1811.cpp | 7 - c++11/c++11-test-nullptr-N2431.cpp | 5 - c++11/c++11-test-nullptr-N2431_fail_compile.cpp | 5 - c++11/c++11-test-rvalue_references-N2118.cpp | 15 - c++11/c++11-test-sizeof_member-N2253.cpp | 14 - c++11/c++11-test-static_assert-N1720.cpp | 5 - ...c++11-test-static_assert-N1720_fail_compile.cpp | 5 - c++11/c++11-test-variadic_templates-N2555.cpp | 23 -- c++11/demo.cpp | 23 -- cxx11/c++11-test-__func__-N2340.cpp | 8 + cxx11/c++11-test-auto-N2546.cpp | 12 + cxx11/c++11-test-constexpr-N2235.cpp | 19 + cxx11/c++11-test-cstdint.cpp | 10 + cxx11/c++11-test-decltype-N2343.cpp | 11 + cxx11/c++11-test-lambda-N2927.cpp | 5 + cxx11/c++11-test-long_long-N1811.cpp | 7 + cxx11/c++11-test-nullptr-N2431.cpp | 5 + cxx11/c++11-test-nullptr-N2431_fail_compile.cpp | 5 + cxx11/c++11-test-rvalue_references-N2118.cpp | 15 + cxx11/c++11-test-sizeof_member-N2253.cpp | 14 + cxx11/c++11-test-static_assert-N1720.cpp | 5 + ...c++11-test-static_assert-N1720_fail_compile.cpp | 5 + cxx11/c++11-test-variadic_templates-N2555.cpp | 23 ++ cxx11/demo.cpp | 23 ++ entityx/Entity.h | 2 +- entityx/Event.h | 4 +- entityx/System.h | 2 +- 39 files changed, 238 insertions(+), 618 deletions(-) create mode 100644 .clang_complete delete mode 100644 Makefile create mode 100644 README.md delete mode 100644 c++11/c++11-test-__func__-N2340.cpp delete mode 100644 c++11/c++11-test-auto-N2546.cpp delete mode 100644 c++11/c++11-test-constexpr-N2235.cpp delete mode 100644 c++11/c++11-test-cstdint.cpp delete mode 100644 c++11/c++11-test-decltype-N2343.cpp delete mode 100644 c++11/c++11-test-lambda-N2927.cpp delete mode 100644 c++11/c++11-test-long_long-N1811.cpp delete mode 100644 c++11/c++11-test-nullptr-N2431.cpp delete mode 100644 c++11/c++11-test-nullptr-N2431_fail_compile.cpp delete mode 100644 c++11/c++11-test-rvalue_references-N2118.cpp delete mode 100644 c++11/c++11-test-sizeof_member-N2253.cpp delete mode 100644 c++11/c++11-test-static_assert-N1720.cpp delete mode 100644 c++11/c++11-test-static_assert-N1720_fail_compile.cpp delete mode 100644 c++11/c++11-test-variadic_templates-N2555.cpp delete mode 100644 c++11/demo.cpp create mode 100644 cxx11/c++11-test-__func__-N2340.cpp create mode 100644 cxx11/c++11-test-auto-N2546.cpp create mode 100644 cxx11/c++11-test-constexpr-N2235.cpp create mode 100644 cxx11/c++11-test-cstdint.cpp create mode 100644 cxx11/c++11-test-decltype-N2343.cpp create mode 100644 cxx11/c++11-test-lambda-N2927.cpp create mode 100644 cxx11/c++11-test-long_long-N1811.cpp create mode 100644 cxx11/c++11-test-nullptr-N2431.cpp create mode 100644 cxx11/c++11-test-nullptr-N2431_fail_compile.cpp create mode 100644 cxx11/c++11-test-rvalue_references-N2118.cpp create mode 100644 cxx11/c++11-test-sizeof_member-N2253.cpp create mode 100644 cxx11/c++11-test-static_assert-N1720.cpp create mode 100644 cxx11/c++11-test-static_assert-N1720_fail_compile.cpp create mode 100644 cxx11/c++11-test-variadic_templates-N2555.cpp create mode 100644 cxx11/demo.cpp diff --git a/.clang_complete b/.clang_complete new file mode 100644 index 0000000..492390d --- /dev/null +++ b/.clang_complete @@ -0,0 +1,2 @@ +-std=c++11 +-I. diff --git a/.gitignore b/.gitignore index dc667ff..f08d8e3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.a *.so *.o +build/* diff --git a/CMakeLists.txt b/CMakeLists.txt index 8075f23..f868d34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,61 +1,81 @@ cmake_minimum_required(VERSION 2.8) project(EntityX) -include_directories(. ./c++11) +include_directories(${CMAKE_CURRENT_LIST_DIR}) +include(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake) # C++11 feature checks include(CheckCXX11Features.cmake) +# Misc features +CHECK_INCLUDE_FILE("stdint.h" CMAKE_HAVE_STDINT_H) -MACRO(REQUIRE FEATURE_NAME MESSAGE_STRING) - if (NOT DEFINED ${FEATURE_NAME}) - message(FATAL_ERROR ${MESSAGE_STRING}) +macro(require FEATURE_NAME MESSAGE_STRING) + if (NOT ${${FEATURE_NAME}}) + message(FATAL_ERROR "${MESSAGE_STRING} required -- ${${FEATURE_NAME}}") + else() + message("-- ${MESSAGE_STRING} found") endif() -ENDMACRO(REQUIRE) +endmacro(require) -require(HAS_CXX11_AUTO "C++11 auto support is required") -require(HAS_CXX11_NULLPTR "C++11 nullptr support is required") -require(HAS_CXX11_RVALUE_REFERENCES "C++11 rvalue reference support is required") -require(HAS_CXX11_CSTDINT_H "C++11 stdint support is required") -require(HAS_CXX11_VARIADIC_TEMPLATES "C++11 variadic templates required") +macro(create_test TARGET_NAME SOURCE) + add_executable(${TARGET_NAME} ${SOURCE}) + target_link_libraries( + ${TARGET_NAME} + entityx + glog + ${Boost_LIBRARIES} + ${GTEST_BOTH_LIBRARIES} + ) + add_test(${TARGET_NAME} ${TARGET_NAME}) +endmacro() + +message("-- Checking C++ features") +require(HAS_CXX11_AUTO "C++11 auto support") +require(HAS_CXX11_NULLPTR "C++11 nullptr support") +require(HAS_CXX11_RVALUE_REFERENCES "C++11 rvalue reference support") +#require(HAS_CXX11_CSTDINT_H "C++11 stdint support") +require(HAS_CXX11_VARIADIC_TEMPLATES "C++11 variadic templates") +require(HAS_CXX11_RVALUE_REFERENCES "C++11 rvalue references") + +message("-- Checking misc features") +require(CMAKE_HAVE_STDINT_H "stdint.h") enable_testing() find_package(GTest REQUIRED) set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) -#find_package(Boost REQUIRED COMPONENTS) -find_package(Boost 1.36.0 REQUIRED COMPONENTS signals) - -set(CMAKE_CXX_FLAGS "-ansi -pedantic -Werror -Wall -Wextra -Wno-unused-parameter -Wno-error=unused-variable -std=c++11") -set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") -set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") -set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") +find_package(Boost 1.48.0 REQUIRED COMPONENTS signals) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Werror -Wall -Wextra -Wno-unused-parameter -Wno-error=unused-variable -std=c++11") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g") +set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g") -include_directories( - ${Boost_INCLUDE_DIR} - ${GTest_INCLUDE_DIR} - ) -add_executable( - entityx_test - entityx/Components_test.cc - entityx/Entity_test.cc - entityx/Event_test.cc - entityx/System_test.cc - ) -target_link_libraries( - entityx_test - entityx - glog - ${Boost_LIBRARIES} - ${GTEST_BOTH_LIBRARIES} - ) -add_test(AllTestsInentityx_test entityx_test) add_library( entityx + STATIC SHARED entityx/Components.cc entityx/System.cc entityx/Event.cc entityx/Entity.cc entityx/World.cc ) + +include_directories( + ${Boost_INCLUDE_DIR} + ${GTest_INCLUDE_DIR} + ) + +create_test(entity_test entityx/Entity_test.cc) +create_test(component_test entityx/Components_test.cc) +create_test(event_test entityx/Event_test.cc) +create_test(system_test entityx/System_test.cc) + +file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/entityx/*.h") +install(FILES ${headers} DESTINATION "include/entityx") + +install(TARGETS entityx + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/CheckCXX11Features.cmake b/CheckCXX11Features.cmake index fc1243f..80e684d 100644 --- a/CheckCXX11Features.cmake +++ b/CheckCXX11Features.cmake @@ -21,17 +21,19 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3) SET(CHECK_CXX11_OLD_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_CXX_FLAGS "-std=c++0x") -endif() +ELSE("${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" MATCHES ".*clang") + SET(CMAKE_CXX_FLAGS "-std=c++11") +ENDIF() MACRO(CXX11_CHECK_FEATURE FEATURE_NAME FEATURE_NUMBER RESULT_VAR) IF (NOT DEFINED ${RESULT_VAR}) SET(_bindir "${CMAKE_CURRENT_BINARY_DIR}/cxx11/cxx11_${FEATURE_NAME}") IF (${FEATURE_NUMBER}) - SET(_SRCFILE_BASE ${CMAKE_CURRENT_LIST_DIR}/c++11-test-${FEATURE_NAME}-N${FEATURE_NUMBER}) + SET(_SRCFILE_BASE ${CMAKE_CURRENT_LIST_DIR}/cxx11/c++11-test-${FEATURE_NAME}-N${FEATURE_NUMBER}) SET(_LOG_NAME "\"${FEATURE_NAME}\" (N${FEATURE_NUMBER})") ELSE (${FEATURE_NUMBER}) - SET(_SRCFILE_BASE ${CMAKE_CURRENT_LIST_DIR}/c++11-test-${FEATURE_NAME}) + SET(_SRCFILE_BASE ${CMAKE_CURRENT_LIST_DIR}/cxx11/c++11-test-${FEATURE_NAME}) SET(_LOG_NAME "\"${FEATURE_NAME}\"") ENDIF (${FEATURE_NUMBER}) MESSAGE(STATUS "Checking C++11 support for ${_LOG_NAME}") diff --git a/Makefile b/Makefile deleted file mode 100644 index be258b2..0000000 --- a/Makefile +++ /dev/null @@ -1,407 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 2.8 - -# Default target executed when no arguments are given to make. -default_target: all -.PHONY : default_target - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/local/Cellar/cmake/2.8.9/bin/cmake - -# The command to remove a file. -RM = /usr/local/Cellar/cmake/2.8.9/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The program to use to edit the cache. -CMAKE_EDIT_COMMAND = /usr/local/Cellar/cmake/2.8.9/bin/ccmake - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /Users/alec/Projects/entityx - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /Users/alec/Projects/entityx - -#============================================================================= -# Targets provided globally by CMake. - -# Special rule for the target edit_cache -edit_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." - /usr/local/Cellar/cmake/2.8.9/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : edit_cache - -# Special rule for the target edit_cache -edit_cache/fast: edit_cache -.PHONY : edit_cache/fast - -# Special rule for the target rebuild_cache -rebuild_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." - /usr/local/Cellar/cmake/2.8.9/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : rebuild_cache - -# Special rule for the target rebuild_cache -rebuild_cache/fast: rebuild_cache -.PHONY : rebuild_cache/fast - -# Special rule for the target test -test: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..." - /usr/local/Cellar/cmake/2.8.9/bin/ctest --force-new-ctest-process $(ARGS) -.PHONY : test - -# Special rule for the target test -test/fast: test -.PHONY : test/fast - -# The main all target -all: cmake_check_build_system - $(CMAKE_COMMAND) -E cmake_progress_start /Users/alec/Projects/entityx/CMakeFiles /Users/alec/Projects/entityx/CMakeFiles/progress.marks - $(MAKE) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /Users/alec/Projects/entityx/CMakeFiles 0 -.PHONY : all - -# The main clean target -clean: - $(MAKE) -f CMakeFiles/Makefile2 clean -.PHONY : clean - -# The main clean target -clean/fast: clean -.PHONY : clean/fast - -# Prepare targets for installation. -preinstall: all - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall - -# Prepare targets for installation. -preinstall/fast: - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall/fast - -# clear depends -depend: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 -.PHONY : depend - -#============================================================================= -# Target rules for targets named entityx - -# Build rule for target. -entityx: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 entityx -.PHONY : entityx - -# fast build rule for target. -entityx/fast: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/build -.PHONY : entityx/fast - -#============================================================================= -# Target rules for targets named entityx_test - -# Build rule for target. -entityx_test: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 entityx_test -.PHONY : entityx_test - -# fast build rule for target. -entityx_test/fast: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/build -.PHONY : entityx_test/fast - -entityx/Components.o: entityx/Components.cc.o -.PHONY : entityx/Components.o - -# target to build an object file -entityx/Components.cc.o: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/Components.cc.o -.PHONY : entityx/Components.cc.o - -entityx/Components.i: entityx/Components.cc.i -.PHONY : entityx/Components.i - -# target to preprocess a source file -entityx/Components.cc.i: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/Components.cc.i -.PHONY : entityx/Components.cc.i - -entityx/Components.s: entityx/Components.cc.s -.PHONY : entityx/Components.s - -# target to generate assembly for a file -entityx/Components.cc.s: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/Components.cc.s -.PHONY : entityx/Components.cc.s - -entityx/Components_test.o: entityx/Components_test.cc.o -.PHONY : entityx/Components_test.o - -# target to build an object file -entityx/Components_test.cc.o: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/Components_test.cc.o -.PHONY : entityx/Components_test.cc.o - -entityx/Components_test.i: entityx/Components_test.cc.i -.PHONY : entityx/Components_test.i - -# target to preprocess a source file -entityx/Components_test.cc.i: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/Components_test.cc.i -.PHONY : entityx/Components_test.cc.i - -entityx/Components_test.s: entityx/Components_test.cc.s -.PHONY : entityx/Components_test.s - -# target to generate assembly for a file -entityx/Components_test.cc.s: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/Components_test.cc.s -.PHONY : entityx/Components_test.cc.s - -entityx/Entity.o: entityx/Entity.cc.o -.PHONY : entityx/Entity.o - -# target to build an object file -entityx/Entity.cc.o: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/Entity.cc.o -.PHONY : entityx/Entity.cc.o - -entityx/Entity.i: entityx/Entity.cc.i -.PHONY : entityx/Entity.i - -# target to preprocess a source file -entityx/Entity.cc.i: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/Entity.cc.i -.PHONY : entityx/Entity.cc.i - -entityx/Entity.s: entityx/Entity.cc.s -.PHONY : entityx/Entity.s - -# target to generate assembly for a file -entityx/Entity.cc.s: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/Entity.cc.s -.PHONY : entityx/Entity.cc.s - -entityx/Entity_test.o: entityx/Entity_test.cc.o -.PHONY : entityx/Entity_test.o - -# target to build an object file -entityx/Entity_test.cc.o: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/Entity_test.cc.o -.PHONY : entityx/Entity_test.cc.o - -entityx/Entity_test.i: entityx/Entity_test.cc.i -.PHONY : entityx/Entity_test.i - -# target to preprocess a source file -entityx/Entity_test.cc.i: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/Entity_test.cc.i -.PHONY : entityx/Entity_test.cc.i - -entityx/Entity_test.s: entityx/Entity_test.cc.s -.PHONY : entityx/Entity_test.s - -# target to generate assembly for a file -entityx/Entity_test.cc.s: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/Entity_test.cc.s -.PHONY : entityx/Entity_test.cc.s - -entityx/Event.o: entityx/Event.cc.o -.PHONY : entityx/Event.o - -# target to build an object file -entityx/Event.cc.o: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/Event.cc.o -.PHONY : entityx/Event.cc.o - -entityx/Event.i: entityx/Event.cc.i -.PHONY : entityx/Event.i - -# target to preprocess a source file -entityx/Event.cc.i: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/Event.cc.i -.PHONY : entityx/Event.cc.i - -entityx/Event.s: entityx/Event.cc.s -.PHONY : entityx/Event.s - -# target to generate assembly for a file -entityx/Event.cc.s: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/Event.cc.s -.PHONY : entityx/Event.cc.s - -entityx/Event_test.o: entityx/Event_test.cc.o -.PHONY : entityx/Event_test.o - -# target to build an object file -entityx/Event_test.cc.o: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/Event_test.cc.o -.PHONY : entityx/Event_test.cc.o - -entityx/Event_test.i: entityx/Event_test.cc.i -.PHONY : entityx/Event_test.i - -# target to preprocess a source file -entityx/Event_test.cc.i: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/Event_test.cc.i -.PHONY : entityx/Event_test.cc.i - -entityx/Event_test.s: entityx/Event_test.cc.s -.PHONY : entityx/Event_test.s - -# target to generate assembly for a file -entityx/Event_test.cc.s: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/Event_test.cc.s -.PHONY : entityx/Event_test.cc.s - -entityx/System.o: entityx/System.cc.o -.PHONY : entityx/System.o - -# target to build an object file -entityx/System.cc.o: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/System.cc.o -.PHONY : entityx/System.cc.o - -entityx/System.i: entityx/System.cc.i -.PHONY : entityx/System.i - -# target to preprocess a source file -entityx/System.cc.i: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/System.cc.i -.PHONY : entityx/System.cc.i - -entityx/System.s: entityx/System.cc.s -.PHONY : entityx/System.s - -# target to generate assembly for a file -entityx/System.cc.s: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/System.cc.s -.PHONY : entityx/System.cc.s - -entityx/System_test.o: entityx/System_test.cc.o -.PHONY : entityx/System_test.o - -# target to build an object file -entityx/System_test.cc.o: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/System_test.cc.o -.PHONY : entityx/System_test.cc.o - -entityx/System_test.i: entityx/System_test.cc.i -.PHONY : entityx/System_test.i - -# target to preprocess a source file -entityx/System_test.cc.i: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/System_test.cc.i -.PHONY : entityx/System_test.cc.i - -entityx/System_test.s: entityx/System_test.cc.s -.PHONY : entityx/System_test.s - -# target to generate assembly for a file -entityx/System_test.cc.s: - $(MAKE) -f CMakeFiles/entityx_test.dir/build.make CMakeFiles/entityx_test.dir/entityx/System_test.cc.s -.PHONY : entityx/System_test.cc.s - -entityx/World.o: entityx/World.cc.o -.PHONY : entityx/World.o - -# target to build an object file -entityx/World.cc.o: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/World.cc.o -.PHONY : entityx/World.cc.o - -entityx/World.i: entityx/World.cc.i -.PHONY : entityx/World.i - -# target to preprocess a source file -entityx/World.cc.i: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/World.cc.i -.PHONY : entityx/World.cc.i - -entityx/World.s: entityx/World.cc.s -.PHONY : entityx/World.s - -# target to generate assembly for a file -entityx/World.cc.s: - $(MAKE) -f CMakeFiles/entityx.dir/build.make CMakeFiles/entityx.dir/entityx/World.cc.s -.PHONY : entityx/World.cc.s - -# Help Target -help: - @echo "The following are some of the valid targets for this Makefile:" - @echo "... all (the default if no target is provided)" - @echo "... clean" - @echo "... depend" - @echo "... edit_cache" - @echo "... entityx" - @echo "... entityx_test" - @echo "... rebuild_cache" - @echo "... test" - @echo "... entityx/Components.o" - @echo "... entityx/Components.i" - @echo "... entityx/Components.s" - @echo "... entityx/Components_test.o" - @echo "... entityx/Components_test.i" - @echo "... entityx/Components_test.s" - @echo "... entityx/Entity.o" - @echo "... entityx/Entity.i" - @echo "... entityx/Entity.s" - @echo "... entityx/Entity_test.o" - @echo "... entityx/Entity_test.i" - @echo "... entityx/Entity_test.s" - @echo "... entityx/Event.o" - @echo "... entityx/Event.i" - @echo "... entityx/Event.s" - @echo "... entityx/Event_test.o" - @echo "... entityx/Event_test.i" - @echo "... entityx/Event_test.s" - @echo "... entityx/System.o" - @echo "... entityx/System.i" - @echo "... entityx/System.s" - @echo "... entityx/System_test.o" - @echo "... entityx/System_test.i" - @echo "... entityx/System_test.s" - @echo "... entityx/World.o" - @echo "... entityx/World.i" - @echo "... entityx/World.s" -.PHONY : help - - - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system - diff --git a/README.md b/README.md new file mode 100644 index 0000000..6f2bdb3 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# EntityX - A C++ Entity Component System + diff --git a/c++11/c++11-test-__func__-N2340.cpp b/c++11/c++11-test-__func__-N2340.cpp deleted file mode 100644 index c10dd18..0000000 --- a/c++11/c++11-test-__func__-N2340.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int main() -{ - if (!__func__) { return 1; } - if(std::strlen(__func__) <= 0) { return 1; } - return 0; -} diff --git a/c++11/c++11-test-auto-N2546.cpp b/c++11/c++11-test-auto-N2546.cpp deleted file mode 100644 index dbff414..0000000 --- a/c++11/c++11-test-auto-N2546.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -int main() -{ - auto i = 5; - auto f = 3.14159f; - auto d = 3.14159; - bool ret = ( - (sizeof(f) < sizeof(d)) && - (sizeof(i) == sizeof(int)) - ); - return ret ? 0 : 1; -} diff --git a/c++11/c++11-test-constexpr-N2235.cpp b/c++11/c++11-test-constexpr-N2235.cpp deleted file mode 100644 index 9f969e4..0000000 --- a/c++11/c++11-test-constexpr-N2235.cpp +++ /dev/null @@ -1,19 +0,0 @@ -constexpr int square(int x) -{ - return x*x; -} - -constexpr int the_answer() -{ - return 42; -} - -int main() -{ - int test_arr[square(3)]; - bool ret = ( - (square(the_answer()) == 1764) && - (sizeof(test_arr)/sizeof(test_arr[0]) == 9) - ); - return ret ? 0 : 1; -} diff --git a/c++11/c++11-test-cstdint.cpp b/c++11/c++11-test-cstdint.cpp deleted file mode 100644 index 58d4381..0000000 --- a/c++11/c++11-test-cstdint.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -int main() -{ - bool test = - (sizeof(int8_t) == 1) && - (sizeof(int16_t) == 2) && - (sizeof(int32_t) == 4) && - (sizeof(int64_t) == 8); - return test ? 0 : 1; -} diff --git a/c++11/c++11-test-decltype-N2343.cpp b/c++11/c++11-test-decltype-N2343.cpp deleted file mode 100644 index d023885..0000000 --- a/c++11/c++11-test-decltype-N2343.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -bool check_size(int i) -{ - return sizeof(int) == sizeof(decltype(i)); -} - -int main() -{ - bool ret = check_size(42); - return ret ? 0 : 1; -} diff --git a/c++11/c++11-test-lambda-N2927.cpp b/c++11/c++11-test-lambda-N2927.cpp deleted file mode 100644 index b86ad17..0000000 --- a/c++11/c++11-test-lambda-N2927.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int main() -{ - int ret = 0; - return ([&ret]() -> int { return ret; })(); -} diff --git a/c++11/c++11-test-long_long-N1811.cpp b/c++11/c++11-test-long_long-N1811.cpp deleted file mode 100644 index 2ae6988..0000000 --- a/c++11/c++11-test-long_long-N1811.cpp +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) -{ - long long l; - unsigned long long ul; - - return ((sizeof(l) >= 8) && (sizeof(ul) >= 8)) ? 0 : 1; -} diff --git a/c++11/c++11-test-nullptr-N2431.cpp b/c++11/c++11-test-nullptr-N2431.cpp deleted file mode 100644 index 6c5ae66..0000000 --- a/c++11/c++11-test-nullptr-N2431.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int main() -{ - int* test = nullptr; - return test ? 1 : 0; -} diff --git a/c++11/c++11-test-nullptr-N2431_fail_compile.cpp b/c++11/c++11-test-nullptr-N2431_fail_compile.cpp deleted file mode 100644 index 5747f1b..0000000 --- a/c++11/c++11-test-nullptr-N2431_fail_compile.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int main() -{ - int i = nullptr; - return 1; -} diff --git a/c++11/c++11-test-rvalue_references-N2118.cpp b/c++11/c++11-test-rvalue_references-N2118.cpp deleted file mode 100644 index ef4e421..0000000 --- a/c++11/c++11-test-rvalue_references-N2118.cpp +++ /dev/null @@ -1,15 +0,0 @@ -int foo(int& lvalue) -{ - return 123; -} - -int foo(int&& rvalue) -{ - return 321; -} - -int main() -{ - int i = 42; - return ((foo(i) == 123) && (foo(42) == 321)) ? 0 : 1; -} diff --git a/c++11/c++11-test-sizeof_member-N2253.cpp b/c++11/c++11-test-sizeof_member-N2253.cpp deleted file mode 100644 index 3049ed1..0000000 --- a/c++11/c++11-test-sizeof_member-N2253.cpp +++ /dev/null @@ -1,14 +0,0 @@ -struct foo { - char bar; - int baz; -}; - -int main(void) -{ - bool ret = ( - (sizeof(foo::bar) == 1) && - (sizeof(foo::baz) >= sizeof(foo::bar)) && - (sizeof(foo) >= sizeof(foo::bar)+sizeof(foo::baz)) - ); - return ret ? 0 : 1; -} diff --git a/c++11/c++11-test-static_assert-N1720.cpp b/c++11/c++11-test-static_assert-N1720.cpp deleted file mode 100644 index eae3c9a..0000000 --- a/c++11/c++11-test-static_assert-N1720.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int main() -{ - static_assert(0 < 1, "your ordering of integers is screwed"); - return 0; -} diff --git a/c++11/c++11-test-static_assert-N1720_fail_compile.cpp b/c++11/c++11-test-static_assert-N1720_fail_compile.cpp deleted file mode 100644 index d97b679..0000000 --- a/c++11/c++11-test-static_assert-N1720_fail_compile.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int main() -{ - static_assert(1 < 0, "this should fail"); - return 0; -} diff --git a/c++11/c++11-test-variadic_templates-N2555.cpp b/c++11/c++11-test-variadic_templates-N2555.cpp deleted file mode 100644 index 79fae84..0000000 --- a/c++11/c++11-test-variadic_templates-N2555.cpp +++ /dev/null @@ -1,23 +0,0 @@ -int Accumulate() -{ - return 0; -} - -template -int Accumulate(T v, Ts... vs) -{ - return v + Accumulate(vs...); -} - -template -int CountElements() -{ - return sizeof...(Is); -} - -int main() -{ - int acc = Accumulate(1, 2, 3, 4, -5); - int count = CountElements<1,2,3,4,5>(); - return ((acc == 5) && (count == 5)) ? 0 : 1; -} diff --git a/c++11/demo.cpp b/c++11/demo.cpp deleted file mode 100644 index 782681b..0000000 --- a/c++11/demo.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -#include - -int main() -{ - std::cout << "Testing\n"; - std::cout << "Has static_assert: " << -#ifdef HAS_CXX11_STATIC_ASSERT - "yes :)" -#else - "no" -#endif - << "\n"; - std::cout << "Has variadic templates: " << -#ifdef HAS_CXX11_VARIADIC_TEMPLATES - "yes :)" -#else - "no" -#endif - << "\n"; - return 0; -} - diff --git a/cxx11/c++11-test-__func__-N2340.cpp b/cxx11/c++11-test-__func__-N2340.cpp new file mode 100644 index 0000000..c10dd18 --- /dev/null +++ b/cxx11/c++11-test-__func__-N2340.cpp @@ -0,0 +1,8 @@ +#include + +int main() +{ + if (!__func__) { return 1; } + if(std::strlen(__func__) <= 0) { return 1; } + return 0; +} diff --git a/cxx11/c++11-test-auto-N2546.cpp b/cxx11/c++11-test-auto-N2546.cpp new file mode 100644 index 0000000..dbff414 --- /dev/null +++ b/cxx11/c++11-test-auto-N2546.cpp @@ -0,0 +1,12 @@ + +int main() +{ + auto i = 5; + auto f = 3.14159f; + auto d = 3.14159; + bool ret = ( + (sizeof(f) < sizeof(d)) && + (sizeof(i) == sizeof(int)) + ); + return ret ? 0 : 1; +} diff --git a/cxx11/c++11-test-constexpr-N2235.cpp b/cxx11/c++11-test-constexpr-N2235.cpp new file mode 100644 index 0000000..9f969e4 --- /dev/null +++ b/cxx11/c++11-test-constexpr-N2235.cpp @@ -0,0 +1,19 @@ +constexpr int square(int x) +{ + return x*x; +} + +constexpr int the_answer() +{ + return 42; +} + +int main() +{ + int test_arr[square(3)]; + bool ret = ( + (square(the_answer()) == 1764) && + (sizeof(test_arr)/sizeof(test_arr[0]) == 9) + ); + return ret ? 0 : 1; +} diff --git a/cxx11/c++11-test-cstdint.cpp b/cxx11/c++11-test-cstdint.cpp new file mode 100644 index 0000000..58d4381 --- /dev/null +++ b/cxx11/c++11-test-cstdint.cpp @@ -0,0 +1,10 @@ +#include +int main() +{ + bool test = + (sizeof(int8_t) == 1) && + (sizeof(int16_t) == 2) && + (sizeof(int32_t) == 4) && + (sizeof(int64_t) == 8); + return test ? 0 : 1; +} diff --git a/cxx11/c++11-test-decltype-N2343.cpp b/cxx11/c++11-test-decltype-N2343.cpp new file mode 100644 index 0000000..d023885 --- /dev/null +++ b/cxx11/c++11-test-decltype-N2343.cpp @@ -0,0 +1,11 @@ + +bool check_size(int i) +{ + return sizeof(int) == sizeof(decltype(i)); +} + +int main() +{ + bool ret = check_size(42); + return ret ? 0 : 1; +} diff --git a/cxx11/c++11-test-lambda-N2927.cpp b/cxx11/c++11-test-lambda-N2927.cpp new file mode 100644 index 0000000..b86ad17 --- /dev/null +++ b/cxx11/c++11-test-lambda-N2927.cpp @@ -0,0 +1,5 @@ +int main() +{ + int ret = 0; + return ([&ret]() -> int { return ret; })(); +} diff --git a/cxx11/c++11-test-long_long-N1811.cpp b/cxx11/c++11-test-long_long-N1811.cpp new file mode 100644 index 0000000..2ae6988 --- /dev/null +++ b/cxx11/c++11-test-long_long-N1811.cpp @@ -0,0 +1,7 @@ +int main(void) +{ + long long l; + unsigned long long ul; + + return ((sizeof(l) >= 8) && (sizeof(ul) >= 8)) ? 0 : 1; +} diff --git a/cxx11/c++11-test-nullptr-N2431.cpp b/cxx11/c++11-test-nullptr-N2431.cpp new file mode 100644 index 0000000..6c5ae66 --- /dev/null +++ b/cxx11/c++11-test-nullptr-N2431.cpp @@ -0,0 +1,5 @@ +int main() +{ + int* test = nullptr; + return test ? 1 : 0; +} diff --git a/cxx11/c++11-test-nullptr-N2431_fail_compile.cpp b/cxx11/c++11-test-nullptr-N2431_fail_compile.cpp new file mode 100644 index 0000000..5747f1b --- /dev/null +++ b/cxx11/c++11-test-nullptr-N2431_fail_compile.cpp @@ -0,0 +1,5 @@ +int main() +{ + int i = nullptr; + return 1; +} diff --git a/cxx11/c++11-test-rvalue_references-N2118.cpp b/cxx11/c++11-test-rvalue_references-N2118.cpp new file mode 100644 index 0000000..ef4e421 --- /dev/null +++ b/cxx11/c++11-test-rvalue_references-N2118.cpp @@ -0,0 +1,15 @@ +int foo(int& lvalue) +{ + return 123; +} + +int foo(int&& rvalue) +{ + return 321; +} + +int main() +{ + int i = 42; + return ((foo(i) == 123) && (foo(42) == 321)) ? 0 : 1; +} diff --git a/cxx11/c++11-test-sizeof_member-N2253.cpp b/cxx11/c++11-test-sizeof_member-N2253.cpp new file mode 100644 index 0000000..3049ed1 --- /dev/null +++ b/cxx11/c++11-test-sizeof_member-N2253.cpp @@ -0,0 +1,14 @@ +struct foo { + char bar; + int baz; +}; + +int main(void) +{ + bool ret = ( + (sizeof(foo::bar) == 1) && + (sizeof(foo::baz) >= sizeof(foo::bar)) && + (sizeof(foo) >= sizeof(foo::bar)+sizeof(foo::baz)) + ); + return ret ? 0 : 1; +} diff --git a/cxx11/c++11-test-static_assert-N1720.cpp b/cxx11/c++11-test-static_assert-N1720.cpp new file mode 100644 index 0000000..eae3c9a --- /dev/null +++ b/cxx11/c++11-test-static_assert-N1720.cpp @@ -0,0 +1,5 @@ +int main() +{ + static_assert(0 < 1, "your ordering of integers is screwed"); + return 0; +} diff --git a/cxx11/c++11-test-static_assert-N1720_fail_compile.cpp b/cxx11/c++11-test-static_assert-N1720_fail_compile.cpp new file mode 100644 index 0000000..d97b679 --- /dev/null +++ b/cxx11/c++11-test-static_assert-N1720_fail_compile.cpp @@ -0,0 +1,5 @@ +int main() +{ + static_assert(1 < 0, "this should fail"); + return 0; +} diff --git a/cxx11/c++11-test-variadic_templates-N2555.cpp b/cxx11/c++11-test-variadic_templates-N2555.cpp new file mode 100644 index 0000000..79fae84 --- /dev/null +++ b/cxx11/c++11-test-variadic_templates-N2555.cpp @@ -0,0 +1,23 @@ +int Accumulate() +{ + return 0; +} + +template +int Accumulate(T v, Ts... vs) +{ + return v + Accumulate(vs...); +} + +template +int CountElements() +{ + return sizeof...(Is); +} + +int main() +{ + int acc = Accumulate(1, 2, 3, 4, -5); + int count = CountElements<1,2,3,4,5>(); + return ((acc == 5) && (count == 5)) ? 0 : 1; +} diff --git a/cxx11/demo.cpp b/cxx11/demo.cpp new file mode 100644 index 0000000..782681b --- /dev/null +++ b/cxx11/demo.cpp @@ -0,0 +1,23 @@ + +#include + +int main() +{ + std::cout << "Testing\n"; + std::cout << "Has static_assert: " << +#ifdef HAS_CXX11_STATIC_ASSERT + "yes :)" +#else + "no" +#endif + << "\n"; + std::cout << "Has variadic templates: " << +#ifdef HAS_CXX11_VARIADIC_TEMPLATES + "yes :)" +#else + "no" +#endif + << "\n"; + return 0; +} + diff --git a/entityx/Entity.h b/entityx/Entity.h index e832c15..e7763bb 100644 --- a/entityx/Entity.h +++ b/entityx/Entity.h @@ -11,7 +11,7 @@ #pragma once -#include +#include #include #include #include diff --git a/entityx/Event.h b/entityx/Event.h index 510da8f..ac6a632 100644 --- a/entityx/Event.h +++ b/entityx/Event.h @@ -10,7 +10,7 @@ #pragma once -#include +#include #include #include #include @@ -139,7 +139,7 @@ class EventManager : boost::noncopyable { return it->second; } - // Functor used as a event signal callback that casts to E. + // Functor used as an event signal callback that casts to E. template struct EventCallbackWrapper { EventCallbackWrapper(boost::function callback) : callback(callback) {} diff --git a/entityx/System.h b/entityx/System.h index ad6a9ba..c2cead9 100644 --- a/entityx/System.h +++ b/entityx/System.h @@ -11,7 +11,7 @@ #pragma once -#include +#include #include #include #include -- cgit v1.2.3