Difference between revisions of "Documentation/4.0/Developers/Build Instructions"
Line 47: | Line 47: | ||
Check our different tutorials: | Check our different tutorials: | ||
* Build Qt on Windows | * Build Qt on Windows | ||
+ | Using the Qt Designer on Windows requires that the Slicer and CTK widget plugins are [http://doc.trolltech.com/4.6/deployment-plugins.html#debugging-plugins|compiled in the same mode than Qt]. If Qt was compiled in Release mode (default), Slicer would have to be compiled in Release mode as well. However if Qt is compiled in Debug mode only, Slicer has to be compiled in Debug too. When Qt is in "Release and Debug" mode only the Release version of Designer.exe is generated, Slicer would have to be compiled in Release. So for developers, the <b>Debug mode is recommended</b>, this is why we detail the compilation of Qt below. | ||
+ | ** 1/ Use a windows extracter to unzip the [#Prerequisites|Qt zip archive], don't use cygwin unzip it. | ||
+ | ** 2/ launch the msvc2008 command prompt (MSVC08->Tools->Visual Studio 2008 CommandPrompt) | ||
+ | ** 3/ build with <code>configure.exe -platform win32-msvc2008 -debug</code> | ||
+ | *** Note: the option <code>-prefix<code> doesn't work on Windows. | ||
+ | *** Note: According to [http://qt.nokia.com/doc/4.6/supported-platforms.html] Qt does not support msvc2008 on windows xp. However, running <code>configure.exe</code> with no <code>-platform</code> argument seems to work. If you run configure with the <code>-platform</code> argument first by mistake, and if <code>configure -clean</code> doesn't work, then you may need to start from a fresh extraction from the .zip archive before running <code>configure.exe</code> again with no <code>-platform</code>, unless you can run <code>nmake</code> with the config clean target. | ||
+ | ** 4/ run <code>vcvars32.bat</code> first (required only if you use a regular command prompt, not the one in 2/). | ||
+ | ** 5/ run <code>nmake</code>. | ||
+ | ** Note: building with webkit support requires that <i>src/3rdparty/webkit/WebCore/tmp/moc/{debug,release}_shared/mocinclude.tmp</i> be removed. else you will get linker errors like <code>QNetworkReplyHandler.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall WebCore::FormDataIODevice::metaObject(void)const (?metaObject@FormDataIODevice@WebCore@@UBEPBUQMetaObject@@XZ)</code> | ||
+ | ** Node: If you encounter the following error <code>api\qscriptextensionplugin.h(43): Error: Undefined interface,</code>, delete the files <i>\src\script\tmp\moc\debug_shared\mocinclude.tmp</i> and <i>\src\script\tmp\moc\release_shared\mocinclude.tmp</i> and restart nmake. For more info, please see [http://bugreports.qt.nokia.com/browse/QTBUG-6470 QTBug 6470]]. | ||
* Build Qt on Linux | * Build Qt on Linux | ||
+ | Downloading the binaries of Qt works fine with Linux, you do not have to compile Qt manually. The following descriptions are given for people who want to compile Qt anyway. | ||
+ | <pre> | ||
+ | mkdir Qt | ||
+ | mkdir Qt-build | ||
+ | cd Qt | ||
+ | wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.2.tar.gz | ||
+ | tar xvfz qt-everywhere-opensource-src-4.6.2.tar.gz | ||
+ | cd qt-everywhere-opensource-src-4.6.2 | ||
+ | echo yes | ./configure -prefix ../../Qt-build -debug-and-release -opensource -no-qt3support | ||
+ | make -j 16 | ||
+ | make install | ||
+ | </pre> | ||
+ | ** Note: On a 64 bit system, you may have to add <code>-arch x86_64</code> to the Qt configure command line (?) | ||
+ | |||
* Build Qt on Mac | * Build Qt on Mac | ||
+ | Same as Linux. Use "-arch x86_64" for a 64 bit build on SnowLeopard. | ||
== Step1 : Checkout slicer sources using subversion == | == Step1 : Checkout slicer sources using subversion == |
Revision as of 16:47, 13 June 2010
Home < Documentation < 4.0 < Developers < Build InstructionsThe build system for Slicer4 is being developed during the second half of 2010. The goal is to provide a cross-platform build system that allows developers to quickly install and configure the multiple packages.
Where Slicer3's build system relied on a custom build script called getbuildtest, new features added to CMake, partly driven by slicer's requirements, allow porting of the scripts to rely on more on native CMake functionality with the benefit that build script is more modular and general purpose.
Contents
Prerequisites
- Download (and if required compile) Qt - Use one of the link provided below:
Linux | Mac | Windows | ||||||
---|---|---|---|---|---|---|---|---|
Tiger, Leopard | SnowLeopard | |||||||
32bits | 64bits | 32bits | 64bits | 64bits | 32bits | 64bits | ||
Qt source link | 4.6.2 | 4.7 beta | 4.6.2 | |||||
Qt binary link | 4.6.2 | 4.6.2 | 4.6.2 | 4.7 beta | 4.6.2 (vs2008) | - |
- How to build Qt ?
Configure options common to all platform:
Check our different tutorials:
- Build Qt on Windows
Using the Qt Designer on Windows requires that the Slicer and CTK widget plugins are in the same mode than Qt. If Qt was compiled in Release mode (default), Slicer would have to be compiled in Release mode as well. However if Qt is compiled in Debug mode only, Slicer has to be compiled in Debug too. When Qt is in "Release and Debug" mode only the Release version of Designer.exe is generated, Slicer would have to be compiled in Release. So for developers, the Debug mode is recommended, this is why we detail the compilation of Qt below.
- 1/ Use a windows extracter to unzip the [#Prerequisites|Qt zip archive], don't use cygwin unzip it.
- 2/ launch the msvc2008 command prompt (MSVC08->Tools->Visual Studio 2008 CommandPrompt)
- 3/ build with
configure.exe -platform win32-msvc2008 -debug
- Note: the option
-prefix
doesn't work on Windows.
- Note: According to [1] Qt does not support msvc2008 on windows xp. However, running
configure.exe
with no-platform
argument seems to work. If you run configure with the-platform
argument first by mistake, and ifconfigure -clean
doesn't work, then you may need to start from a fresh extraction from the .zip archive before runningconfigure.exe
again with no-platform
, unless you can runnmake
with the config clean target.
- Note: the option
- 4/ run
vcvars32.bat
first (required only if you use a regular command prompt, not the one in 2/). - 5/ run
nmake
. - Note: building with webkit support requires that src/3rdparty/webkit/WebCore/tmp/moc/{debug,release}_shared/mocinclude.tmp be removed. else you will get linker errors like
QNetworkReplyHandler.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall WebCore::FormDataIODevice::metaObject(void)const (?metaObject@FormDataIODevice@WebCore@@UBEPBUQMetaObject@@XZ)
- Node: If you encounter the following error
api\qscriptextensionplugin.h(43): Error: Undefined interface,
, delete the files \src\script\tmp\moc\debug_shared\mocinclude.tmp and \src\script\tmp\moc\release_shared\mocinclude.tmp and restart nmake. For more info, please see QTBug 6470].
- Build Qt on Linux
Downloading the binaries of Qt works fine with Linux, you do not have to compile Qt manually. The following descriptions are given for people who want to compile Qt anyway.
mkdir Qt
mkdir Qt-build
cd Qt
wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.2.tar.gz
tar xvfz qt-everywhere-opensource-src-4.6.2.tar.gz
cd qt-everywhere-opensource-src-4.6.2
echo yes | ./configure -prefix ../../Qt-build -debug-and-release -opensource -no-qt3support
make -j 16
make install
- Note: On a 64 bit system, you may have to add
-arch x86_64
to the Qt configure command line (?)
- Build Qt on Mac
Same as Linux. Use "-arch x86_64" for a 64 bit build on SnowLeopard.
Step1 : Checkout slicer sources using subversion
For example:
cd MyProjects
svn co http://svn.slicer.org/Slicer3/trunk Slicer3
Step2 : Configure slicer project using either ccmake or cmake-gui
The grids displayed below summarized the available options.
Using ccmake:
mkdir Slicer3-SuperBuild
cd Slicer3-SuperBuild
ccmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/home/myself/qt-4.6.2/qt/bin/qmake ../Slicer3/SuperBuild
Using cmake-gui
Where is the source code: C:/MyProjects/Slicer3/SuperBuild
Where to build the binaries: C:/MyProjects/Slicer3-SuperBuild
Set of options and supported plateforms:
Description
Options
Platform
Slicer3_USE_KWWIDGETS
Slicer3_USE_PYTHON
Slicer3_USE_QT
Slicer3_USE_PYTHONQT
Linux
Mac
windows
Kww-Python DEFAULT
ON
ON
OFF
OFF
Y
Y
Y
Kww-NoPython
ON
OFF
OFF
OFF
Y
Y
Y
KwwAndQt-Python
ON
ON
ON
OFF
Y
N
Y
Qt-NoPythonQt
OFF
OFF
ON
OFF
Y
Y
Y
Qt-PythonQt
OFF
OFF
ON
ON
Y
Y
Y
What is the difference between Python and PythonQt build ?
Todo ...
Step3: Configure, Generate the solution files and Build
make can be run from the top-level bin directory Slicer3-SuperBuild (where ccmake was used to configure), or from Slicer3-SuperBuild/Slicer3-build. In the first case, the build script will run update on the dependency libraries (but not for Slicer source code -- for that you need to manually update the Slicer3 directory). In the second case, there will be no updates, so this approach is convenient when making local development in Slicer.
Platform Notes
- On windows and mac python gets rebuilt every time you type make.
- You currently need to manually set the DYLD_LIBRARY_PATH (mac) and related paths to run the executable Slicer3-SuperBuild/Slicer3-build/bin/SlicerQT
export DYLD_LIBRARY_PATH=<path/to>/Slicer4-SuperBuild/CTK-build/CTK-build/bin:<path/to>/Slicer4-SuperBuild/CTK-build/CMakeExternals/Install/lib