Guides/Compiling Jqt/Windows

From J Wiki
< Guides‎ | Compiling Jqt(Redirected from Guides/Compiling Jqt)
Jump to navigation Jump to search
Windows | macOS | Linux

[Category:Qt IDE R.12.3]]

Compiling Jqt on Windows using free tools

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

You can compile your own version 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 http://www.jsoftware.com/download/j901/qtide . These binaries remove the functionality for webengine and multimedia, and eliminate the need for the corresponding Qt libraries. On a 64-bit Windows system, the full Qt libraries take 141MB while the slim libraries take only 28MB. By compiling your own Jqt, you can selectively remove one or more of the above functions by editing lib.pro in the Jqt source.

Install Visual Studio Community 2017 for Windows Desktop

The binaries in the Qt sdk were built with Microsoft Visual Studio 2017. You can download the free Microsoft Visual Studio Community 2017 from Visual Studio Older Downloads. You may need to sign up for the free Dev Essentials membership to download the installer. The current version, Microsoft Visual Studio Community 2019, is available from Download Visual Studio . VS 2019 is binary compatible with VS 2017 and has been used to successfully build Jqt.

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 Offline 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 Download Offline Installers, select and download the desired version of the Qt sdk. The released versions of Jqt are always built with LTS (Long Term Support) versions of the sdk. The most recent (at the time of this writing) version of the sdk is Qt 5.12.7. You may also use a more recent version of the sdk. For example, Jqt has been successfully compiled using the Qt 5.14.1 sdk.

Run the Qt Offline Installer, which presents a list of Qt components. Install in the default location, C:\Qt. The components below should be selected, and any others as required:

msvc2017 64-bit
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
set PATH=C:\Qt\Qt5.12.7\5.12.7\msvc2017_64\bin;%PATH%
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"

If you are using Visual Studio Community 2019, change the 2017 to 2019 in the third line above. If you are using a different version of the sdk, set the path in line 2 as appropriate.

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

set JQTSLIM=JQTSLIM

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\lib.pro 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.

env64.cmd
cd qtide\lib
qmake
nmake
cd ..\main
qmake
nmake
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\Qt5.12.7\5.12.7\msvc2017_64\bin;%PATH%
set QT_PLUGIN_PATH=C:\Qt\Qt5.12.7\5.12.7\msvc2017_64\plugins
@cd /d %~dp0
bin\jqt.exe

Revise the paths above to reflect the Qt sdk installed on your system. Alternatively, you can install the Qt libraries from the Jsoftware website (using install'qtide' and replace the Qt libraries in the J901 bin directory with those from your installed sdk. You should also copy the appropriate plugin folders from the Qt sdk to the J901 bin directory.

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