Guides/Compiling Jqt/Windows

From J Wiki
Jump to: navigation, search
Windows | Linux

Compiling Jqt on Windows using free tools

These instructions are updated to J807, Windows 10 64-bit (only) and Qt 5.9.

You can compile your own verson of Jqt on Windows using the free Microsoft Visual Studio Community 2017. 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, webengine, qml, multimedia, and opengl, and eliminate the need for the corresponding Qt libraries. On a 64-bit Windows system, the full Qt libraries take 130MB while the slim libraries take only 26MB. By compiling your own Jqt, you can selectively remove one or more of the above functions by editing in the Jqt source.

Install Visual Studio Community 2017 for Windows Desktop

Instructions for downloading the free Microsoft Visual Studio Community 2017 can be found at Visual Studio Downloads.

Select the Desktop development with C++ workload. Individual Components and Language packs can be left at their default selections. Install the compiler to the default location.

Install the Qt SDK

Get Qt using the Qt Online Installer for Windows. This requires a (free) Qt Account, and allows you to choose the Qt versions to be installed, as well as to update the installation later on.

Browse to Get Qt, select and download the the Open Source installer (or Commercial installer if necessary for your application).

Run the Qt Online Installer, which presents a list of Qt versions. The 5.9 version is recommended as it is supported in J807, and you may use the latest version in the 5.9 branch (5.9.4 at the time of writing). Install in the default location, C:\Qt.

The components below should be selected, and any others as required:

msvc2017 64-bit
Qt Charts
Qt Data Visualization
Qt WebEngine

Set up the source directory

Set up the source directory (e.g. c:\src), and create an environment script (env64.cmd) in it with the contents below.

@REM Set up Windows SDK for 64bit
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
set PATH=C:\Qt\5.9.4\msvc2017_64\bin;%PATH%
set QMAKESPEC=win32-msvc
cd c:\src

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


Download latest qtide source

Obtain the latest Jqt source 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).

Compile Jqt

To compile Jqt, 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 error message can be ignored.

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

The binaries will be in the folder qtide\bin\win-x86_64\release. Copy the exe and dll files 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.

Set path to Qt binaries

If you do not have the appropriate Qt binaries already in the ~bin directory, then set the path to them in the jqt.cmd script and use it to load J. For example:

@rem load J Qt IDE
@rem run from the J install directory
set PATH=C:\Qt\5.9.4\msvc2017_64\bin;%PATH%
@cd /d %~dp0

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.

Originally contributed by Norman Drinkwater