From 11685a1874d6777e5c1afc525bb31429ca168b93 Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Tue, 26 Jun 2012 17:08:44 +0100 Subject: [PATCH] Rename BUILD_TESTING to ENABLE_TESTS and WITH_BINDINGS to ENABLE_BINDINGS This is for future consistency where ENABLE_ variables will denote optional components of PolyVox and WITH_ variables denote optionally using features provided by external libraries (e.g. OGRE compatibility). --- CMakeLists.txt | 11 +++++----- INSTALL.txt | 4 ++-- library/bindings/CMakeLists.txt | 38 +++++++++++++++++---------------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ae442e2..6e4901c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,11 +51,12 @@ ENDIF(ENABLE_EXAMPLES) INCLUDE(Packaging.cmake) -INCLUDE(CTest) -MARK_AS_ADVANCED(FORCE DART_TESTING_TIMEOUT) #This is only needed to hide the variable in the GUI (CMake bug) -IF(BUILD_TESTING) +OPTION(ENABLE_TESTS "Should the tests be built" ON) +IF(ENABLE_TESTS) + INCLUDE(CTest) + MARK_AS_ADVANCED(FORCE DART_TESTING_TIMEOUT) #This is only needed to hide the variable in the GUI (CMake bug) ADD_SUBDIRECTORY(tests) -ENDIF(BUILD_TESTING) +ENDIF(ENABLE_TESTS) #Check if we will building _and_ bundling the docs IF(DOXYGEN_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE) @@ -73,7 +74,7 @@ MESSAGE(STATUS "-------") MESSAGE(STATUS "Static libraries: " ${BUILD_STATIC_LIBRARIES}) MESSAGE(STATUS "Dynamic libraries: " ${BUILD_DYNAMIC_LIBRARIES}) MESSAGE(STATUS "Build examples: " ${ENABLE_EXAMPLES}) -MESSAGE(STATUS "Build tests: " ${BUILD_TESTING}) +MESSAGE(STATUS "Build tests: " ${ENABLE_TESTS}) MESSAGE(STATUS "Build bindings: " ${BUILD_BINDINGS}) MESSAGE(STATUS "API Docs available: " ${DOXYGEN_FOUND}) MESSAGE(STATUS " - Qt Help bundling: " ${BUILD_AND_BUNDLE_DOCS}) diff --git a/INSTALL.txt b/INSTALL.txt index 153e03e1..eed1285e 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -45,10 +45,10 @@ The other available settings for PolyVox are: ``ENABLE_EXAMPLES`` (``ON`` or ``OFF``) Build the example applications that come with PolyVox. Defaults to ``ON``. -``BUILD_TESTING`` (``ON`` or ``OFF``) +``ENABLE_TESTS`` (``ON`` or ``OFF``) Build the test applications that come with PolyVox. Running the tests is detailed in the next section. Defaults to ``ON``. -``WITH_BINDINGS`` (``ON`` or ``OFF``) +``ENABLE_BINDINGS`` (``ON`` or ``OFF``) Should the Python bindings to PolyVox be built. This requires the Python development libraries and SWIG to be installed. Defaults to ``ON``. ``BUILD_STATIC_LIBRARIES`` and ``BUILD_DYNAMIC_LIBRARIES`` (``ON`` or ``OFF``) diff --git a/library/bindings/CMakeLists.txt b/library/bindings/CMakeLists.txt index c0b38b90..e87f583d 100644 --- a/library/bindings/CMakeLists.txt +++ b/library/bindings/CMakeLists.txt @@ -1,21 +1,23 @@ -find_package(SWIG) -find_package(PythonLibs) -option(WITH_BINDINGS "Build Python bindings" ON) -if(SWIG_FOUND AND PYTHONLIBS_FOUND AND WITH_BINDINGS) - set(BUILD_BINDINGS YES CACHE BOOL "Will the bindings be built" FORCE) - include(${SWIG_USE_FILE}) - - include_directories(${PYTHON_INCLUDE_PATH}) - include_directories(${PolyVoxCore_SOURCE_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include/PolyVoxCore) - link_directories(${PolyVoxCore_BINARY_DIR}) +option(ENABLE_BINDINGS "Build Python bindings" ON) +if(ENABLE_BINDINGS) + find_package(SWIG) + find_package(PythonLibs) + if(SWIG_FOUND AND PYTHONLIBS_FOUND) + set(BUILD_BINDINGS YES CACHE BOOL "Will the bindings be built" FORCE) + include(${SWIG_USE_FILE}) + + include_directories(${PYTHON_INCLUDE_PATH}) + include_directories(${PolyVoxCore_SOURCE_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include/PolyVoxCore) + link_directories(${PolyVoxCore_BINARY_DIR}) - set(CMAKE_SWIG_FLAGS "") - set_source_files_properties(PolyVoxCore.i PROPERTIES CPLUSPLUS ON) - - #set_source_files_properties(PolyVoxCore.i PROPERTIES SWIG_FLAGS "-builtin") - swig_add_module(PolyVoxCore python PolyVoxCore.i) - swig_link_libraries(PolyVoxCore ${PYTHON_LIBRARIES} PolyVoxCore) - #set_target_properties(${SWIG_MODULE_PolyVoxCore_REAL_NAME} PROPERTIES SUFFIX ".pyd") + set(CMAKE_SWIG_FLAGS "") + set_source_files_properties(PolyVoxCore.i PROPERTIES CPLUSPLUS ON) + + #set_source_files_properties(PolyVoxCore.i PROPERTIES SWIG_FLAGS "-builtin") + swig_add_module(PolyVoxCore python PolyVoxCore.i) + swig_link_libraries(PolyVoxCore ${PYTHON_LIBRARIES} PolyVoxCore) + #set_target_properties(${SWIG_MODULE_PolyVoxCore_REAL_NAME} PROPERTIES SUFFIX ".pyd") + endif() else() set(BUILD_BINDINGS NO CACHE BOOL "Will the bindings be built" FORCE) -endif() \ No newline at end of file +endif()