Difference between revisions of "Programming Reference:Building Qt for BCI2000"

From BCI2000 Wiki
Jump to: navigation, search
(Build and copy MSVC libraries and auxiliary files)
(Build and copy MSVC libraries and auxiliary files)
 
(6 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
*Download the Qt source code [http://qt-project.org/downloads] to your machine.
 
*Download the Qt source code [http://qt-project.org/downloads] to your machine.
 
*Outside the Qt source tree, create a directory tree, e.g. <tt>d:\Qt\5.3\build-msvc12</tt>. A Qt build may require an enormous amount of temporary disk space (50GB and more), so it is recommended to build Qt on a separate (virtual) empty disk drive.
 
*Outside the Qt source tree, create a directory tree, e.g. <tt>d:\Qt\5.3\build-msvc12</tt>. A Qt build may require an enormous amount of temporary disk space (50GB and more), so it is recommended to build Qt on a separate (virtual) empty disk drive.
*Within the newly created empty build directory, place a <tt>do_configure.bat</tt> script file with the following content:
+
*Into the newly created empty build directory, place a <tt>do_configure.bat</tt> script file with the following content:
  
 
  c:\Qt\5.3\Src\configure ^
 
  c:\Qt\5.3\Src\configure ^
Line 24: Line 24:
 
  -skip qtxmlpatterns ^
 
  -skip qtxmlpatterns ^
 
  -nomake tests ^
 
  -nomake tests ^
  -nomake examples
+
  -nomake examples  
  
 
*This should be a single command line, so make sure that the caret character is actually the last character in each line, and not followed by white space.
 
*This should be a single command line, so make sure that the caret character is actually the last character in each line, and not followed by white space.
 
*Note that the first path should point to your Qt source location, and the "prefix" path should point to a location on your build drive. This is the path that will contain Qt headers and libraries after the build.
 
*Note that the first path should point to your Qt source location, and the "prefix" path should point to a location on your build drive. This is the path that will contain Qt headers and libraries after the build.
*In your Qt source directory, open the file <tt>qtbase/mkspecs/win32-msvc2012/qmake.conf</tt> in a text editor.
+
*In your Qt source directory, open the file <tt>qtbase/mkspecs/win32-msvc2012/qmake.conf</tt> in a text editor. In <tt>QMAKE_CFLAGS_RELEASE</tt> and <tt>QMAKE_CFLAGS_DEBUG</tt>, replace the <tt>-MD</tt> and <tt>-MDd</tt> with <tt>-MT</tt> and  <tt>-MTd</tt>, respectively.
*Open the appropriate Visual Studio console window from the start menu. Whether you build a 64 or 32 bit version of Qt will depend on the type of VS Command Prompt you choose.
+
*Open an appropriate Visual Studio console window from the start menu. Whether you build a 64 or 32 bit version of Qt will depend on the type of VS Command Prompt you choose.
 
*Change directory to the build directory containing the script described above, and execute it.
 
*Change directory to the build directory containing the script described above, and execute it.
 
*When prompted for the type of license, choose "Open Source", and answer "yes" when asked whether you accept the terms of the license.
 
*When prompted for the type of license, choose "Open Source", and answer "yes" when asked whether you accept the terms of the license.
 
*Run <tt>nmake</tt> as suggested by <tt>configure</tt>.
 
*Run <tt>nmake</tt> as suggested by <tt>configure</tt>.
*Inside the <tt>qt-x.y.z</tt> directory, create a subdirectory <tt>win32-msvc2008</tt>.
+
*After a successful build, <tt>nmake install</tt> will copy libraries and headers to the location specified by the <tt>-prefix</tt> option.
*Copy the following files from <tt>qt/bin</tt> to <tt>qt-x.y.z/win32-msvc2008/bin</tt>:
+
*The following files must be present in bin:
idc.exe
 
 
  moc.exe
 
  moc.exe
 
  qmake.exe
 
  qmake.exe
 
  rcc.exe
 
  rcc.exe
 
  uic.exe
 
  uic.exe
Make sure to leave the <tt>qt.conf</tt> file unaffected.
+
   
*From <tt>qt/lib</tt>, copy the following files to <tt>qt-x.y.z/win32-msvc2008/lib</tt>:
+
*For 64-bit versions of the libraries, proceed as above, but run <tt>configure</tt> and <tt>nmake</tt> steps from a 64-bit Visual Studio command line prompt. The target directory should be named <tt>win32-amd64-msvc2012</tt> for MSVC 2012 64-bit builds.
QtCore.lib
 
  QtCored.lib
 
QtGui.lib
 
QtGuid.lib
 
QtOpenGL.lib
 
QtOpenGLd.lib
 
*From <tt>qt/mkspecs</tt>, copy the file <tt>qconfig.pri</tt>, and recursively copy the contents of the <tt>features</tt> and the <tt>win32-msvc2008</tt> directories to <tt>qt-x.y.z/win32-msvc2008/mkspecs</tt>.
 
<!--*In <tt>qt-x.y.z/win32-msvc2008/mkspecs/win32-msvc2008/qmake.conf</tt>, remove the <tt>-Fd$(DESTDIR)$(QMAKE_TARGET).pdb</tt> compiler option from <tt>QMAKE_CFLAGS_DEBUG</tt>.-->
 
*Repeat the entire process with MSVC2010, with results going into a <tt>win32-msvc2010</tt> directory rather than the <tt>win32-msvc2008</tt> directory.
 
*For 64-bit versions of the libraries, proceed as above, but run <tt>configure</tt> and <tt>nmake</tt> steps from a 64-bit Visual Studio command line prompt. The target directory should be named <tt>win32-amd64-msvc2008</tt> for MSVC 2008 64-bit builds.
 
 
<!--
 
<!--
===Note: Why do we need debug libraries?===
 
For the stripped-down version of Qt provided in the BCI2000 source tree, no source code is available, and debugging information in the Qt libraries cannot be used for debugging. Thus, it appears that always linking to the release version of the Qt libraries would be sufficient, saving considerable space in the SVN data base, and download time for the user. Unfortunately, it turns out that this is not sufficient, and that both debugging versions of the Qt libraries, and associated pdb files, are required in the BCI2000 source tree.
 
*MSVC does not cleanly separate between compile and link stages. Rather, the compiler provides /M switches that determine the runtime libraries to be used in the linking stage.
 
*Due to this dependency of object code on certain runtime libraries, it is not cleanly possible to link together static libraries compiled with one /M switch with application code compiled with another /M switch. Thus, we need to provide both release and debug versions of the Qt libraries.
 
-->
 
 
 
==Build and copy mingw libraries and auxiliary files==
 
==Build and copy mingw libraries and auxiliary files==
 
*From the Qt installation's <tt>qt</tt> directory, run <tt>configure</tt> with the following options:
 
*From the Qt installation's <tt>qt</tt> directory, run <tt>configure</tt> with the following options:
Line 130: Line 113:
 
*To hide debugging information, open a cygwin shell, and cd to the qt lib directory that contains MSVC libraries. There, execute
 
*To hide debugging information, open a cygwin shell, and cd to the qt lib directory that contains MSVC libraries. There, execute
 
  /full/path/to/build/buildutils/strip_msvc_lib.sh *
 
  /full/path/to/build/buildutils/strip_msvc_lib.sh *
 +
-->
  
 
==Upload Qt to the BCI2000 server==
 
==Upload Qt to the BCI2000 server==

Latest revision as of 19:00, 8 August 2015

This document describes how to build Qt for installation in the BCI2000 source tree. It is current as of Qt 5.3.

Note: Following this procedure is only required if you are a member of the BCI2000 team, and if your task is to update the Qt build coming with BCI2000. In case you just want to build BCI2000 against a version of Qt outside the source tree, run CMake a first time, then open the file BCI2000/build/CMakeCache.txt in the CMake GUI, or in a text editor, and set the value of the USE_EXTERNAL_QT option to "ON".

Build and copy MSVC libraries and auxiliary files

  • Download the Qt source code [1] to your machine.
  • Outside the Qt source tree, create a directory tree, e.g. d:\Qt\5.3\build-msvc12. A Qt build may require an enormous amount of temporary disk space (50GB and more), so it is recommended to build Qt on a separate (virtual) empty disk drive.
  • Into the newly created empty build directory, place a do_configure.bat script file with the following content:
c:\Qt\5.3\Src\configure ^
-platform win32-msvc2012 ^
-static ^
-prefix d:\Qt\deployment\qt-5.3.2\win32-msvc2012 ^
-headerdir ..\include ^
-no-vcproj -mp ^
-no-openssl -no-qml-debug ^
-opengl desktop ^
-skip qtdeclarative ^
-skip qtquick1 ^
-skip qtquickcontrols ^
-skip qtscript ^
-skip qtwebkit ^
-skip qtwebkit-examples ^
-skip qtxmlpatterns ^
-nomake tests ^
-nomake examples 
  • This should be a single command line, so make sure that the caret character is actually the last character in each line, and not followed by white space.
  • Note that the first path should point to your Qt source location, and the "prefix" path should point to a location on your build drive. This is the path that will contain Qt headers and libraries after the build.
  • In your Qt source directory, open the file qtbase/mkspecs/win32-msvc2012/qmake.conf in a text editor. In QMAKE_CFLAGS_RELEASE and QMAKE_CFLAGS_DEBUG, replace the -MD and -MDd with -MT and -MTd, respectively.
  • Open an appropriate Visual Studio console window from the start menu. Whether you build a 64 or 32 bit version of Qt will depend on the type of VS Command Prompt you choose.
  • Change directory to the build directory containing the script described above, and execute it.
  • When prompted for the type of license, choose "Open Source", and answer "yes" when asked whether you accept the terms of the license.
  • Run nmake as suggested by configure.
  • After a successful build, nmake install will copy libraries and headers to the location specified by the -prefix option.
  • The following files must be present in bin:
moc.exe
qmake.exe
rcc.exe
uic.exe

  • For 64-bit versions of the libraries, proceed as above, but run configure and nmake steps from a 64-bit Visual Studio command line prompt. The target directory should be named win32-amd64-msvc2012 for MSVC 2012 64-bit builds.

Upload Qt to the BCI2000 server

  • Create a self-extracting 7z archive from each subfolder of the qt-x.y.z directory. In order to expand correctly, the archive must contain the qt-x.y.z directory as well.
  • For CMake to find an archive on the server, it must be located at the following http path: /externals/qt/qt-x.y.z.subdirname

Note that archives may not have an .exe file extension on the server. It will be added when the file is downloaded by CMake (see BCI2000/build/cmake/FindQt.cmake for details).

See also

Programming Reference:Build System