summaryrefslogtreecommitdiffstats
path: root/doc/src/qt3d-building.qdoc
blob: 24c623d8f3e30199b1ca67e36cc7cd1e3b808234 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtQuick3D documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Free Documentation License
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page qt3d-building.html
    \title Building QtQuick3D
    \keyword Building QtQuick3D

    \section1 QtQuick3D Binary Packages

    Typically QtQuick3D is obtained via the QtSDK installer - just ensure the
    option for QtQuick3D is checked when running the installer.  Alternatively
    you can install the latest binary packages - check the
    \l{http://qt.nokia.com/downloads}{Qt downloads page}.  

    This section is for advanced use, or if you want to contribute to the
    development of QtQuick3D.

    \section1 Obtaining QtQuick3D sources

    If you want to work with the latest bleeding edge QtQuick3D features you
    can build it from source.

    The source for QtQuick3D is hosted on Gitorious as the git repository
    \l{http://qt.gitorious.org/qt-labs/quick3d}{\c{qt-labs/quick3d.git}}.
    It can be cloned as follows:

    \code
    $ mkdir -p $HOME/depot/qt-labs
    $ cd $HOME/depot/qt-labs
    $ git clone git://gitorious.org/qt-labs/quick3d.git
    \endcode

    \section1 Building QtQuick3D

    QtQuick3D requires Qt 4.7.  Ensure that the binary package for Qt that you are
    using to build QtQuick3D against is a 4.7 package.  The QtSDK currently ships
    with Qt 4.7 so if you're using the SDK you should be fine.

    \section1 Building QtQuick3D Using QtCreator / QtSDK

    Here is a step-by-step guide to building QtQuick3D using the
    \l{http://qt.nokia.com/products/appdev/developer-tools/developer-tools}{QtCreator IDE}.
    Read and refer to the command line section below for the full details
    of building QtQuick3D.

    \bold{Step 1} - Open the QtQuick3D project.

    Choose \c{Open} from the \c{File} menu and navigate to the quick3d.pro project
    file \c {$HOME/depot/qt-labs/quick3d/quick3d.pro}.  Click \c{Open}.

    \bold{Step 2} - Select Qt, and specify a build directory.

    Now the QtQuick3D project is displayed in the \c{Project} listing.  Click the
    \c{Projects} button on the left-hand side of the screen, and under the
    \c{Build Settings} tab, choose \c{General} from the \c{Debug} category.
    Set the Qt build to use, making sure it has OpenGL enabled.  Also
    specify a build directory, and check the "Shadow Build" box.

    \image qt-creator-shadow-build.png

    Note these screen shots apply to QtCreator v1.3 (beta) on MacOSX, but similar
    functionality is available in later QtCreator versions, even if the
    screen appears different.

    \bold{Step 3} - Add the system_3ds switch to qmake

    Only do this step if you have lib3ds installed on your system, as
    described above, and you want to use the system lib3ds instead of
    the one included with QtQuick3D.

    Do this in QtCreator from the \c{Projects} mode, under the
    \c{Build Steps} category.  Add \c{CONFIG+=system_3ds} to the "Additional arguments"
    for the "QMake build configuration".

    \image qt-creator-config-3ds.png

    \bold{Step 4} - Add QtQuick3D libraries to the path

    As shown above you'll need to specify the QtQuick3D libraries so that they can
    be found.  Do this in QtCreator from the \c{Projects} mode, under the
    \c{Build Environment} category.  This will also propagate to the
    \c{Run Environment}.  On MacOSX the name of the environment variable is
    \c{DYLD_LIBRARY_PATH}, on Linux it is \c{LD_LIBRARY_PATH}.  On Windows,
    you'll need to add the \c{bin} directory to the \c{PATH} variable.

    \image qt-creator-lib-path.png

    \bold{Step 5} - Specify the plugin install

    Only do this step if you want to use the QtQuick3D model loading plugins,
    as described above.

    Do this in QtCreator from the \c{Projects} mode, under the
    \c{Build Steps} category.  Use the + drop-down under the steps list-box
    to add a \c{Custom Process Step}, and move it below \c{QMake} and \c{Make}.
    Set the name appropriately, set the command to \c{/usr/bin/make} and
    the arguments to \c{-C plugins install}.  Note that the
    name you set may not display in the list box until you restart QtCreator.

    \image qt-creator-plugins.png

    In Windows set the command to the full path to your make program, eg:
    \c{C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\nmake} and set
    the "Working Directory" to the imageformats directory: eg
    \c{C:\build\qt-labs\qt3d\plugins\imageformats}.  The "Command Arguments"
    are now simply \c{install}.

    \bold{Step 6} - Build QtQuick3D

    Click the "Build All" button now to build QtQuick3D.


    \section1 Building from the Command Line

    On Linux assuming that you have built Qt 4.7 in
    \c{$HOME/build/qt/4.7}, you would configure and build QtQuick3D as follows:

    \code
    $ mkdir -p $HOME/build/qt-labs/qt3d
    $ cd $HOME/build/qt-labs/qt3d
    $ $HOME/build/qt/4.7/bin/qmake $HOME/depot/qt-labs/qt3d/opengl.pro
    $ make
    $ make install
    $ export LD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH
    \endcode

    The last line exports the library path so that you can run applications
    from QtQuick3D, and is needed so those applications can find the QtQuick3D libraries.

    The "\c{make install}" step is required to make plug-ins work,
    particularly the model loading and QML/3D plug-ins.

    On Windows (with Visual Studio) those commands look like this:

    \code
    mkdir \build\qt-labs\qt3d
    cd \build\qt-labs\qt3d
    \build\qt\4.7\bin\qmake \depot\qt-labs\qt3d\opengl.pro
    nmake
    set PATH=%PATH%;\build\qt-labs\qt3d\bin
    \endcode

    On Symbian (with RVCT) those commands look like this:

    \code
    cd C:\depot\qt-labs\qt3d
    qmake CONFIG+=old_importer
    sbs -c armv5_urel
    cd devices\symbian
    createpackage QtQuick3D_template.pkg release-armv5
    runonphone --sis QtQuick3D.sis
    \endcode

    Once you have built QtQuick3D, you can run the "teapot" example to test
    it as follows (ensure you've exported the library path as above):

    \code
    $ cd $HOME/build/qt-labs/qt3d
    $ bin/teapot
    \endcode

    If all goes well, you should see something like the following
    on the screen:

    \image teapot-screenshot.png

    QtQuick3D has been tested with Qt/X11 and Qt/Embedded under Linux, on MacOSX
    and Windows XP.  Patches for other platforms are welcome.

    \section1 Installing plugins

    QtQuick3D has support for loading 3D model files.  This is enabled via
    plugins for the various formats.

    3DS files are supported using the open source
    \l{http://lib3ds.org}{lib3ds} library.  A copy of version 1.3 of this
    library is included with the QtQuick3D sources under the \c{3rdparty}
    directory.

    If you already have lib3ds installed on your system and you wish to use
    that instead of the version included with QtQuick3D, you can pass the
    \c{system_3ds} option to qmake:

    \code
    $ $HOME/build/qt/4.7/bin/qmake $HOME/depot/qt-labs/qt3d/opengl.pro CONFIG+=system_3ds
    $ make
    $ make install
    \endcode

    The last step above will install the plugins into Qt's plugin
    directory so that the Qt plugin loader can find them at run-time.

    Note that the imageformats plugins include a rudimentary read-only TGA
    format reader which is required for many model files that use TGA for
    textures.  If you know for sure that your model files don't use TGA
    then this step can be skipped.

    See the instructions in \c{plugins/sceneformats/3ds/README.txt} for
    more information on using the system lib3ds.

    \l{index.html}{Return to the main QtQuick3D page} or
    \l{qt3d-examples.html}{Continue to the Tutorials and Examples}.
*/