VTK Python & BUILD_SHARED_LIBS=OFF

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

VTK Python & BUILD_SHARED_LIBS=OFF

Burlen Loring-2
Hi Folks,

I'm using VTK in an embedded Python interpreter. In my case VTK is an external project dependency, and to configure my library I point to an externally  installed VTK.  Works great when I compile VTK with BUILD_SHARED_LIBS=ON, but with this set OFF I can't "import vtk". Some of the Python modules are not found. Since vtkpython works, I know there is a way. If I understand correctly I need to have the following before I initialize the interpreter.
#include "vtkpythonmodules.h"

CMakeLoadAllPythonModules();
I'm stuck on the CMake code to locate the header and link dependencies. how do I locate the include directory of  vtkpythonmodules.h? the file is not installed, which seems to be a problem. Then also how can I access the list of link libraries needed? These seem to be stored in an internal variable, but are they exported to the install?

Burlen

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: VTK Python & BUILD_SHARED_LIBS=OFF

Utkarsh Ayachit
Burlen,

You're correct an all accounts. That's indeed an issue. I am not sure
what's the best way: should we install the header and export the
libraries, or create a new library/api that dependent projects can
call to init the static Python modules or something even more
creative. If we go the truly modular route, CMakeLoadAllPythonModules
is an anathema. It inits all modules that VTK was built with and not
the only the modules that the app depends on. Ideally, it'd be the
latter. Not sure how we could do that. Ben/David, any ideas?

Utkarsh
On Sat, Sep 8, 2018 at 2:09 PM Burlen Loring <[hidden email]> wrote:

>
> Hi Folks,
>
> I'm using VTK in an embedded Python interpreter. In my case VTK is an external project dependency, and to configure my library I point to an externally  installed VTK.  Works great when I compile VTK with BUILD_SHARED_LIBS=ON, but with this set OFF I can't "import vtk". Some of the Python modules are not found. Since vtkpython works, I know there is a way. If I understand correctly I need to have the following before I initialize the interpreter.
>
> #include "vtkpythonmodules.h"
>
> CMakeLoadAllPythonModules();
>
> I'm stuck on the CMake code to locate the header and link dependencies. how do I locate the include directory of  vtkpythonmodules.h? the file is not installed, which seems to be a problem. Then also how can I access the list of link libraries needed? These seem to be stored in an internal variable, but are they exported to the install?
>
> Burlen
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtk-developers
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: VTK Python & BUILD_SHARED_LIBS=OFF

David Gobbi
Hi Utkarsh,

The following MR will address some of the issues:

Relevant changes the MR are:
1) The VTK Python extension modules are exported as targets.
2) When an extension module is imported, it imports the extension modules that it depends on.

 - David


On Sun, 9 Sep 2018, 05:36 Utkarsh Ayachit, <[hidden email]> wrote:
Burlen,

You're correct an all accounts. That's indeed an issue. I am not sure
what's the best way: should we install the header and export the
libraries, or create a new library/api that dependent projects can
call to init the static Python modules or something even more
creative. If we go the truly modular route, CMakeLoadAllPythonModules
is an anathema. It inits all modules that VTK was built with and not
the only the modules that the app depends on. Ideally, it'd be the
latter. Not sure how we could do that. Ben/David, any ideas?

Utkarsh
On Sat, Sep 8, 2018 at 2:09 PM Burlen Loring <[hidden email]> wrote:
>
> Hi Folks,
>
> I'm using VTK in an embedded Python interpreter. In my case VTK is an external project dependency, and to configure my library I point to an externally  installed VTK.  Works great when I compile VTK with BUILD_SHARED_LIBS=ON, but with this set OFF I can't "import vtk". Some of the Python modules are not found. Since vtkpython works, I know there is a way. If I understand correctly I need to have the following before I initialize the interpreter.
>
> #include "vtkpythonmodules.h"
>
> CMakeLoadAllPythonModules();
>
> I'm stuck on the CMake code to locate the header and link dependencies. how do I locate the include directory of  vtkpythonmodules.h? the file is not installed, which seems to be a problem. Then also how can I access the list of link libraries needed? These seem to be stored in an internal variable, but are they exported to the install?
>
> Burlen
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtk-developers
>

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: VTK Python & BUILD_SHARED_LIBS=OFF

Ben Boeckel
In reply to this post by Utkarsh Ayachit
On Sun, Sep 09, 2018 at 08:36:18 -0400, Utkarsh Ayachit wrote:
> You're correct an all accounts. That's indeed an issue. I am not sure
> what's the best way: should we install the header and export the
> libraries, or create a new library/api that dependent projects can
> call to init the static Python modules or something even more
> creative. If we go the truly modular route, CMakeLoadAllPythonModules
> is an anathema. It inits all modules that VTK was built with and not
> the only the modules that the app depends on. Ideally, it'd be the
> latter. Not sure how we could do that. Ben/David, any ideas?

Yes. When rewriting the Python wrapping function for the new module
system, the static Python libraries have generated headers installed for
initializing the installed static modules.

It also generates a header for initializing "all" modules with a
function name that can be specified. This is how the static `vtkpython`
works in the new module system.

It certainly requires removing the PythonD libraries though (the new
module system has its version of that topic in its history).

--Ben
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: VTK Python & BUILD_SHARED_LIBS=OFF

Burlen Loring-2
Cool, thanks for all the info

sounds like this will be supported in the near future. I'd like to try
it out. What is the eta? What's the best way to follow progress?

On 09/11/2018 01:16 PM, Ben Boeckel wrote:

> On Sun, Sep 09, 2018 at 08:36:18 -0400, Utkarsh Ayachit wrote:
>> You're correct an all accounts. That's indeed an issue. I am not sure
>> what's the best way: should we install the header and export the
>> libraries, or create a new library/api that dependent projects can
>> call to init the static Python modules or something even more
>> creative. If we go the truly modular route, CMakeLoadAllPythonModules
>> is an anathema. It inits all modules that VTK was built with and not
>> the only the modules that the app depends on. Ideally, it'd be the
>> latter. Not sure how we could do that. Ben/David, any ideas?
> Yes. When rewriting the Python wrapping function for the new module
> system, the static Python libraries have generated headers installed for
> initializing the installed static modules.
>
> It also generates a header for initializing "all" modules with a
> function name that can be specified. This is how the static `vtkpython`
> works in the new module system.
>
> It certainly requires removing the PythonD libraries though (the new
> module system has its version of that topic in its history).
>
> --Ben

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: VTK Python & BUILD_SHARED_LIBS=OFF

Ben Boeckel
On Thu, Sep 13, 2018 at 12:09:06 -0700, Burlen Loring wrote:
> Cool, thanks for all the info
>
> sounds like this will be supported in the near future. I'd like to try
> it out. What is the eta? What's the best way to follow progress?

Its current state is here:

    https://gitlab.kitware.com/ben.boeckel/vtk/tree/new-cmake-module

However, it is based on VTK as of March as I haven't rebased it since I
got back from vacation. There are still rough edges in there though.

Don't use an existing build tree for building it if you try it out.

No promises on an ETA however. I don't *think* there are many unknown
unknowns yet, but knowing would also recategorize them ;) .

--Ben
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers