PDA

View Full Version : vtk integration with Qt 5.5



Kuo
19th February 2016, 16:29
Hi,

I am using vtk 6.3.0, Qt 5.5 and Cmake 3.2.3. I want to integrate vtk and Qt and run them in Vs 2013. After VTK_group_Qt was selected, I hit generate but it thew me an error:

Could not find a package configuration file provided by "Qt5" with any of
the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.

I added CMAKE_PREFIX_PATH in environment variable as F:\Program\Qt\5.5\msvc2013_64\\, but this does not help. I am very frustrated with this problem. Can anybody help me a little bit?

Thanks,
Kuo

spacedrace
20th February 2016, 21:41
I'm in the same boat, except I'm using VS2015. I'd also be interested in a solution to this.

What are you installing VTK for? I am installing it for PCL.

d_stranz
21st February 2016, 00:22
I've done this before with an earlier version of VTK. I've just downloaded the latest and will try it again. Once I get it working I will let you know what I did.

By the way, the current release of Qt5 will complain if you try to use it with VS2015. If you want to use it, you have to change the VS project settings to build using the VS2013 toolset.

spacedrace
21st February 2016, 00:53
I managed to get it to compile, using the process here http://doc.qt.io/qt-5/windows-building.html, and set all my environment vars like this :

REM Set up \Microsoft Visual Studio 2013, where <arch> is \c amd64, \c x86, etc.
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
SET _ROOT=C:\qt\qt-4.8.6
echo --ROOT
echo %_ROOT%
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;C:\Py thon27;C:\Perl64;C:\Ruby22-x64;%PATH%
REM Uncomment the below line when using a git checkout of the source repository
REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
SET QMAKESPEC=win32-msvc2015
echo --QMAKESPEC
echo %QMAKESPEC%
SET _ROOT=


Didn't get any errors when I compiled are you saying I will have trouble once I start trying to use it in VS2015? I have compiled all my other dependencies using vs2015, should I go back and use 2013 for everything? Again this is all for PCL usage.

d_stranz
21st February 2016, 01:53
Qt 5.5 binary distributions are up to VS 2013 only. There is a test for the compiler version in one of the Qt header files that will complain if VS 2015 is detected. If you tell VS 2015 to target the 2013 toolset, these complaints go away. I don't know what happens if you build Qt yourself from source. I think the complaints will still be there unless you edit the include file to update the test for the VS version.

What I don't know is whether the Qt binary libraries (built using VS 2013) are compatible when linked to binaries compiled using VS 2015 with the default VS 2015 toolset.


SET _ROOT=C:\qt\qt-4.8.6

My comments are based on Qt 5, not Qt 4. I don't know what happens in this case.

And the OP is talking about building VTK, not Qt.

Here is what I did just now to build VTK using VS2013 as the compiler and target for the CMake generator:

- be sure that your Qt bin and Python directories are in your environment PATH
- unzipped source distribution
- ran CMake GUI
- set unzip VTK top-level directory for "where is the source code""
- specified new "build" directory under this for "where to build the binaries"
- selected VS 2013 x64 as the generator target
- clicked Configure
- after completion, selected the following checkboxes:

- build examples
- build shared libs
- module vtk gui support Qt
- module vtk gui support Qt OpenGL
- modulr vtk python
- module vtk python interpreter
- module vtk rendering Qt
- module vtk rendering volume OpenGL
- module vtk views Qt
- VTK group Qt
- VTK wrap python
- clicked Configure again

- fixed errors (mostly paths and conflicting options)
- changed VTK_QT_VERSION to 5
- continued to click Configure until no errors reported
- clicked Generate
- when done, started VS2013, opened the VTK.sln in my "build" directory

- loaded (in my case) 343 projects
- selected the ALL_BUILD project
- clicked "build"

It takes a long time to build, especially the Python wrappings. I have Python 2.7 installed as a static library, and CMake complained that it couldn't find the Python27.dll file (because it doesn't exist in my install). I set the PYTHON_DEBUG_LIBRARY variable to empty and it stopped complaining. I do not know if VTK will work with a static Python. I'll test that later.

After the build completed, there were 92 projects that failed to build. These are all related to Python, probably because of my static library build. I'll try it again with a DLL version of the Python libraries.

spacedrace
21st February 2016, 04:04
Oops, yeah I had changed that trying to get it to work with QT4(because I had a tutorial that used QT4, I decided not to actually compile it), but yes I am using QT5 also. Yes I compiled it from source, I was told on another forum I shouldn't have any issues compiling using VS2015. https://forum.qt.io/topic/64384/compiling-from-sources-windows-10-msvc14/2

I found the issue that was causing my problem I was picking the wrong directory for Qt5_DIR

I had to go to qt-5.5.1/qtbase/lib/cmake/QT5 to find the file.

-----

Now I'm getting another error asking about Qt5UiPluginConfig.cmake, I've searched the whole directory and can't find the cmake file, all the others that I needed were in that .../lib/cmake directory but that one seems to be missing.

Here's there Error


CMake Error at C:/QT/qt-5.5.1/qtbase/lib/cmake/Qt5/Qt5Config.cmake:26 (find_package):
Could not find a package configuration file provided by "Qt5UiPlugin" with
any of the following names:

Qt5UiPluginConfig.cmake
qt5uiplugin-config.cmake

Add the installation prefix of "Qt5UiPlugin" to CMAKE_PREFIX_PATH or set
"Qt5UiPlugin_DIR" to a directory containing one of the above files. If
"Qt5UiPlugin" provides a separate development package or SDK, be sure it
has been installed.

---

I was looking at Qt5Config.cmake:26 and on that line it appears to be looping through the modules but I don't see this module as a variable in cmake?

Any ideas? Thanks for the help btw.

spacedrace
21st February 2016, 17:25
Just a quick follow up to the error



CMake Error at C:/QT/qt-5.5.1/qtbase/lib/cmake/Qt5/Qt5Config.cmake:26 (find_package):
Could not find a package configuration file provided by "Qt5UiPlugin" with
any of the following names:

Qt5UiPluginConfig.cmake
qt5uiplugin-config.cmake

Add the installation prefix of "Qt5UiPlugin" to CMAKE_PREFIX_PATH or set
"Qt5UiPlugin_DIR" to a directory containing one of the above files. If
"Qt5UiPlugin" provides a separate development package or SDK, be sure it
has been installed

I decided to recompile QT, this time I used nmake instead of jom, don't know if that is what made the difference. Then I recompiled VTK using cmake, and that warning was gone.