Skip to content

Instantly share code, notes, and snippets.

@alexandre-janniaux
Last active April 19, 2021 08:39
Show Gist options
  • Save alexandre-janniaux/a3ac8c310f9cf0c690705ea9d658ee57 to your computer and use it in GitHub Desktop.
Save alexandre-janniaux/a3ac8c310f9cf0c690705ea9d658ee57 to your computer and use it in GitHub Desktop.

Compile QtGL with powershell

Necessary packages

The packages are installed through choco:

choco install pkgconfiglite
choco install make
choco install mingw

Then install Qt from the online installer1 downloaded from the website.

Install WSL

Follow usual documentation2 from Microsoft to install WSL. On recent Windows (OS build 20262 or higher), you can do that and directly install debian by running:

wsl --install -d Debian

Mount the WSL drive somewhere

Open the file explorer, right-click on «this PC» in the navigation panel on the left, choose «Map a network drive».

A new window opens, choose a drive letter for the network drive (which will be Z:\ here) and choose \\wsl$\Debian as folder.

Check the Reconnect at sign-in, and click finish to validate.

Install libvlc somewhere (from bash)

From WSL or other:

mkdir build-win64
cd build-win64
../extras/package/win32/build.sh -o $(realpath install-win64)
make -C win64 install

Prepare compilation and compile

$env:PKG_CONFIG_PATH="Z:\home\unidan\vlc\build-win64\install-win64\lib\pkgconfig\"
$env:PKG_CONFIG_SYSROOT_DIR=""
$env:PKG_CONFIG_LIBDIR=""

cd Z:\home\unidan\vlc\doc\libvlc\QtGL\
mkdir build
cd build
C:\Qt\5.15.2\mingw81_64\bin\qmake.exe .. 
make

Run the sample

Note that dll are installed into the bin/ folder and not the lib/ folder. For the loader to find them, we need to add this path to the PATH environment variable.

$env:QT_PLUGIN_PATH="C:\Qt\5.15.2\mingw81_64\plugins"
$env:VLC_PLUGIN_PATH="Z:\home\unidan\vlc\build-win64\install-win64\lib\vlc\plugins"
$env:PATH+=";Z:\home\unidan\vlc\build-win64\install-win64\bin\"

.\release\qtglvlc.exe http://hemera.srv.janniaux.me:8080/dog_meme.mp4

Side notes

The powershell part can also be done through QtCreator by setting the build environment3. Beware to not add quotes " for the value of the variable. It's not a shell, so " would get directly into the value of the environment variable.

TODO

  • PDB/debug symbol support for QtCreator in this setup?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment