Developing Environment

To set up the developing environment you should have prepared a developing VM or PC as documented in VM Setup for Development.

The Qt 5.4.2 toolset described here is used for BPS 2.22.0.2 and up.

The setup is somewhat trickier than earlier versions because it must now support 32 and 64 bit development side by side. By following this guide step-by-step it should be possible to master the set up without problems, but it is essential to follow the order as given.

Note that during the setup not all applications will work because the matching DLL's will not yet be found. The required links and settings will get applied in the step Automate Proper DLL Loading, please wait until then.

Visual Studio 2013

    • Note: Neither the german ISO nor the german online installer worked for me, both failed with eror signature can not be verified. Uninstalling, rebooting and then using the english online installer however worked.
  • After first start, sign in with your Microsoft account.
  • Exit the Visual Studio IDE.

Debugging Tools

In Visual Studio 2013 the CDB debugger is not included. To be able to debug from Qt Creator you need to install it from the Windows SDK:

  • Download Windows 8.1 SDK Installer from Microsoft
  • Run sdksetup.exe
    • Specify Location
      • (o) Install the SDK to this computer
        • Install Path: C:\Program Files\Windows Kits\8.1\
    • Join Customer Experience Improvement Program
      • No
    • License Agreement
      • Accept
    • Select the features you want to install
      • [x] Debugging Tools for Windows
      • Uncheck the rest

PostgreSQL

Database software.

Homepage: http://www.postgresql.org/

Download the binaries in zip files for 32 bit and 64 bit .

  • postgresql-9.4.1-3-windows-binaries.zip
    • 7-Zip
      • Extract files…
      • to: C:\dev\
  • Rename C:\dev\pgsql to C:\dev\pgsql32

Initialize new cluster

Run from command line:

mkdir C:\dev\pgsql32\data
mkdir C:\dev\pgsql32\log
cd /d C:\dev\pgsql32\bin
initdb -U postgres -E utf8 -W -D C:\dev\pgsql32\data

Enter new password for user postgres twice

Running the server

Create file C:\dev\bat\pgrun32.bat:

@echo off
cd /d C:\dev\pgsql32\bin
pg_ctl -o "-p 5432" -w -D C:\dev\pgsql32\data -l C:\dev\pgsql32\log\pgsql.log start
pause
pg_ctl -w -D C:\dev\pgsql32\data stop 

Create the shortcut PgSQL 32 Bit Server on 5432 in C:\dev:

  • Target: %COMSPEC% /c pgrun32.bat
  • Execute in: C:\dev\bat

Repeat all analogous for the 64 bit version, but use port 5464 instead.

Oracle Instant Client

Slim client software and sdk for Oracle.

Homepage: http://www.oracle.com/technetwork/database/features/instant-client/index.html

  • Right click on instantclient-basic-windows.x64-11.2.0.4.0.zip
    • 7-Zip
      • Extract files…
      • to: C:\dev\oracle64
  • Right click on instantclient-sdk-windows.x64-11.2.0.4.0.zip
    • 7-Zip
      • Extract files…
      • to: C:\dev\oracle64
  • Rename:
    • C:\dev\oracle64\instantclient_11_2
    • C:\dev\oracle64\instantclient
  • Right click on instantclient-basic-nt-11.2.0.4.0.zip
    • 7-Zip
      • Extract files…
      • to: C:\dev\oracle32
  • Right click on instantclient-sdk-nt-11.2.0.4.0.zip
    • 7-Zip
      • Extract files…
      • to: C:\dev\oracle32
  • Rename:
    • C:\dev\oracle32\instantclient_11_2
    • C:\dev\oracle32\instantclient
  • Create d:\dev\oracle64\tnsnames.ora.
    For example as:
    JUPITER =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = jupiter)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = jupiter.ibkdev)
        )
      )
  • Add to the begin of the system variable PATH:
    • C:\dev\oracle64\instantclient\
  • Add new system environment variable:
    • TNS_ADMIN=C:\dev\oracle64

Oracle SQL Developer

