[vtkusers] VTK 6.1 linking/autoinit

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Sep 10 17:33:13 EDT 2013


This is now in master, I will find a little time to update
documentation on the wiki. I think this approach will be simpler in
circumstances where you know exactly which modules you want
initialized and cannot simply use compiler definitions. Please let me
know if you hit any problems - in local tests this performed as
expected.

Marcus

On Tue, Sep 10, 2013 at 5:17 PM, Jude Pereira <jpereira at advsolinc.com> wrote:
> Yes. This would work for me. Thanks for the quick response :)
>
> Jude
>
> -----Original Message-----
> From: Marcus D. Hanwell [mailto:marcus.hanwell at kitware.com]
> Sent: Tuesday, September 10, 2013 3:18 PM
> To: Jude Pereira
> Cc: David Cole; VTK Users
> Subject: Re: [vtkusers] VTK 6.1 linking/autoinit
>
> I was just thinking of hitting the button, it is very low risk and presents a simpler interface if you are not using CMake (or even if you are but want to avoid the need for preprocessor definitions. I take it this looks like a good option for you? I posted the link to give you and others a chance to comment.
>
> Marcus
>
> On Tue, Sep 10, 2013 at 2:56 PM, Jude Pereira <jpereira at advsolinc.com> wrote:
>> So will this change be merged into master later today/tonight?
>>
>> Jude
>>
>> -----Original Message-----
>> From: Marcus D. Hanwell [mailto:marcus.hanwell at kitware.com]
>> Sent: Tuesday, September 10, 2013 1:17 PM
>> To: David Cole
>> Cc: Jude Pereira; VTK Users
>> Subject: Re: [vtkusers] VTK 6.1 linking/autoinit
>>
>> On Mon, Sep 9, 2013 at 11:42 AM, David Cole <dlrdave at aol.com> wrote:
>>>> I've been using VTK 6.0 libs with
>>>>
>>>> #define
>>>
>>> vtkRenderingCore_AUTOINIT4(vtkInteractionStyle,vtkRenderingFreeType,v
>>> t
>>> kRe
>>> nderingFreeTypeOpenGL,vtkRenderingOpenGL)
>>>>
>>>> #define vtkRenderingVolume_AUTOINIT1(vtkRenderingVolumeOpenGL)
>>>>
>>>> I was just putting together a test project and decided to try the
>>>> 6.1
>>>
>>> libs and with the above mentioned defines
>>>>
>>>> I get several linker errors related to vtkRenderingOpenGL-6.1.lib ...
>>>
>>> What linker errors do you get?
>>>
>>> Do you put those #define lines before *every* VTK header file? (i.e.
>>> -- if you have some cpp files where you do and some where you don't,
>>> then there could be link time inconsistencies that would cause linker
>>> errors...)
>>>
>> I had been meaning to add something like this for a while, but if you
>> take a look at,
>>
>> http://review.source.kitware.com/#/t/3229/
>>
>> It adds a new macro where you can individually initialize modules, so
>> that the order stuff no longer matters and you just need a source file
>> in your executable with the init calls, it is as simple as adding a
>> C++ source to your project with something like,
>>
>> #include "vtkAutoInit.h"
>>
>> VTK_MODULE_INIT(vtkRenderingOpenGL);
>> VTK_MODULE_INIT(vtkRenderingVolumeOpenGL);
>>
>> Due to the way they are initialized it won't break things if it should end up being done more than once. I have asked Brad to check over the macro code, you could effectively copy the snippet into your project (adjusting the macro name to avoid conflicts once this is merged) if you want to use it with older versions of VTK too. It is the simplified version of what autoinit does when you don't want the build system to take care of everything for you (the original goal of autoinit).
>>
>> Marcus



More information about the vtkusers mailing list