Reorganise the CMake scripts to make sure the core library is independent
This commit is contained in:
parent
2e98414fd3
commit
6d6b190743
@ -1,5 +1,5 @@
|
|||||||
# Copyright (c) 2007-2012 Matt Williams
|
# Copyright (c) 2007-2014 Matt Williams
|
||||||
# Copyright (c) 2007-2012 David Williams
|
# Copyright (c) 2007-2014 David Williams
|
||||||
#
|
#
|
||||||
# This software is provided 'as-is', without any express or implied
|
# This software is provided 'as-is', without any express or implied
|
||||||
# warranty. In no event will the authors be held liable for any damages
|
# warranty. In no event will the authors be held liable for any damages
|
||||||
@ -24,73 +24,63 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6)
|
|||||||
|
|
||||||
PROJECT(PolyVox)
|
PROJECT(PolyVox)
|
||||||
|
|
||||||
|
include(FeatureSummary)
|
||||||
|
|
||||||
|
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
#Set up for building the library itself
|
||||||
|
|
||||||
SET(POLYVOX_VERSION_MAJOR "0")
|
SET(POLYVOX_VERSION_MAJOR "0")
|
||||||
SET(POLYVOX_VERSION_MINOR "2")
|
SET(POLYVOX_VERSION_MINOR "2")
|
||||||
SET(POLYVOX_VERSION_PATCH "1")
|
SET(POLYVOX_VERSION_PATCH "1")
|
||||||
SET(POLYVOX_VERSION "${POLYVOX_VERSION_MAJOR}.${POLYVOX_VERSION_MINOR}.${POLYVOX_VERSION_PATCH}" CACHE STRING "PolyVox version")
|
SET(POLYVOX_VERSION "${POLYVOX_VERSION_MAJOR}.${POLYVOX_VERSION_MINOR}.${POLYVOX_VERSION_PATCH}" CACHE STRING "PolyVox version")
|
||||||
MARK_AS_ADVANCED(FORCE POLYVOX_VERSION)
|
MARK_AS_ADVANCED(FORCE POLYVOX_VERSION)
|
||||||
|
|
||||||
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
||||||
include(FeatureSummary)
|
|
||||||
|
|
||||||
FIND_PACKAGE(Doxygen)
|
|
||||||
OPTION(ENABLE_EXAMPLES "Should the examples be built" ON)
|
|
||||||
|
|
||||||
SET(LIBRARY_TYPE "DYNAMIC" CACHE STRING "Should the library be STATIC or DYNAMIC")
|
SET(LIBRARY_TYPE "DYNAMIC" CACHE STRING "Should the library be STATIC or DYNAMIC")
|
||||||
SET_PROPERTY(CACHE LIBRARY_TYPE PROPERTY STRINGS DYNAMIC STATIC)
|
SET_PROPERTY(CACHE LIBRARY_TYPE PROPERTY STRINGS DYNAMIC STATIC)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(LIBRARY_TYPE "STATIC")
|
SET(LIBRARY_TYPE "STATIC")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Qt is required for building the tests, the example and optionally for bundling the documentation
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||||
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtOpenGL QtTest)
|
|
||||||
INCLUDE(${QT_USE_FILE})
|
|
||||||
if(CMAKE_VERSION VERSION_LESS "2.8.6")
|
|
||||||
set_package_info(Doxygen "API documentation generator" http://www.doxygen.org "Building the API documentation")
|
|
||||||
set_package_info(Qt4 "C++ framework" http://qt-project.org "Building the examples and tests")
|
|
||||||
else()
|
|
||||||
set_package_properties(Doxygen PROPERTIES URL http://www.doxygen.org DESCRIPTION "API documentation generator" TYPE OPTIONAL PURPOSE "Building the API documentation")
|
|
||||||
set_package_properties(Qt4 PROPERTIES DESCRIPTION "C++ framework" URL http://qt-project.org)
|
|
||||||
set_package_properties(Qt4 PROPERTIES TYPE RECOMMENDED PURPOSE "Building the examples")
|
|
||||||
set_package_properties(Qt4 PROPERTIES TYPE OPTIONAL PURPOSE "Building the tests")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
IF(CMAKE_COMPILER_IS_GNUCXX) #Maybe "OR MINGW"
|
|
||||||
ADD_DEFINITIONS(-std=c++0x) #Enable C++0x mode
|
|
||||||
ENDIF()
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
||||||
ADD_DEFINITIONS(-std=c++0x) #Enable C++0x mode
|
ADD_DEFINITIONS(-std=c++0x) #Enable C++0x mode
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#We need to find doxygen before building the library
|
||||||
|
FIND_PACKAGE(Doxygen)
|
||||||
|
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(library)
|
ADD_SUBDIRECTORY(library)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Qt is required for building the tests, the example and optionally for bundling the documentation
|
||||||
|
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtOpenGL QtTest)
|
||||||
|
INCLUDE(${QT_USE_FILE})
|
||||||
|
|
||||||
|
#Examples
|
||||||
OPTION(ENABLE_EXAMPLES "Should the examples be built" ON)
|
OPTION(ENABLE_EXAMPLES "Should the examples be built" ON)
|
||||||
IF(ENABLE_EXAMPLES AND QT_QTOPENGL_FOUND)
|
IF(ENABLE_EXAMPLES AND QT_QTOPENGL_FOUND)
|
||||||
ADD_SUBDIRECTORY(examples/common)
|
|
||||||
ADD_SUBDIRECTORY(examples/Basic)
|
|
||||||
ADD_SUBDIRECTORY(examples/Paging)
|
|
||||||
ADD_SUBDIRECTORY(examples/OpenGL)
|
|
||||||
ADD_SUBDIRECTORY(examples/SmoothLOD)
|
|
||||||
ADD_SUBDIRECTORY(examples/DecodeOnGPU)
|
|
||||||
ADD_SUBDIRECTORY(examples/Python)
|
|
||||||
SET(BUILD_EXAMPLES ON)
|
SET(BUILD_EXAMPLES ON)
|
||||||
|
add_subdirectory(examples)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(BUILD_EXAMPLES OFF)
|
SET(BUILD_EXAMPLES OFF)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
INCLUDE(Packaging.cmake)
|
INCLUDE(Packaging.cmake)
|
||||||
|
|
||||||
|
#Tests
|
||||||
OPTION(ENABLE_TESTS "Should the tests be built" ON)
|
OPTION(ENABLE_TESTS "Should the tests be built" ON)
|
||||||
IF(ENABLE_TESTS AND QT_QTTEST_FOUND)
|
IF(ENABLE_TESTS AND QT_QTTEST_FOUND)
|
||||||
|
SET(BUILD_TESTS ON)
|
||||||
INCLUDE(CTest)
|
INCLUDE(CTest)
|
||||||
MARK_AS_ADVANCED(FORCE BUILD_TESTING)
|
MARK_AS_ADVANCED(FORCE BUILD_TESTING)
|
||||||
ADD_SUBDIRECTORY(tests)
|
ADD_SUBDIRECTORY(tests)
|
||||||
SET(BUILD_TESTS ON)
|
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(BUILD_TESTS OFF)
|
SET(BUILD_TESTS OFF)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
#Manual
|
||||||
#Check if we will building _and_ bundling the docs
|
#Check if we will building _and_ bundling the docs
|
||||||
IF(DOXYGEN_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE)
|
IF(DOXYGEN_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE)
|
||||||
SET(BUILD_AND_BUNDLE_DOCS ON)
|
SET(BUILD_AND_BUNDLE_DOCS ON)
|
||||||
@ -100,6 +90,12 @@ ENDIF()
|
|||||||
|
|
||||||
ADD_SUBDIRECTORY(documentation)
|
ADD_SUBDIRECTORY(documentation)
|
||||||
|
|
||||||
|
|
||||||
|
set_package_properties(Doxygen PROPERTIES URL http://www.doxygen.org DESCRIPTION "API documentation generator" TYPE OPTIONAL PURPOSE "Building the API documentation")
|
||||||
|
set_package_properties(Qt4 PROPERTIES DESCRIPTION "C++ framework" URL http://qt-project.org)
|
||||||
|
set_package_properties(Qt4 PROPERTIES TYPE RECOMMENDED PURPOSE "Building the examples")
|
||||||
|
set_package_properties(Qt4 PROPERTIES TYPE OPTIONAL PURPOSE "Building the tests")
|
||||||
|
|
||||||
add_feature_info("Examples" BUILD_EXAMPLES "Examples of PolyVox usage")
|
add_feature_info("Examples" BUILD_EXAMPLES "Examples of PolyVox usage")
|
||||||
add_feature_info("Tests" BUILD_TESTS "Unit tests")
|
add_feature_info("Tests" BUILD_TESTS "Unit tests")
|
||||||
add_feature_info("Bindings" BUILD_BINDINGS "SWIG bindings")
|
add_feature_info("Bindings" BUILD_BINDINGS "SWIG bindings")
|
||||||
|
7
examples/CMakeLists.txt
Normal file
7
examples/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
ADD_SUBDIRECTORY(common)
|
||||||
|
ADD_SUBDIRECTORY(Basic)
|
||||||
|
ADD_SUBDIRECTORY(Paging)
|
||||||
|
ADD_SUBDIRECTORY(OpenGL)
|
||||||
|
ADD_SUBDIRECTORY(SmoothLOD)
|
||||||
|
ADD_SUBDIRECTORY(DecodeOnGPU)
|
||||||
|
ADD_SUBDIRECTORY(Python)
|
@ -48,6 +48,7 @@ endif(WIN32)
|
|||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/PolyVoxConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/PolyVoxConfig.cmake @ONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/PolyVoxConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/PolyVoxConfig.cmake @ONLY)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PolyVoxConfig.cmake DESTINATION ${CONFIG_FILE_DIR} COMPONENT development)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PolyVoxConfig.cmake DESTINATION ${CONFIG_FILE_DIR} COMPONENT development)
|
||||||
|
|
||||||
|
#Documentation
|
||||||
if(DOXYGEN_FOUND)
|
if(DOXYGEN_FOUND)
|
||||||
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polyvox.css ${CMAKE_CURRENT_BINARY_DIR}/polyvox.css)
|
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/polyvox.css ${CMAKE_CURRENT_BINARY_DIR}/polyvox.css)
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||||
@ -82,5 +83,3 @@ if(DOXYGEN_FOUND)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#add_subdirectory(bindings)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user