Homepage: http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html

  • Download the Windows 64-bit zip file including JDK 7
  • Right click on sqldeveloper-4.0.3.16.84-x64.zip
    • 7-Zip
      • Extract files…
      • to: C:\dev\oracle64
  • Do not yet run sqldeveloper, wait til after Automate proper DLL loading

Jom

Replacement for nmake, compiles on multiple CPU cores simultaneously.

Homepage: http://wiki.qt.io/Jom

Download latest binary release.

  • Right click on jom.zip
    • 7-Zip
      • Extract files…
      • to: C:\dev\jom

Perl

Required for Qt build.

Homepage: http://www.activestate.com/activeperl

  • Download free community edition
  • ActivePerl-5.20.2.2001-MSWin32-x64-298913.msi
  • Change location:
    • C:\dev\perl\
  • Unselect features:
    • Documentation
    • Examples
  • Uncheck:
    • [ ] Add Perl to the PATH environment variable
    • [ ] Create Perl file extension association

Python

Required for Qt build.

Homepage: http://www.python.org

  • python-3.4.3.msi
  • Install to C:\dev\python
  • Rest as proposed

Ruby

Required for Qt build (QtWebKit).

Homepage: http://rubyinstaller.org/

  • rubyinstaller-2.2.1-x64.exe
  • Install to C:\dev\ruby
  • Rest as proposed

NASM

Net-wide Assembler. Required for OpenSSL build.

Homepage: http://www.nasm.us/

  • Right click on nasm-2.11.08-win32.zip
    • 7-Zip
      • Extract files…
      • to: C:\dev
  • Rename C:\dev\nasm-2.11.08 to C:\dev\nasm

ICU

International Components for Unicode. Required for Qt build (QtWebKit).

Homepage: http://site.icu-project.org/

Build Custom Binaries

If you want the full ICU with 25MB footprint in the BPS installation, proceed to Build. The following smaller data library will reduce the memory footprint to 8MB:

  • Customize smaller data library in http://apps.icu-project.org/datacustom/
    • [ ] Charset Mapping Tables
    • [x] Break Iterator
      • [x] German
      • [x] English (United States, Computer)
      • [x] French
      • [x] Italian
      • (plus all automatically selected)
    • [x] Collators
      • [x] German
      • [x] English (United States, Computer)
      • [x] French
      • [x] Italian
      • (plus all automatically selected)
    • [x] Rule Based Number Format
      • [x] German
      • [x] English
      • [x] French (Switzerland)
      • [x] Italian
      • (plus all automatically selected)
    • [x] Transliterators
      • [x] English
      • (plus all automatically selected)
    • [x] Formatting, Display Names and Other Localized Data
      • [x] German (Switzerland)
      • [x] English (Europe)
      • [x] French (Switzerland)
      • [x] Italian (Switzerland)
      • (plus all automatically selected)
    • [x] Miscellaneous Data
      • [x] German (Switzerland)
      • [x] English (Europe)
      • [x] French
      • [x] Italian
      • (plus all automatically selected)
    • Base Data
  • Download package
  • Right click on icudt55l.zip
    • 7-Zip
      • Extract files…
      • to: C:\dev\icu\source\data\in

Build:

  • Edit C:\dev\icu\source\common\unicode\platform.h
    • Insert below include's:
      #define U_CHARSET_IS_UTF8 1
  • Open VS Solution: C:\dev\icu\source\allinone\allinone.sln
  • Accept Upgrade VC++ Compiler and Libraries for all projects
  • Select Release and x64 in the toolbar
  • BUILDBuild Solution
  • Select Release and Win32 in the toolbar
  • BUILDBuild Solution

Finally:

  • Delete all except:
    • C:\dev\icu\bin\
    • C:\dev\icu\bin64\
    • C:\dev\icu\include\
    • C:\dev\icu\lib\
    • C:\dev\icu\lib64\

OpenSSL

Required for Qt build.

Homepage: http://www.openssl.org/

  • Download latest source tarball

Build 64 bit:

  • Right click on openssl-1.0.2a.tar.gz
    • 7-Zip
      • Extract here
  • Right click on openssl-1.0.2a.tar
    • 7-Zip
      • Extract files…
      • to: C:\dev
  • Rename C:\dev\openssl-1.0.2a to C:\dev\openssl64
  • Start / All programs / Visual Studio 2013 / Visual Studio Tools
  • Run VS2013 x64 Cross Tools Command Prompt
  • cd \dev\openssl64
  • perl Configure VC-WIN64A --prefix=c:\dev\openssl64
  • ms\do_win64a.bat
  • nmake -f ms\ntdll.mak
  • cd out32dll
    • ..\ms\test
  • cd ..
    • nmake -f ms\ntdll.mak install

Build 32 bit:

  • Right click on openssl-1.0.2a.tar
    • 7-Zip
      • Extract files…
      • to: C:\dev
  • Rename C:\dev\openssl-1.0.2a to C:\dev\openssl32
  • Start / All programs / Visual Studio 2013 / Visual Studio Tools
  • Run VS2013 x86 Native Tools Command Prompt
  • cd \dev\openssl32
  • perl Configure VC-WIN32 --prefix=c:\dev\openssl
  • ms\do_nasm.bat
  • nmake -f ms\ntdll.mak
  • nmake -f ms\ntdll.mak test
  • nmake -f ms\ntdll.mak install

Deploy and clean up:

  • Create C:\dev\openssl
  • Copy:
    • C:\dev\openssl64\binC:\dev\openssl\bin64
    • C:\dev\openssl64\libC:\dev\openssl\lib64
    • C:\dev\openssl32\binC:\dev\openssl\bin
    • C:\dev\openssl32\libC:\dev\openssl\lib
    • C:\dev\openssl32\includeC:\dev\openssl\include
  • Delete:
    • C:\dev\openssl32\
    • C:\dev\openssl64\

Prepare Qt

We use the commercial edition. Technically the open source edition should also work (with minor changes) if the license conditions allow it in your case.

  • Open qt-license.txt with notepad++
  • Save as C:\Users\<yourname>\.qt-license
  • Right click on qt-everywhere-enterprise-src-5.4.2.zip
    • 7-Zip
      • Extract files…
      • to: C:\dev
  • Rename C:\dev\qt-everywhere-enterprise-src-5.4.2 to C:\dev\qt64

Apply patches:

  • C:\dev\qt64\qtbase\src\corelib\global\qglobal.cpp
    • Comment lines 2028 and 2029 with the warning “Qt: Untested Windows…”
  • C:\dev\qt64\qtbase\src\widgets\itemviews\qlistwidget.h
    C:\dev\qt64\qtbase\src\widgets\widgets\qcombobox.h
    • Move “addItems” to “public Q_SLOTS”
  • C:\dev\qt64\qtbase\src\corelib\kernel\qvariant.h
    • Insert at end of file, immediately before QT_END_NAMESPACE:
      Q_CORE_EXPORT const QVariant::Handler* userVariantHandler();
      Q_CORE_EXPORT void setUserVariantHandler(const QVariant::Handler* aHandler);
  • C:\dev\qt64\qtbase\src\corelib\kernel\qvariant.cpp
    • Insert after function QVariantPrivate::registerHandler (approx. line 969):
      Q_CORE_EXPORT const QVariant::Handler* userVariantHandler()
      {
      	return handlerManager[QMetaType::User];
      }
       
      Q_CORE_EXPORT void setUserVariantHandler(const QVariant::Handler* aHandler)
      {
      	handlerManager.registerHandler(QModulesPrivate::Unknown, aHandler);
      }
  • C:\dev\qt64\qtbase\src\network\socket\qlocalsocket_win.cpp
    • Change statement in line 146:
          if (d->serverName.startsWith(QLatin1String("\\\\")/*pipePath*/))
  • C:\dev\qt64\qtbase\src\printsupport\kernel\qprintengine_win.cpp
    • In function QWin32PrintEnginePrivate::setPageSize(const QPageSize &pageSize) starting approx. at line 1580
    • Replace: printerPageSize.isValid()
      by: pageSize.id()!=QPageSize::Custom && printerPageSize.isValid()
    • In line 1589 approximately:
          const QPageSize usePageSize = pageSize.id()!=QPageSize::Custom && printerPageSize.isValid() ? printerPageSize : pageSize;
    • In line 1595 approximately:
          if (pageSize.id()!=QPageSize::Custom && printerPageSize.isValid()) {
  • Copy: C:\dev\qt64 to C:\dev\qt32

Qt Build Command Prompts

Create C:\dev\bat\qtbuildenv.bat:

@echo off
if "%1" == "32" goto setenv32
	call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
	PATH=C:\dev\qt64\qtbase\bin;C:\dev\qt64\gnuwin32\bin;%PATH%
	set INCLUDE=C:\dev\icu\include;%INCLUDE%
	set INCLUDE=C:\dev\openssl\include;%INCLUDE%
	set LIB=C:\dev\icu\lib64;%LIB%
	set LIB=C:\dev\openssl\lib64;%LIB%
	goto setenv
:setenv32
	call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
	PATH=C:\dev\qt32\qtbase\bin;C:\dev\qt32\gnuwin32\bin;%PATH%
	set INCLUDE=C:\dev\icu\include;%INCLUDE%
	set INCLUDE=C:\dev\openssl\include;%INCLUDE%
	set LIB=C:\dev\icu\lib;%LIB%
	set LIB=C:\dev\openssl\lib;%LIB%
:setenv
PATH=C:\dev\ruby\bin;%PATH%
PATH=C:\dev\python;C:\dev\python\Scripts;%PATH%
PATH=C:\dev\perl\site\bin;C:\dev\perl\bin;%PATH%
PATH=C:\dev\nasm;%PATH%
PATH=C:\dev\jom;%PATH%
cd /d %~dp0

Create the shortcut Qt32 Command Prompt:

  • Target: %COMSPEC% /k qtbuildenv.bat 32
  • Execute in: C:\dev\bat

Create the shortcut Qt64 Command Prompt:

  • Target: %COMSPEC% /k qtbuildenv.bat 64
  • Execute in: C:\dev\bat

Build Qt

Run Qt64 Command Prompt:

  • cd qt64
  • configure -platform win32-msvc2013 -commercial -qt-pcre -qt-libpng -qt-zlib -qt-libjpeg -nomake examples -nomake tests -make-tool jom
  • Confirm license question with y
  • jom
  • jom docs

Run Qt32 Command Prompt:

  • cd qt32
  • configure -platform win32-msvc2013 -commercial -qt-pcre -qt-libpng -qt-zlib -qt-libjpeg -nomake examples -nomake tests -make-tool jom
  • Confirm license question with y
  • jom

(Don't build docs for qt32, those in qt64 are enough)

Prepare Qt Solutions

Qt solutions are hosted at the Qt git archive.

  • Click Download and save archive.
  • Right click on qt-solutions-qt-solutions-fd22bee22274975c56f1c10d87ee9fd2c0818f83.tar.gz
    • 7-Zip
      • Extract here
  • Right click on qt-solutions-qt-solutions-fd22bee22274975c56f1c10d87ee9fd2c0818f83.tar
    • 7-Zip
      • Extract here
  • Create folder C:\dev\qtsol64
  • Copy directories from qt-solutions-qt-solutions-master to C:\dev\qtsol64:
    • qtpropertybrowser
    • qtservice
    • qtsingleapplication

Patches:

  • C:\dev\qtsol64\qtpropertybrowser\common.pri:
    QTPROPERTYBROWSER_LIBNAME = $$qtLibraryTarget(QtSolutions_PropertyBrowser-head)
    QTPROPERTYBROWSER_LIBNAME = $$qtLibraryTarget(QtPropertyBrowser)
  • C:\dev\qtsol64\qtservice\common.pri:
    QTSERVICE_LIBNAME = QtSolutions_Service-head
    QTSERVICE_LIBNAME = QtService
  • C:\dev\qtsol64\qtsingleapplication\common.pri:
    QTSINGLEAPPLICATION_LIBNAME = $$qtLibraryTarget(QtSolutions_SingleApplication-head)
    QTSINGLEAPPLICATION_LIBNAME = $$qtLibraryTarget(QtSingleApplication)
  • C:\dev\qtsol64\qtsingleapplication\src\qtsingleapplication.cpp:
    • Append to header includes:
      #if defined(Q_OS_WIN)
      #include <windows.h>
      #endif
    • Insert to sysInit(…):
      #if defined(Q_OS_WIN)
      AllowSetForegroundWindow(ASFW_ANY);
      #endif
  • Copy: C:\dev\qtsol64 to C:\dev\qtsol32

Build Qt Solutions

Run Qt64 Command Prompt:

  • cd \dev\qtsol64\qtpropertybrowser
    • configure -library
    • qmake
    • jom
    • cd doc\html
    • qhelpgenerator qtpropertybrowser.qhp
  • cd \dev\qtsol64\qtservice
    • configure -library
    • qmake
    • jom
    • cd doc\html
    • qhelpgenerator qtservice.qhp
  • cd \dev\qtsol64\qtsingleapplication
    • configure -library
    • qmake
    • jom
    • cd doc\html
    • qhelpgenerator qtsingleapplication.qhp

Run Qt32 Command Prompt:

  • cd \dev\qtsol32\qtpropertybrowser
    • configure -library
    • qmake
    • jom
  • cd \dev\qtsol32\qtservice
    • configure -library
    • qmake
    • jom
  • cd \dev\qtsol32\qtsingleapplication
    • configure -library
    • qmake
    • jom

Automate proper DLL loading

Create C:\dev\bat\makelinks.bat:

@echo off 
setlocal
rem Check or get admin privileges
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    exit /b
:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
 
rem Create links
call :makelink dev.icu C:\dev\icu\bin C:\dev\icu\bin64
call :makelink dev.openssl C:\dev\openssl\bin C:\dev\openssl\bin64
call :makelink dev.qt C:\dev\qt32\qtbase\bin C:\dev\qt64\qtbase\bin
call :makelink dev.oracle C:\dev\oracle32\instantclient C:\dev\oracle64\instantclient
call :makelink dev.pgsql.bin C:\dev\pgsql32\bin C:\dev\pgsql64\bin
call :makelink dev.pgsql.lib C:\dev\pgsql32\lib C:\dev\pgsql64\lib
call :makelink dev.bps C:\dev\bps\Release32\bin C:\dev\bps\Release64\bin
pause
goto :eof
 
:makelink
if exist %SystemRoot%\SysWOW64\%1 rmdir /q %SystemRoot%\SysWOW64\%1
if exist %SystemRoot%\System32\%1 rmdir /q %SystemRoot%\System32\%1
mklink /d %SystemRoot%\SysWOW64\%1 %2
mklink /d %SystemRoot%\System32\%1 %3
  • Run makelinks.bat to create the links.
  • Add to PATH in system environment variables:
    • %SystemRoot%\System32\dev.icu
    • %SystemRoot%\System32\dev.openssl
    • %SystemRoot%\System32\dev.qt
    • %SystemRoot%\System32\dev.oracle
    • %SystemRoot%\System32\dev.pgsql.lib
    • %SystemRoot%\System32\dev.pgsql.bin
    • %SystemRoot%\System32\dev.bps

From now on the right DLL's for 32 or 64 bit applications will be found automatically.

Qt Assistant Usage

Run Qt Assistant in C:\dev\qt64\qtbase\bin:

  • Pin to taskbar
  • Wait for indexing to finish at first run.
  • Edit - Preferences - Documentation - Add…
    • C:\dev\qtsol64\qtpropertybrowser\doc\html\qtpropertybrowser.qch
    • C:\dev\qtsol64\qtservice\doc\html\qtservice.qch
    • C:\dev\qtsol64\qtsingleapplication\doc\html\qtsingleapplication.qch

Qt Creator

Build from source

  • qt-creator-enterprise-src-3.4.1.zip
  • Right click
    • 7-Zip
      • Extract files…
      • to: C:\dev
  • Rename C:\dev\qt-creator-enterprise-src-3.4.1 to C:\dev\qtcre64

Run Qt64 Command Prompt:

  • cd qtcre64
  • qmake -r CONFIG-=debug
  • jom
  • jom docs

Usage

Propably qt creator would at this point show an error because a DLL reguired for the OpenGL interface (Angle) in Qt is not yet found.

Add the following to the PATH of the system environment to solve it:

  C:\Program Files (x86)\Windows Kits\8.1\bin\x64

You should now be able to start C:\dev\qtcre64\bin\qtcreator.exe without any errors shown.

Pin Qt Creator to the taskbar.

Setup

  • Tools/Options…/Environment
    • General
      • Language: English
    • External Tools
      • Uncategorized
        • Add Tool
          • Name: Translate
          • Description: Translate subproject of current open .pro file
          • Executable: cmd
          • Arguments: /c translate.bat %{CurrentDocument:Path}
          • Working directory: %{CurrentProject:Path}
          • Output: Show in Pane
          • Error output: Show in Pane
          • [ ] Modifies current document
          • Input:
        • Apply
    • Keyboard
      • Tools
        • External.Translate
          • Ctrl+Alt+T
        • Apply
  • Tools/Options…/Build & Run
    • General
      • Projects Directory
        • (o) Directory: C:\dev
      • Build & Run
        • [x] Save all files before build
        • [x] Open Compile Output pane when building
        • [x] Open Application Output pane on output when running
        • [x] Use jom instead of nmake
        • [x] Clear old application output on a new run
        • [x] Merge stderr and stdout
        • [x] Word wrap application output
        • Limit application output to 100000 lines
        • Default build directory: ../%{CurrentBuild:Name}%{CurrentKit:FileSystemName}
    • Qt Versions
      • Add…
        • C:\dev\qt32\qtbase\bin\qmake.exe
    • Kits
      • Add
        • Name: Desktop 32 Bit
        • File system name: 32
        • Device type: Desktop
        • Device: Local PC (default for Desktop)
        • Sysroot:
        • Compiler: Microsoft Visual C++ Compiler (x86)
        • Environment: No changes to apply.
        • Debugger: Auto-detected CDB at …\x86\cdb.exe
        • Qt version: Qt 5.4.2 (qt32)
        • Qt mkspec:
      • Edit Desktop … (default)
        • Name: Desktop 64 Bit
        • File system name: 64
        • (rest unchanged)
  • Tools/Options…/Help
    • Documentation
      • Add…
        • C:\dev\qtsol64\qtpropertybrowser\doc\html\qtpropertybrowser.qch
        • C:\dev\qtsol64\qtservice\doc\html\qtservice.qch
        • C:\dev\qtsol64\qtsingleapplication\doc\html\qtsingleapplication.qch
  • Help/About Plugins…
    • Unckeck:
      • [ ] Build Systems / CMakeProjectManager
      • [ ] Build Systems / QbsProjectManager
      • [ ] Device Support
      • [ ] Version Control

Saving Space

In case you want to save space you can activate compression on selected folders in C:\dev. We do this without any noticable problems or speed impacts for example on the following folders which are more or less static once the system is complete:

  • oracle32
  • oracle64
  • perl
  • pgsql32 (excluding subfolders data and log)
  • pgsql64 (excluding subfolders data and log)
  • python
  • qt32
  • qt64
  • qtcre64
  • qtsol32
  • qtsol64
  • ruby

This is how to do it:

  • Right click on the folder
    • Properties
      • General
        • Advanced…
          • [x] Compress contents to save disk space
          • OK
        • OK
        • (o) Apply changes to this folder, subfolders and files
        • OK
  • The folder is displayed blue after compression
  • You can switch off compression of the folder or any subfolders again by unchecking the option.

What Next

Proceed from here either to Custom Apps and Plugins if you want to develop your own components, or to Core Development if you want to develop on the BPS core itself.

Comments and Discussion

Enter your comment. Wiki syntax is allowed: