Programming Reference:Building Qt for BCI2000 (obsolete): Difference between revisions
| Line 4: | Line 4: | ||
==Build and copy MSVC libraries and auxiliary files== | ==Build and copy MSVC libraries and auxiliary files== | ||
*Download | *Download the Qt source code to your machine. | ||
*Outside the Qt source tree, create a directory <tt>qt-x.y.z</tt>, e.g. <tt>qt-4.7.0</tt> for version 4.7.0. | |||
*Open the file <tt>qt/mkspecs/win32-msvc2008/qmake.conf</tt> in a text editor. <!--Add <tt>-Fd$(DESTDIR)$(QMAKE_TARGET).pdb</tt> as a compiler option to <tt>QMAKE_CFLAGS_DEBUG</tt>.--> 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 file <tt>qt/mkspecs/win32-msvc2008/qmake.conf</tt> in a text editor. <!--Add <tt>-Fd$(DESTDIR)$(QMAKE_TARGET).pdb</tt> as a compiler option to <tt>QMAKE_CFLAGS_DEBUG</tt>.--> 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. | ||
<!--*To optimize for size rather than speed, replace the <tt>-O2</tt> option in <tt>QMAKE_CFLAGS_RELEASE</tt> with <tt>-O1</tt>.--> | <!--*To optimize for size rather than speed, replace the <tt>-O2</tt> option in <tt>QMAKE_CFLAGS_RELEASE</tt> with <tt>-O1</tt>.--> | ||
| Line 28: | Line 29: | ||
*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> | *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>. | |||
* | *Copy the following files from <tt>qt/bin</tt> to <tt>qt-x.y.z/win32-msvc2008/bin</tt>: | ||
*Copy the following files from <tt>qt/bin</tt> to <tt> | |||
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. | Make sure to leave the <tt>qt.conf</tt> file unaffected. | ||
*From <tt>qt/lib</tt>, copy the following files to <tt>BCI2000/src/extlib/qt/msvc/lib</tt>: | *From <tt>qt/lib</tt>, copy the following files to <tt>BCI2000/src/extlib/qt/msvc/lib</tt>: | ||
QtCore.lib | QtCore.lib | ||
QtCored.lib | QtCored.lib | ||
QtGui.lib | QtGui.lib | ||
QtGuid.lib | QtGuid.lib | ||
QtOpenGL.lib | QtOpenGL.lib | ||
QtOpenGLd.lib | QtOpenGLd.lib | ||
QtScript.lib | QtScript.lib | ||
QtScriptd.lib | QtScriptd.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>. | |||
*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> | <!--*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>.--> | ||
*In <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. | ||
*Repeat the entire process with MSVC2010, with results going into | |||
<!-- | |||
===Note: Why do we need debug libraries?=== | ===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. | 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. | *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. | *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== | ||
Revision as of 15:16, 11 June 2013
This document describes how to build Qt for installation in the BCI2000 source tree. It is current as of Qt 4.8.4.
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 to your machine.
- Outside the Qt source tree, create a directory qt-x.y.z, e.g. qt-4.7.0 for version 4.7.0.
- Open the file qt/mkspecs/win32-msvc2008/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 the VS2008 console window from the start menu, and from the Qt installation's qt directory, run configure with the following options:
-platform win32-msvc2008 -static -no-sql-sqlite -no-qt3support -fast -qt-zlib -qt-libpng -qt-libmng -no-libtiff -no-libjpeg -no-phonon -no-webkit -no-scripttools -no-style-plastique -no-style-motif -no-style-cde
For convenience, the same options on a single line:
-platform win32-msvc2008 -static -no-sql-sqlite -no-qt3support -fast -qt-zlib -qt-libpng -qt-libmng -no-libtiff -no-libjpeg -no-phonon -no-webkit -no-scripttools -no-style-plastique -no-style-motif -no-style-cde
- 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.
- Inside the qt-x.y.z directory, create a subdirectory win32-msvc2008.
- Copy the following files from qt/bin to qt-x.y.z/win32-msvc2008/bin:
moc.exe qmake.exe rcc.exe uic.exe
Make sure to leave the qt.conf file unaffected.
- From qt/lib, copy the following files to BCI2000/src/extlib/qt/msvc/lib:
QtCore.lib QtCored.lib QtGui.lib QtGuid.lib QtOpenGL.lib QtOpenGLd.lib QtScript.lib QtScriptd.lib
- From qt/mkspecs, copy the file qconfig.pri, and recursively copy the contents of the features and the win32-msvc2008 directories to qt-x.y.z/win32-msvc2008/mkspecs.
- Repeat the entire process with MSVC2010, with results going into a win32-msvc2010 directory rather than the win32-msvc2008 directory.
Build and copy mingw libraries and auxiliary files
- From the Qt installation's qt directory, run configure with the following options:
-platform win32-g++ -static -no-sql-sqlite -no-qt3support -fast -qt-zlib -qt-gif -qt-libpng -qt-libmng -no-libtiff -no-libjpeg -no-phonon -no-webkit -no-scripttools -no-style-plastique -no-style-motif -no-style-cde
- When prompted for the type of license, choose "Open Source", and answer "yes" when asked whether you accept the terms of the license.
- Open a console window, and run mingw32-make in the following directories:
- qt/src/corelib,
- qt/src/gui,
- qt/src/winmain,
- qt/src/opengl,
- qt/src/script.
- When the build is finished, copy the following files from qt/bin to BCI2000/src/extlib/qt/mingw/bin:
findtr idc.exe moc.exe qmake.exe rcc.exe syncqt uic.exe libgcc_s_dw2-1.dll mingwm10.dll
Leave the qt.conf file in place, don't modify it.
- From qt/lib, copy the following files to BCI2000/src/extlib/qt/mingw/lib:
libQtCore.a libQtGui.a libqtmain.a libQtOpenGL.a libQtScript.a
- From qt/mkspecs, copy the file qconfig.pri, and recursively copy the contents of directories features, common, and win32-g++ to BCI2000/src/extlib/qt/mingw/mkspecs.
Copy Qt include files to the BCI2000 directory
- Most header files point to header files in the qt/src header files. We don't want to provide the entire qt/src directory, so we need to replace these header files with the content of the files they point to. There is a fixheader tool provided in the BCI2000 source tree at build/buildutils/fixheader.cpp. Under cygwin, execute
make fixheader
from that directory to build the executable. Then, cd to the qt/include/Qt directory of your Qt installation, and execute
for i in `find *.h`; do /full/path/to/fixheader $i; done
Repeat this step for the QtCore, QtGui, QtOpenGL, and QtScript include directories.
- Copy the contents of the directory qt/include/Qt into BCI2000/src/extlib/qt/include/Qt, omitting the private directory.
- Likewise, copy the QtCore, QtGui, QtOpenGL, QtScript include directories to BCI2000/src/extlib/qt/include, omitting the respective private directories.