Guides/Compiling Jqt

From J Wiki
Jump to: navigation, search

Compiling Jqt on Windows using free tools

These instructions are updated to J804.

You can compile your own verson of Jqt on Windows using the free Microsoft Visual Studio Express 2013. You may want to do so if you are adding new functions to Jqt or wish to restrict the set of Qt libraries required for a standalone application (see Standalone, cross-platform applications in J8).

Slim versions of Jqt are available from . These binaries remove the functionality for websockets, webkit, qml, and opengl, and eliminate the need for the corresponding Qt libraries. On a 64-bit Windows system, the full installation of Jqt has 97MB in ~bin, while the slim installation requires only 23MB. By compiling your own Jqt, you can selectively remove one or more of the above functions by editing in the Jqt source.

Brief instructions for compiling Jqt on Windows 7 or Windows 8 are provided below.

1. Install Visual Studio Express 2013 for Windows Desktop

The free version of the Microsoft compiler can be downloaded from Search for Visual Studio Express 2013 for Windows Desktop and install the latest version. Note that you must install the version for Windows Desktop, not the Express 2013 for Web or the Express 2013 for Windows versions. Download the compiler and install it to the default location.

2. Install the Qt SDK

The installers are available at . Note that versions of the Qt SDK that use the ANGLE library in place of OpenGL are also available (the same file names without "_opengl").

If you want to compile both 64-bit and 32-bit versions of Jqt, you will need to download and install both versions of the Qt SDK.

  • for 32-bit, download qt-opensource-windows-x86-msvc2013_opengl-5.4.2.exe and install it to C:\Qtx86\Qt5.4.2
  • for 64-bit, download qt-opensource-windows-x86-msvc2013_64_opengl-5.4.2.exe and install it to the default location (C:\Qt\Qt5.4.2).

3. Set up the source directory

First set up the source directory (e.g., c:\src). To compile the 64-bit version, create an environment script (env64.cmd) in the source folder with the following contents:

REM Set up Windows SDK for 64bit
CALL "c:\program files (x86)\microsoft visual studio 12.0\vc\bin\x86_amd64\vcvarsx86_amd64.bat"
set PATH=c:\qt\qt5.4.2\5.4\msvc2013_64_opengl\bin;%PATH%
set QMAKESPEC=win32-msvc2013

To compile a slim version of jqt (no icu, webkit, opengl...), copy env64.cmd to env64slim.cmd and add the line:


To compile the 32-bit version, create an environment script (env32.cmd) with the following contents:

REM Set up Windows SDK for 32bit xp compatible
CALL "c:\program files (x86)\microsoft visual studio 12.0\vc\bin\vcvars32.bat"
set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
set PATH=c:\qtx86\qt5.4.2\5.4\msvc2013_opengl\bin;%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
set CL=/D_USING_V110_SDK71_;%CL%
set QMAKESPEC=win32-msvc2013

This environment will use the Windows 7.1 SDK (rather than that for Windows 8) and will allow the executables to run on 32-bit versions of Windows XP. Again, copy env32.cmd to env32slim.cmd and add set JQTSLIM=JQTSLIM to allow compiling a slim version. Note that the above allows compilation of jqt that will run on Windows XP (32-bit) through Windows 8.1.

4. Download latest qtide source

Obtain the latest Jqt source from [1] or from the Git repository. Place a copy of the source folder (e.g., qtide) in the src folder. You can modify the contents of the file qtide\lib\ to selectively remove Jqt functions as needed (how to do so will become obvious from reading the file).

5. Compile Jqt

To compile the 64-bit version, open a command prompt in the src directory and execute the following (waiting for each to complete before going to the next):

Note: the final copy command in the first qmake may fail with a message 'error copying file to itself'. This is OK; you will rename the file in the final step below.

cd qtide\lib
cd ..\main
cd ..\

The binaries will be in the folder qtide\bin\win-x86_64\release. You will need to rename the dll from jqt1.dll to jqt.dll. Also rename the .manifest file accordingly. Copy the exe, dll, and manifest file to your ~bin directory and you are good to go. If you want to compile binaries that remove all of the non-core functionality, substitute env64slim.cmd for env64.cmd above.

To compile the 32-bit version of Jqt, open a new command prompt in the src directory and proceed as above, executing env32.cmd or env32slim.cmd as the first command.

6. After you make changes

If you change the source code, you need to re-make the binaries with your changes. You don't need to rerun qmake; just run nmake in each directory.

If you Pull files from the repository, the filedates may confuse nmake, and you may end up with downlevel modules. In this case run nmake -all to get a clean start.

Contributed by Norman Drinkwater, 7/2014