Sign up for the KDAB Newsletter
Stay on top of the latest news, publications, events and more.
Go to Sign-up
As was previously discussed, since the 6.0.0 release of Qt, Qt 3D no longer ships as a pre-compiled module. If you need to use it on your projects, try out the new features, or just see your existing application is ready for the next chapter of Qt's life, you need to compile Qt 3D from source.
In order to do this, you can do it the traditional way ([cq]make ...; make; make install
) or use the Conan-based system that is being pioneered with the latest version of the MaintenanceTool.
The latest version of the MaintenanceTool (from the unified installers) will optionally install several things:
Additionally, you will need to select Qt 3D in the Additional libraries section so that the source code is available.
As mentioned above, these are optional. You need to find them and enable them in the MaintenanceTool's UI.
Conan, being a package manager, is designed to handle all dependencies to make it easy to build libraries and applications. However, the way this is setup in the current packages installed by the MaintenanceTool is not complete.
In particular, you need two other things:
Once you have all the required bits, it's time to open a console and run Conan. The process is platform-specific, as each platform has it's own Conan profile. A complete example is available on the Qt wiki, but this is how it works on my mac where the Qt SDK is installed in /Users/Shared/Qt
:
conan install qt3d/6.0.0@qt/final --build=missing -s build_type=Release -g cmake_paths -g=cmake -g deploy --profile=/Users/Shared/Qt/Tools/Conan/profiles/qt-6.0.0-macx-clang
and wait...it takes a while to build Qt 3D.
Using the MaintenanceTool and Conan makes it easy to get the source and the required dependencies for building Qt 3D. As we saw in the aforementioned, there are still some rough edges. So, in particular, if you are familiar with building Qt modules already, you can just use the "old way", i.e., download the source and use QMake, or now, CMake.
The packages for the released versions of Qt 3D (and other Additional modules) are available here.
Once extracted, you can do a shadow build of Qt 3D pretty easily (this has the same build requirements as above though, QtShaderTools module and perl interpreter).
tar zxf qt3d-everywhere-src-6.0.0.tar.xz
cd qt3d-everywhere-src-6.0.0
mkdir build
cd build
/Users/Shared/Qt/6.0.0/clang_64/bin/qmake ..
make
make install
And, again, wait 🙂.
The process is similar if you want to use CMake instead. In the build folder, do:
/Users/Shared/Qt/6.0.0/clang_64/bin/qt-cmake -G Ninja ..
ninja
ninja install
Once done, your applications should be able to find the Qt 3D modules.
You can optionally build the documentation using the docs target (but this will not be installed; you will need to register it with Creator and/or QtAssistant for it to appear).
Qt 3D will likely preserve the dual QMake/CMake build system for a while still.
As you see, building Qt 3D involves a bit more work than it did before. Fortunately, it needs to be done only once for each release. Going forward, we will be able to release Qt 3D on a different cycle from the rest of Qt and, as a result, introduce features and bug fixes more frequently. Please do not hesitate to get in touch with us or the Qt build system team if you have questions regarding this new setup.
KDAB provides a number of services around Qt 3D, including mentoring your team and embedding Qt 3D code into your application, among others. You can find out more about these services here.
About KDAB
The KDAB Group is a globally recognized provider for software consulting, development and training, specializing in embedded devices and complex cross-platform desktop applications. In addition to being leading experts in Qt, C++ and 3D technologies for over two decades, KDAB provides deep expertise across the stack, including Linux, Rust and modern UI frameworks. With 100+ employees from 20 countries and offices in Sweden, Germany, USA, France and UK, we serve clients around the world.
Stay on top of the latest news, publications, events and more.
Go to Sign-up
Upgrade your applications from Qt 5 to Qt 6 with KDAB’s migration services. Get a free migration assessment and join a hands-on workshop to prepare your team for a successful transition!
Learn more
Learn Modern C++
Our hands-on Modern C++ training courses are designed to quickly familiarize newcomers with the language. They also update professional C++ developers on the latest changes in the language and standard library introduced in recent C++ editions.
Learn more
5 Comments
20 - Jan - 2021
Vadim P
Could some thought be given to vcpkg as well? We went with that instead of Conan - seems like less hassle not to deal with Python, and the overall ecosystem is clearer to work with.
15 - Mar - 2021
Michael Sandman
Exactly what I was looking for. Thanks for the great guide!
25 - Mar - 2021
Ha
How can I compile Qt3D for Windows? I am always getting errors when using qmake:
7 - Apr - 2021
Mike Krus
sounds like the module headers were not generated. Do you have perl installed and in your path?
7 - Apr - 2021
BRAS
Hi !
we are currently doing our migration to Qt6 and after compiling the Qt3d package thanks to conan we encounter some problems on the qml side :
module "QtQuick.Scene3D" plugin "qtquickscene3dplugin" not found import QtQuick.Scene3D 2.15
it is quite weird as we added the qml import path of the compiled package : QQuickView view; view.engine()->addImportPath("qrc:/frontend/imports");
We also spotted that the plugin is compiled statically using conan, is there a way it can be the issue ? indeed the qml plugins of our qt6.0.3 repo are .dll
BR,