Skip to content

Compiling with Qt Creator (Windows)

jonwd7 edited this page May 28, 2017 · 4 revisions

Installing Qt

To install you simply need the Qt Online Installer.

Optional

  • Visual Studio 2017 Community, for the msvc2017 compiler.
  • sed for Windows, via GnuWin32, Cygwin, or the GitHub Desktop /usr/bin. Used to update README.md during builds.
  • jom (or mingw32-make) for the optional build targets release-docs and release-doxygen
  • Python for release-docs build target. This build target creates the HTML documentation from nif.xml
  • Doxygen for release-doxygen build target. This build target creates the API documentation for NifSkope.

Configuration

You must install Qt binaries for either MinGW or MSVC. If you install both, it is recommended that you install msvc2017 64-bit and MinGW 5.3.0 32-bit. You must have VS2017 installed to use the prebuilt msvc2017 binaries. That configuration looks like so:


(Note: At the time of writing Qt 5.9 is still in RC status. It will say only "Qt 5.9" in the future)

If you do not have VS2017 or do not want the msvc2017 64-bit package, simply uncheck it. The online installer should automatically install Qt Creator for you as well as the necessary MinGW compilers.

Downloading NifSkope

This guide assumes that you have cloned from git@github.com:niftools/nifskope.git and did so with the --recursive option or ran git submodule update after.

Opening the NifSkope project

In Qt Creator, open NifSkope.pro in the project root. It should ask you to select the build kits for the project. Select at minimum Desktop Qt 5.9.0 MinGW 32bit. It will look something like this:


Note: By default Qt Creator will "shadow build", meaning to build outside of the project directory. You need to allow it to do this, but you can change the path that it chooses. For example, my NifSkope project is in Documents\GitHub\nifskope and by default it will want to build in Documents\GitHub\. I do not want the builds in my GitHub folder, so I have changed this to Documents\Qt\ in the image above. It will create this folder for you if it does not exist. You will have to change the path twice, once for Release configuration and once for Debug configuration.

Multithreaded compiling with MinGW

If you want to compile much faster with MinGW, you need to add -j to the Make Arguments for your kit like so:


Note: The -j command will create as many processes as it can and your computer will become unusable while it compiles (40s to 1min). Windows MinGW cannot use -jN where N is the number of desired processes.

Compiling NifSkope

To assure your Makefile is up-to-date, right-click in the Projects pane on NifSkope (or use the Build menu), and select Run qmake. Then select Build and wait for it to compile. If you receive any third-party library errors, you have not run git submodule update.

Optional make targets

NifSkope has two optional make targets that you may run before or after building.

release-docs

This builds the HTML documentation for nif.xml. If it is packaged with NifSkope it can be viewed in the Reference Browser pane from inside NifSkope. Python is required as well as jom/mingw32-make. From the Makefile directory run:

jom release-docs

release-doxygen

This builds the API documentation for NifSkope. Doxygen is required as well as sed, 7zip (or unzip on linux), and jom/mingw32-make. From the Makefile directory run:

jom release-doxygen

Packaging NifSkope

The build process defined by NifSkope.pro is set up to copy everything needed for a release to the build directory. This includes (non-comprehensive):

imageformats/ (Qt Plugins)
platforms/    (Qt Plugins)
shaders/      (OpenGL shaders)
kfm.xml*
nif.xml*
Qt5core.dll
Qt5gui.dll
Qt5network.dll
Qt5opengl.dll
Qt5widgets.dll
Qt5xml.dll
style.qss*

*: As of this writing these files do not copy to the build dir for developmental reasons. You can uncomment copyFiles( $$XML $$QSS ) in NifSkope.pro to make them copy on build.

For MinGW/gcc builds, it will also copy the necessary libstdc++, libgcc, and libwinpthread DLLs on build.