Add option to disable building the bindings.

If you want to disable them, even if SWIG and Python were both found, set
WITH_BINDINGS to NO with -DWITH_BINDINGS=NO or in the CMake GUI.
This commit is contained in:
Matt Williams 2012-06-21 20:31:04 +01:00
parent 11f91fbbc4
commit c681fac66a
2 changed files with 7 additions and 1 deletions

View File

@ -74,6 +74,7 @@ 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 bindings: " ${BUILD_BINDINGS})
MESSAGE(STATUS "API Docs available: " ${DOXYGEN_FOUND})
MESSAGE(STATUS " - Qt Help bundling: " ${BUILD_AND_BUNDLE_DOCS})
MESSAGE(STATUS "Build manual: " ${BUILD_MANUAL})

View File

@ -1,6 +1,8 @@
find_package(SWIG)
find_package(PythonLibs)
if(SWIG_FOUND AND PYTHONLIBS_FOUND)
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})
@ -10,7 +12,10 @@ if(SWIG_FOUND AND PYTHONLIBS_FOUND)
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")
else()
set(BUILD_BINDINGS NO CACHE BOOL "Will the bindings be built" FORCE)
endif()