User:Donnguyen/Building and using Qt5GStreamer on Windows: Difference between revisions

From KDE Community Wiki
No edit summary
Line 40: Line 40:
Qt5Glib.pc and Qt5GStreamerUi.pc: comment Qt5Core and Qt5Widgets.  pkg-config can't find them because they don't exist for MSVC.
Qt5Glib.pc and Qt5GStreamerUi.pc: comment Qt5Core and Qt5Widgets.  pkg-config can't find them because they don't exist for MSVC.


==Troubleshooting===
==Troubleshooting==
As a general rule, don't mix 32 and 64 bit, debug and release, libraries.
As a general rule, don't mix 32 and 64 bit, debug and release, libraries.

Revision as of 02:01, 18 April 2017

This document guides you through the process of building, installing, and using Qt5GStreamer on Windows.

Setting up dependencies

Boost

Boost is required to build and use Qt5GStreamer. Set up is rather simple. Download the .zip from the boost.org website, extract it, and set the environment variable BOOST_ROOT to the root directory of the boost installation. Verify this is correctly set up by opening a command prompt and typing dir %BOOST_ROOT%\libs. You should see a bunch of directories.

Gstreamer

Download and install at least the runtime and development files from the Gstreamer web site. Set both environment variables GSTREAMER_ROOT_X86 and GSTREAMER_1_0_ROOT_X86 to the installation directory. Add %GSTREAMER_ROOT_X86%\bin to your PATH. Verify you have this set up correctly by opening a command prompt and type gst-launch-1.0 -h. You should see the usage output from the gst-launch command.

Cmake

You will need CMake to configure and build Qt5GStreamer. Download and install it from the CMake website. If you choose to add cmake to your path (more convenient), make sure you add it AFTER %QTDIR%\bin. The cmake bin directory has qt .dll's that will likely cause conflicts, so I would recommend making it the last item in your path just to be safe. If chose to add cmake to your PATH, verify it is correctly set up by opening a command prompt and typing cmake -version. You should see the version of cmake printed on the screen.

Building Qt5GStreamer

Using the default install path of "C:/Program Files (x86)/QtGStreamer" can cause problems because of the special characters in the path, and special permissions required, so we'll install it to C:\QtGStreamer.

Important

Make sure you have cmake set up with Qt Creator.

Steps:

  1. Set environment variable QTGSTREAMER_ROOT to C:\QtGStreamer
  2. Download source via: git clone https://github.com/GStreamer/qt-gstreamer
  3. Start Qt Creator and open CMakeLists.txt. Switch to Projects and edit the Build Settings. Under the CMake section, edit CMAKE_INSTALL_PREFIX and set it to %QTGSTREAMER_ROOT%. Edit QT_VERSION and set it to 5. Click on "Apply Configuration Changes". Under Build Steps, click on Details, and select the target "install".
  4. Build the project.
  5. Finally, add %QTGSTREAMER_ROOT%\bin to PATH to complete the set up.

Verify Qt5GStreamer is properly built and installed by opening a command prompt and typing dir %QTGSTREAMER%\bin. You should see some .dll files starting with Qt5G.

Using Qt5GStreamer

If you're going to use cmake, you're all set. If you want to use qmake, there are additional steps to set up.

Installing and setting up pkg-config

There are several ways to set up pkg-config. Some set-ups are complicated, and some don't work :-/ Fortunately, I found a simple set up that works. Download pkg-config-lite from https://sourceforge.net/projects/pkgconfiglite/files/ Unzip, and add the bin directory to your path. Verify this is set up correctly by opening a command prompt and typing pkg-config --help. You should see the help for pkg-config.

Using Qt5GStreamer via PKGCONFIG in .pro file

Add the following to .pro file:

CONFIG += link_pkgconfig
PKGCONFIG += Qt5GStreamer-1.0 Qt5GStreamerUi-1.0
QT += widgets
INCLUDEPATH += $$(BOOST_ROOT)

Try opening the example .pro included with the qt-gstreamer source, make some edits, and try to build it. If you can build and run the example, you're all done.

MSVC hack

Edit two files under %QTGSTREAMER_ROOT%\lib\pkgconfig. Qt5Glib.pc and Qt5GStreamerUi.pc: comment Qt5Core and Qt5Widgets. pkg-config can't find them because they don't exist for MSVC.

Troubleshooting

As a general rule, don't mix 32 and 64 bit, debug and release, libraries.