← Back to team overview

unity-dev team mailing list archive

Re: [Ayatana-dev] Unity-2D and Qt5

 

Hello Andrea,

I spent a bit of time trying out Qt5 and Unity 2D and here is how I proceed.

1) First of all, getting Qt5 and some of its dependencies and compiling it (ensure you have at least around 6GB of free space):

git clone git://gitorious.org/qt/qt5.git qt5
cd qt5
perl init-repository --no-webkit
cd qtbase
git submodule update --init src/3rdparty/v8
sudo apt-get install libx11-xcb-dev libxcb.*dev libv8-dev libxext-dev libgl1-mesa-dev
export PATH=$PWD/qtbase/bin:$PATH
export LD_LIBRARY_PATH=$PWD/qtbase/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$PWD/qtbase/lib/pkgconfig:$PKG_CONFIG_PATH
./configure -developer-build -nomake examples -nomake tests -no-gtkstyle -no-webkit -opensource -confirm-license
make -j3


2) Recompile the libraries that Unity 2D depends on against Qt5, that are dee-qt, bamf-qt, dbusmenu-qt and dconf-qt. I adapted them so that they compile and work more or less fine against Qt5:

bzr branch lp:~fboucault/dee-qt/qt5
cd qt5
cmake .
make
cd ..

bzr branch lp:~fboucault/bamf-qt/qt5
cd qt5
cmake .
make
cd ..

bzr branch lp:~fboucault/libdbusmenu-qt/qt5
cd qt5
cmake -DWITH_DOC=OFF .
make
cd ..

bzr branch lp:~fboucault/dconf-qt/qt5
cd qt5
cmake .
make
cd ..


3) Finally modify Unity 2D's code for it to compile against Qt5. For that there is a bunch of tasks that need to be accomplished properly listed just after. To get a (working) idea of it I pasted a very crude patch that does part of it there:

http://pastebin.com/31G903eY

Qt4 compatible tasks:
* fix Qt includes to be fully specified (e.g. QObject becomes QtCore/QObject)
* CMakeLists.txt:
- use INCLUDE_DIRS instead of INCLUDE_DIR
- migrate away from qt4_automoc in panel and libunity-2d-private and use qt4_wrap_cpp instead (removes all #include .moc in *.cpp)

Qt5 only tasks:
* CMakeLists.txt:
- replace uses of qt4_wrap_cpp with qt5_wrap_cpp
- replace uses of qt4_add_dbus_adaptor with qt5_add_dbus_adaptor
* drop usage of QX11Info (maybe isolate dependencies on X while at it)
* in QML: Accessible.name and Accessible.role do not exist anymore; find the replacement



Notes:
* That makes Unity 2D run with Qt5 but still using QtQuick 1.1. We will also want to migrate to QtQuick 2.0. * automoc in Qt5 will be done through its inclusion in CMake 2.8.7 and we will be able to remove:

set(FOO_MOC_HEADERS foo_header.h)
qt5_wrap_cpp(FOO_MOC_SRCS ${FOO_MOC_HEADERS})
add_library(foo SHARED ${FOO_SRCS} ${FOO_MOC_SRCS})

by adding:
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

See http://public.kitware.com/pipermail/cmake-developers/2011-December/002715.html


I hope that helps,

Florian



Follow ups

References