From 3902e00a0f6a27a6e01d81386fd017ca4e4bdee2 Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Fri, 23 Nov 2012 11:45:13 +0000 Subject: [PATCH] Add a CompilerCapabilities.h.in file which is filled in by CMake It will #define a each of the basic features detected by CMake which can then be used by other headers (like TypeDef.h) to set things up for PolyVox. It is this file which you will have to manually edit and rename if you want to skip using CMake. --- examples/Basic/CMakeLists.txt | 2 +- examples/OpenGL/CMakeLists.txt | 2 +- examples/Paging/CMakeLists.txt | 2 +- examples/SmoothLOD/CMakeLists.txt | 2 +- library/PolyVoxCore/CMakeLists.txt | 5 ++++- .../include/PolyVoxCore/Impl/CompilerCapabilities.h.in | 6 ++++++ library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h | 2 ++ library/PolyVoxUtil/CMakeLists.txt | 2 +- library/bindings/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- 10 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 library/PolyVoxCore/include/PolyVoxCore/Impl/CompilerCapabilities.h.in diff --git a/examples/Basic/CMakeLists.txt b/examples/Basic/CMakeLists.txt index a17c1eeb..741aa5a0 100644 --- a/examples/Basic/CMakeLists.txt +++ b/examples/Basic/CMakeLists.txt @@ -50,7 +50,7 @@ SOURCE_GROUP("Headers" FILES ${INC_FILES}) FIND_PACKAGE(OpenGL REQUIRED) #Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location) -INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_SOURCE_DIR}/include) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_SOURCE_DIR}/include ${PolyVoxCore_BINARY_DIR}/include) LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}) #Build diff --git a/examples/OpenGL/CMakeLists.txt b/examples/OpenGL/CMakeLists.txt index 5b61f759..e90fc80a 100644 --- a/examples/OpenGL/CMakeLists.txt +++ b/examples/OpenGL/CMakeLists.txt @@ -56,7 +56,7 @@ SOURCE_GROUP("Headers" FILES ${INC_FILES}) FIND_PACKAGE(OpenGL REQUIRED) #Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location) -INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_SOURCE_DIR}/include) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_SOURCE_DIR}/include ${PolyVoxCore_BINARY_DIR}/include) LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}) #Build diff --git a/examples/Paging/CMakeLists.txt b/examples/Paging/CMakeLists.txt index 88fb5b6f..7b07b742 100644 --- a/examples/Paging/CMakeLists.txt +++ b/examples/Paging/CMakeLists.txt @@ -52,7 +52,7 @@ SOURCE_GROUP("Headers" FILES ${INC_FILES}) FIND_PACKAGE(OpenGL REQUIRED) #Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location) -INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_SOURCE_DIR}/include) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_SOURCE_DIR}/include ${PolyVoxCore_BINARY_DIR}/include) LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}) #Build diff --git a/examples/SmoothLOD/CMakeLists.txt b/examples/SmoothLOD/CMakeLists.txt index 86923a0a..c911c6a1 100644 --- a/examples/SmoothLOD/CMakeLists.txt +++ b/examples/SmoothLOD/CMakeLists.txt @@ -50,7 +50,7 @@ SOURCE_GROUP("Headers" FILES ${INC_FILES}) FIND_PACKAGE(OpenGL REQUIRED) #Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location) -INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_SOURCE_DIR}/include) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_SOURCE_DIR}/include ${PolyVoxCore_BINARY_DIR}/include) LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}) #Build diff --git a/library/PolyVoxCore/CMakeLists.txt b/library/PolyVoxCore/CMakeLists.txt index e4b4f443..8fc62c0a 100644 --- a/library/PolyVoxCore/CMakeLists.txt +++ b/library/PolyVoxCore/CMakeLists.txt @@ -24,6 +24,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(PolyVoxCore) +#Set up the C++11 feature header file based on the CheckCXX11Features script +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/include/PolyVoxCore/Impl/CompilerCapabilities.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/PolyVoxCore/Impl/CompilerCapabilities.h) + #Projects source files SET(CORE_SRC_FILES source/ArraySizes.cpp @@ -128,7 +131,7 @@ SOURCE_GROUP("Sources\\Impl" FILES ${IMPL_SRC_FILES}) SOURCE_GROUP("Headers\\Impl" FILES ${IMPL_INC_FILES}) #Tell CMake the paths -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include) #Core #Build diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/CompilerCapabilities.h.in b/library/PolyVoxCore/include/PolyVoxCore/Impl/CompilerCapabilities.h.in new file mode 100644 index 00000000..6876d1a7 --- /dev/null +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/CompilerCapabilities.h.in @@ -0,0 +1,6 @@ +#ifndef __PolyVox_CompilerCapabilities_H__ +#define __PolyVox_CompilerCapabilities_H__ + +#cmakedefine HAS_CXX11_CONSTEXPR + +#endif diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h index 8feb34bd..113ccfd8 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h @@ -24,6 +24,8 @@ freely, subject to the following restrictions: #ifndef __PolyVox_TypeDef_H__ #define __PolyVox_TypeDef_H__ +#include "PolyVoxCore/Impl/CompilerCapabilities.h" + //Definitions needed to make library functions accessable // See http://gcc.gnu.org/wiki/Visibility for more info. #if defined _WIN32 || defined __CYGWIN__ diff --git a/library/PolyVoxUtil/CMakeLists.txt b/library/PolyVoxUtil/CMakeLists.txt index 97dbb8da..38425346 100644 --- a/library/PolyVoxUtil/CMakeLists.txt +++ b/library/PolyVoxUtil/CMakeLists.txt @@ -45,7 +45,7 @@ SOURCE_GROUP("Sources" FILES ${UTIL_SRC_FILES}) SOURCE_GROUP("Headers" FILES ${UTIL_INC_FILES}) #Tell CMake the paths -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include ${PolyVoxCore_BINARY_DIR}/include) #There has to be a better way! LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}/debug ${PolyVoxCore_BINARY_DIR}/release ${PolyVoxCore_BINARY_DIR}) diff --git a/library/bindings/CMakeLists.txt b/library/bindings/CMakeLists.txt index e976c015..33172fdb 100644 --- a/library/bindings/CMakeLists.txt +++ b/library/bindings/CMakeLists.txt @@ -36,7 +36,7 @@ if(ENABLE_BINDINGS) include(${SWIG_USE_FILE}) include_directories(${PYTHON_INCLUDE_PATH}) - include_directories(${PolyVoxCore_SOURCE_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include/PolyVoxCore) + include_directories(${PolyVoxCore_SOURCE_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include/PolyVoxCore ${PolyVoxCore_BINARY_DIR}/include) link_directories(${PolyVoxCore_BINARY_DIR}) set(CMAKE_SWIG_FLAGS "") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6c6fe163..693a7026 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -39,7 +39,7 @@ MACRO(CREATE_TEST headerfile sourcefile executablename) SET_PROPERTY(TARGET ${executablename} PROPERTY FOLDER "Tests") ENDMACRO(CREATE_TEST) -INCLUDE_DIRECTORIES(${PolyVox_SOURCE_DIR}/PolyVoxCore/include ${CMAKE_CURRENT_BINARY_DIR}) +INCLUDE_DIRECTORIES(${PolyVox_SOURCE_DIR}/PolyVoxCore/include ${PolyVoxCore_BINARY_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}) REMOVE_DEFINITIONS(-DQT_GUI_LIB) #Make sure the tests don't link to the QtGui # Test Template. Copy and paste this template for consistant naming.