This article will briefly describe how to get the required dependencies for NifSkope and put them all together. Essentially, compiling NifSkope come down to the following:
- get the NifSkope and Qt source code,
- set up the build environment,
- if necessary, compile Qt, and finally
- compile NifSkope.
Get The NifSkope Source Code
- First, download and install TortoiseSVN.
- Then, open your My Documents folder, create a directory niftools in that folder (right click -> new -> folder).
- Right click on the newly created niftools folder, and select "SVN Checkout" in the context menu.
- In the URL field, put https://niftools.svn.sourceforge.net/svnroot/niftools/trunk.
- Click Ok. The source code will start downloading.
The NifSkope source code should now reside in
C:\Documents and Settings\username\My Documents\niftools\nifskope
for Windows XP, and in
for Windows Vista, where username is your Windows user name. For more information on subversion, see Using SVN.
Getting the Qt Source Code
Go to Trolltech's Qt4 The download links are on the bottom of page, you need the qt-win-opensource-src-x.x.x zip file; at the time of writing, x.x.x is 4.3.3. Extract the zip to a "nice" folder, this is where you Qt library will reside. You cannot just move a Qt folder after you built the library without breaking things. The folder name should not contain any spaces. A choice could be C:\Qt\ For example, move your Qt source zip to C:\Qt, and extract the zip there. The sources end up in the folder C:\Qt\qt-win-opensource-src-4.3.3
Setting Up The Build Environment
- Microsoft Visual C++ Express 2008 Download and install.
- SGI's Extension Library This is a sample implementation of the OpenGL Extensions from SGI. Copy the three header files from the SGI website to your niftools\nifskope\gl folder.
Next, it is useful to create a batch file that sets up all environment variables for you. For example, on 32-bit versions of Windows:
@echo off echo "Setting Visual Studio Environment" call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 echo "Setting Qt Environment" set QTPREFIX=C:\Qt\qt-win-opensource-src-4.3.3 set INCLUDE=%QTPREFIX%\include;%INCLUDE% set LIB=%QTPREFIX%\lib;%LIB% set PATH=%QTPREFIX%\bin;%PATH% cd "\Documents and Settings\username\My Documents"
and on 64-bit versions of Windows:
@echo off echo "Setting Visual Studio Environment" call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 echo "Setting Qt Environment" set QTPREFIX=C:\Qt\qt-win-opensource-src-4.3.3 set INCLUDE=%QTPREFIX%\include;%INCLUDE% set LIB=%QTPREFIX%\lib;%LIB% set PATH=%QTPREFIX%\bin;%PATH% cd "\Users\username\Documents"
Copy and paste this in your editor. It will probably not work on your system; adapt the paths to reflect your install environment. Save as buildenv.bat and put it on your My Documents folder. Right click and "Send to Desktop". This will create a shortcut on your Desktop. Right-click on this shortcut just created, select properties, and change the target into
%comspec% /k "C:\Documents and Settings\username\My Documents\buildenv.bat"
for Windows XP, and
%comspec% /k "C:\Users\username\Documents\buildenv.bat"
for Windows Vista, where username is your Windows user name.
Run the buildenv.bat link you just created on your Desktop. This will open up your development console. If you type
then you get a list of all environment variables. The variables INCLUDE, LIB, and PATH should reflect the proper locations of the MSVC and QT include, lib, and bin directories. If not then you may have a typo in your buildenv.bat file, in which case you need to fix the typo and run the link again.
Once ensured that the environment variables INCLUDE, LIB, and PATH are correctly set, type
You should now be in the Qt library folder. To start the compilation process, type
configure.exe -static -release -platform win32-msvc2005
This means we are configuring Qt to use MSVC and to link statically. Carefully read the instructions on screen, select "Yes" when asked. A tool called "qmake" will be compiled. Finally, a message will prompt you to start the building process by typing
Qt should now compile. This might take some time.
There are two ways to build NifSkope with Qt. Pick your favorite.
Via QMake + NMake
Still in the console, cd to your NifSkope checkout, and run qmake and nmake:
cd "\Documents and Settings\username\My Documents\niftools\nifskope" qmake nmake
or on Windows Vista:
cd "\Users\username\Documents\niftools\nifskope" qmake nmake
Your NifSkope.exe will now reside in the release directory. Note that you only need to run qmake the very first time you compile NifSkope.
Via QMake + MSVC Project
Still in the console, cd to your NifSkope checkout, and run qmake to create a project file:
cd "\Documents and Settings\username\My Documents\niftools\nifskope" qmake -t vcapp
or on Windows Vista:
cd "\Users\username\Documents\niftools\nifskope" qmake -t vcapp
This will create a file called NifSkope.vcproj in your nifskope folder. Open that with MSVC.
Go to the "Build" menu and select "Build Solution". The first time you do this you will be asked to save the solution file. Just save it in the nifskope directory as well. NifSkope should now build! At the end of the process, your NifSkope.exe should be in the release directory.
Building NifSkope under Fedora and Ubuntu is fairly straightforward as both come bundled with Qt 4.
Getting Qt and Subversion
First grab qt and subversion from the repository if you do not already have it. Below are the commands for doing so depending on whether you run Fedora or Ubuntu.
su yum install qt4 qt4-devel qt4-x11 subversion exit
Get The NifSkope Source Code
Now you have Qt and subversion, grab the NifSkope source code:
cd svn co https://niftools.svn.sf.net/svnroot/niftools/trunk niftools
Finally, run qmake and make:
cd niftools/nifskope qmake-qt4 make
Note that if you have multiple cores, you can type make -j N where N is the number of cores you have. The compilation will run N times faster. Finally, type
and you can start enjoying NifSkope on your linux box!