Due to the hack in which we enable the building of both static and shared libraries CMake's automatic dependency sorting isn't working. Manually specifying the dependency seems to solve the problem of components building out of order.
33 lines
1.4 KiB
CMake
33 lines
1.4 KiB
CMake
option(ENABLE_BINDINGS "Build Python bindings" ON)
|
|
if(ENABLE_BINDINGS)
|
|
find_package(SWIG)
|
|
set_package_properties(SWIG PROPERTIES DESCRIPTION "Bindings generator" URL http://www.swig.org)
|
|
find_package(PythonLibs)
|
|
set_package_properties(PythonLibs PROPERTIES DESCRIPTION "Programming language" URL http://www.python.org)
|
|
if(SWIG_FOUND AND PYTHONLIBS_FOUND)
|
|
set(BUILD_BINDINGS ON 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")
|
|
|
|
if(ENABLE_STATIC_LIBRARIES)
|
|
ADD_DEPENDENCIES(${SWIG_MODULE_PolyVoxCore_REAL_NAME} PolyVoxCoreStatic PolyVoxUtilStatic)
|
|
endif()
|
|
if(ENABLE_DYNAMIC_LIBRARIES)
|
|
ADD_DEPENDENCIES(${SWIG_MODULE_PolyVoxCore_REAL_NAME} PolyVoxCoreDynamic PolyVoxUtilDynamic)
|
|
endif()
|
|
endif()
|
|
else()
|
|
set(BUILD_BINDINGS OFF CACHE BOOL "Will the bindings be built" FORCE)
|
|
endif()
|