polyvox/library/bindings/CMakeLists.txt
Matt Williams c681fac66a 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.
2012-06-21 20:31:04 +01:00

21 lines
922 B
CMake

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})
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()