Commit b1c7c43a authored by Utkarsh Ayachit's avatar Utkarsh Ayachit
Browse files

Fixes bugs when BUILD_SHARED_LIBS was ON.

vtkPythonWrapping was setting dependencies even when BUILD_SHARED_LIBS was ON.
This was resulting in vtkpython dependending on the modules are compile time
acceidentally. Fixed that.

Modules were being added using vtk_add_library() call. That call sets properties
on the target that are not necessarily applicable to "Modules" and was raising
compiler errors when BUILD_SHARED_LIBS was ON. Fixed that. Now vtk_add_library()
is only called when building static (it's needed in that case since the static
module needs to be treated as a regular library and must be added the exports so
that applications can link against it).

Change-Id: Ic0219e7b28d644e9a755fb5f494cbfc6d71dfd09
parent dd2c9df0
......@@ -71,14 +71,17 @@ endfunction()
# that statically initializes the modules after Py_Inititalize() is called.
function(_vtk_add_python_module name)
if (BUILD_SHARED_LIBS)
vtk_add_library(${name} MODULE ${ARGN})
add_library(${name} MODULE ${ARGN})
if (WIN32 AND NOT CYGWIN)
# when building shared on Windows, the python module files need to be
# named as *.pyd
set_target_properties(${name} PROPERTIES SUFFIX ".pyd")
endif()
else ()
vtk_add_library(${name} STATIC ${ARGN})
# when building statically, the module targets need to be exported since
# others can link against them, unlike when building shared, and hence we
# use vtk_add_library() call.
vtk_add_library(${name} ${ARGN})
endif()
endfunction()
......@@ -123,8 +126,10 @@ function(vtk_write_python_modules_header_for_wrapped_modules filename out_var)
vtk_write_python_modules_header(
"${filename}" ${python_wrapped_modules})
set (dependencies)
foreach(mod IN LISTS python_wrapped_modules)
list(APPEND dependencies ${mod}Python)
endforeach()
if (NOT BUILD_SHARED_LIBS)
foreach(mod IN LISTS python_wrapped_modules)
list(APPEND dependencies ${mod}Python)
endforeach()
endif()
set (${out_var} "${dependencies}" PARENT_SCOPE)
endfunction()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment