Configure Qt development on Windows + Mac + linux: Difference between revisions

From Bitpost wiki
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 19: Line 19:


== Windoze ==
== Windoze ==
This gives a Windoze static build of Qt 5.2, yay!
This gives a Windoze static build of Qt 5.3.0, yay!


* Get latest OpenSSL source from [http://www.openssl.org/source/ here], unzip to C:\openssl-1.0.1f.
* Get latest OpenSSL source from [http://www.openssl.org/source/ here], unzip to C:\openssl-1.0.1g.
* Get the latest Qt source, unzip to C:\Qt\qt-everywhere-opensource-src-5.2.0.
* Get the latest Qt source, unzip to C:\Qt\qt-everywhere-opensource-src-5.3.0.
* Get jom from here if you want a faster build: [http://qt-project.org/wiki/jom jom]
* Get jom from here if you want a faster build: [http://qt-project.org/wiki/jom jom]
* Open a VS Developer Prompt and build OpenSSL:
* Open a VS Developer Prompt and build OpenSSL:
  cd C:\openssl-1.0.1f
  cd C:\openssl-1.0.1g
  perl Configure VC-WIN32 no-asm --prefix=C:\openssl-1.0.1f\mdm
  perl Configure VC-WIN32 no-asm --prefix=C:\openssl-1.0.1g\mdm
  ms\do_ms
  ms\do_ms
  nmake -f ms\nt.mak
  nmake -f ms\nt.mak
  nmake -f ms\nt.mak install
  nmake -f ms\nt.mak install
  rem And bc setting up paths to openssl is troublesome...
  rem And bc setting up paths to openssl is troublesome...
  xcopy /S C:\openssl-1.0.1f\mdm\include\openssl\* C:\Qt\qt-everywhere-opensource-src-5.2.0\qtbase\include\openssl\
  xcopy /S C:\openssl-1.0.1g\mdm\include\openssl\* C:\Qt\qt-everywhere-opensource-src-5.3.0\qtbase\include\openssl\
  xcopy /S C:\openssl-1.0.1f\mdm\lib\* C:\Qt\qt-everywhere-opensource-src-5.2.0\qtbase\lib\
  xcopy /S C:\openssl-1.0.1g\mdm\lib\* C:\Qt\qt-everywhere-opensource-src-5.3.0\qtbase\lib\
  xcopy /S C:\openssl-1.0.1f\mdm\bin\* C:\Qt\qt-everywhere-opensource-src-5.2.0\qtbase\bin\
  xcopy /S C:\openssl-1.0.1g\mdm\bin\* C:\Qt\qt-everywhere-opensource-src-5.3.0\qtbase\bin\
* Patch the VS 2013 mkspec to make it build static:
* Patch the VS 2013 mkspec to make it build static:
  notepad C:\Qt\qt-everywhere-opensource-src-5.2.0\qtbase\mkspecs\win32-msvc2013\qmake.conf
  notepad C:\Qt\qt-everywhere-opensource-src-5.3.0\qtbase\mkspecs\win32-msvc2013\qmake.conf
  # MDM was haere
  # MDM was haere
  #QMAKE_CFLAGS_RELEASE    = -O2 -MD
  #QMAKE_CFLAGS_RELEASE    = -O2 -MD
Line 45: Line 45:


* Compile Qt statically in a VS Developer Prompt:
* Compile Qt statically in a VS Developer Prompt:
  cd C:\Qt\qt-everywhere-opensource-src-5.2.0
  cd C:\Qt\qt-everywhere-opensource-src-5.3.0
  set QMAKESPEC=win32-msvc2013
  set QMAKESPEC=win32-msvc2013
  set PATH=%CD%\bin;%PATH%
  set PATH=%CD%\bin;%PATH%
Line 58: Line 58:
   
   
  rem NOTE use this for 64-bit: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64
  rem NOTE use this for 64-bit: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64
 
  configure -opengl desktop -confirm-license -qmake -opensource OPENSSL_LIBS="-llibeay32 -lssleay32 -lgdi32" -debug-and-release -platform win32-msvc2013 -static -no-crt -nomake examples -openssl-linked -I C:\openssl-1.0.1f\mdm\include -L C:\openssl-1.0.1f\mdm\lib -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" >configure_output.txt
Note that there's some weird shit going on with OpenGL vs ANGLE and two releases of Qt and it's all a big hairy fluxball... taking out [-opengl] for the moment...
  # configure -opengl desktop -confirm-license -qmake -opensource OPENSSL_LIBS="-llibeay32 -lssleay32 -lgdi32" -debug-and-release -platform win32-msvc2013 -static -no-crt -nomake examples -openssl-linked -I C:\openssl-1.0.1g\mdm\include -L C:\openssl-1.0.1g\mdm\lib -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" >configure_output.txt
configure -confirm-license -qmake -opensource OPENSSL_LIBS="-llibeay32 -lssleay32 -lgdi32" -debug-and-release -platform win32-msvc2013 -static -no-crt -nomake examples -openssl-linked -I C:\openssl-1.0.1g\mdm\include -L C:\openssl-1.0.1g\mdm\lib -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" >configure_output.txt
  # nmake or jom will do, jom is faster
  # nmake or jom will do, jom is faster
  jom >jom_output.txt
  jom >jom_output.txt


* Create a new "kit" with the newly built Qt!
* Create a new "kit" with the newly built Qt!

Latest revision as of 21:17, 3 June 2014

These build instructions includes support for phonon (mp3 and video playback, etc.) and opensssl (for https support etc.) - because I needed them! And because they are a bit of a pain to set up.

Start with Qt Creator on Mac or linux for the smoothest experience...

Linux

To set up for linux development..

  • install Qt and Qt Creator using your favorite distro's package manager
  • dump in some sample code and get it compiling and running
  • install git using your package manager
  • set up a central git repo and push your sample code to it

Mac OS X

To set up for Mac development (I'm using Lion)...

  • download Xcode (the primary Apple IDE)
  • in Xcode: Preferences --> Downloads With "Components" selected, you will see a list of downloadable components. Look for Command Line Tools, and click on install. You will be prompted for your Apple Developer userid and password. After successfully authenticating, the command line tools component downloads and installs a bunch of goodness, including gcc.
  • download the Mac Qt environment, including Qt Creator
  • install git and pull down the code
  • run Qt Creator and compile and run

Windoze

This gives a Windoze static build of Qt 5.3.0, yay!

  • Get latest OpenSSL source from here, unzip to C:\openssl-1.0.1g.
  • Get the latest Qt source, unzip to C:\Qt\qt-everywhere-opensource-src-5.3.0.
  • Get jom from here if you want a faster build: jom
  • Open a VS Developer Prompt and build OpenSSL:
cd C:\openssl-1.0.1g
perl Configure VC-WIN32 no-asm --prefix=C:\openssl-1.0.1g\mdm
ms\do_ms
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
rem And bc setting up paths to openssl is troublesome...
xcopy /S C:\openssl-1.0.1g\mdm\include\openssl\* C:\Qt\qt-everywhere-opensource-src-5.3.0\qtbase\include\openssl\
xcopy /S C:\openssl-1.0.1g\mdm\lib\* C:\Qt\qt-everywhere-opensource-src-5.3.0\qtbase\lib\
xcopy /S C:\openssl-1.0.1g\mdm\bin\* C:\Qt\qt-everywhere-opensource-src-5.3.0\qtbase\bin\
  • Patch the VS 2013 mkspec to make it build static:
notepad C:\Qt\qt-everywhere-opensource-src-5.3.0\qtbase\mkspecs\win32-msvc2013\qmake.conf
# MDM was haere
#QMAKE_CFLAGS_RELEASE    = -O2 -MD
#QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
#QMAKE_CFLAGS_DEBUG      = -Zi -MDd
QMAKE_CFLAGS_RELEASE    = -O2 -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
QMAKE_CFLAGS_DEBUG      = -Zi -MTd
  • Compile Qt statically in a VS Developer Prompt:
cd C:\Qt\qt-everywhere-opensource-src-5.3.0
set QMAKESPEC=win32-msvc2013
set PATH=%CD%\bin;%PATH%
set PATH=%CD%\qtbase\bin;%PATH%
set PATH=%CD%\qtrepotools\bin;%PATH%
set PATH=%CD%\gnuwin32\bin;%PATH%
set QTDIR=%CD%\qtbase
set QT_QPA_PLATFORM_PLUGIN_PATH=%CD%\qtbase\plugins\platforms

rem configure says "To reconfigure, run nmake confclean and configure."
rem but it seems it is [nmake clean]

rem NOTE use this for 64-bit: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64

Note that there's some weird shit going on with OpenGL vs ANGLE and two releases of Qt and it's all a big hairy fluxball... taking out [-opengl] for the moment...

# configure -opengl desktop -confirm-license -qmake -opensource OPENSSL_LIBS="-llibeay32 -lssleay32 -lgdi32" -debug-and-release -platform win32-msvc2013 -static -no-crt -nomake examples -openssl-linked -I C:\openssl-1.0.1g\mdm\include -L C:\openssl-1.0.1g\mdm\lib -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" >configure_output.txt
configure -confirm-license -qmake -opensource OPENSSL_LIBS="-llibeay32 -lssleay32 -lgdi32" -debug-and-release -platform win32-msvc2013 -static -no-crt -nomake examples -openssl-linked -I C:\openssl-1.0.1g\mdm\include -L C:\openssl-1.0.1g\mdm\lib -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" >configure_output.txt
# nmake or jom will do, jom is faster
jom >jom_output.txt
  • Create a new "kit" with the newly built Qt!