mirror of https://github.com/cutefishos/appmotor
Changes: Added content to qtboost.dox
parent
edee02b213
commit
ef460dd0e1
@ -1,3 +1,145 @@
|
||||
/*! \page qtboost Using the Qt Booster
|
||||
|
||||
Launcher makes it possible to start up various types of applications very
|
||||
quickly. Launcher uses a different <em>booster</em> for each of the
|
||||
application types. This section concentrates on launching Qt applications with the Qt booster.
|
||||
|
||||
\section intro Introduction
|
||||
|
||||
The launcher can start an application if the following pre-requisites are met:
|
||||
|
||||
\li The application is compiled and linked to a position independent binary
|
||||
(executable or library)
|
||||
|
||||
\li The application is started with the \c invoker command instead of executing the executable file.
|
||||
|
||||
\section howitworksforqt How the launcher can help Qt applications
|
||||
|
||||
There no cache (like MComponentCache) for Qt applications, but preloading Qt libraries make the launch faster. Using the launcher will also save memory.
|
||||
|
||||
\section source Modifying source code
|
||||
|
||||
The launcher needs to find the symbol \c main in the application binary
|
||||
in order to start executing the application. However, unnecessary
|
||||
symbols in the application binary cause unnecessary overhead, so the
|
||||
recommended flags for compiling for the launcher hide symbols
|
||||
by default. When the flags are used, the main function must be
|
||||
explicitly exported as follows:
|
||||
|
||||
\code
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
Q_DECL_EXPORT int main(int argc, char **argv)
|
||||
{
|
||||
...
|
||||
}
|
||||
\endcode
|
||||
|
||||
\section compilation Compiling and linking
|
||||
|
||||
To compile binaries that can be run with applauncherd, use
|
||||
\c -fPIC option to produce position-independent code. To
|
||||
produce a position-independent executable, \c -pie option and \c
|
||||
-rdynamic options can be used in linking. This makes it possible to execute the result both
|
||||
traditionally and with the invoker.
|
||||
|
||||
To improve linking and load times of shared object libraries the size
|
||||
of dynamic export table it is encouraged to hide the unnecessary
|
||||
symbols from the resulting binary by using \c -fvisibility=hidden and
|
||||
\c -fvisibility-inlines-hidden flags in compilation as well.
|
||||
|
||||
\subsection qmaketips Building with QMake
|
||||
|
||||
\subsubsection qmakepreferred Building in the preferred way
|
||||
|
||||
Once you have installed the \c applauncherd-dev package, simply use QMake configuration option \c qt-boostable:
|
||||
|
||||
\code
|
||||
CONFIG += qt-boostable
|
||||
\endcode
|
||||
|
||||
This tells qmake to use the \c qt-boostable feature, which
|
||||
uses \c pkg-config for the flags. Unfortunately qmake does not complain
|
||||
if you add the line but have not installed \c applauncherd-dev, so if the
|
||||
QMake magic does not seem to work, double-check that the package is
|
||||
indeed installed.
|
||||
|
||||
\subsubsection qmakeother Building with pkg-config
|
||||
|
||||
Use the \c pkg-config to get the correct flags:
|
||||
|
||||
\code
|
||||
QMAKE_CXXFLAGS += `pkg-config --cflags qt-boostable`
|
||||
QMAKE_LFLAGS += `pkg-config --libs qt-boostable`
|
||||
\endcode
|
||||
|
||||
If \c applauncherd-dev is not installed, \c pkg-config
|
||||
complains when you run \c make.
|
||||
|
||||
\subsubsection qmakelastresort The last resort
|
||||
|
||||
Manually define the following variables in the .pro file:
|
||||
|
||||
\code
|
||||
QMAKE_CXXFLAGS += -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
QMAKE_LFLAGS += -pie -rdynamic
|
||||
\endcode
|
||||
|
||||
It is then up to you to modify the .pro file if there are changes to the
|
||||
required compiler and linker flags.
|
||||
|
||||
\subsection cmaketips Building with CMake
|
||||
|
||||
1. Use \c pkg-config in CMake by including \c FindPkgConfig in \c CMakeLists.txt:
|
||||
|
||||
\code
|
||||
include(FindPkgConfig)
|
||||
\endcode
|
||||
|
||||
2. To obtain the compiler and linker flags, add the following lines:
|
||||
|
||||
\code
|
||||
pkg_check_modules(QT_BOOSTABLE REQUIRED qt-boostable)
|
||||
add_definitions(${QT_BOOSTABLE_CFLAGS})
|
||||
link_libraries(${QT_BOOSTABLE_LDFLAGS})
|
||||
\endcode
|
||||
|
||||
If you do not want to use \c pkg-config for some reason, you can manually add the
|
||||
compiler and linker flags as follows:
|
||||
|
||||
\code
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fvisibility=hidden -fvisibility-inlines-hidden")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-pie -rdynamic")
|
||||
\endcode
|
||||
|
||||
Again, you need to update the flags if something changes.
|
||||
|
||||
\subsection pkgconfig Obtaining flags with pkg-config
|
||||
|
||||
The package \c applauncherd-dev provides the necessary files for
|
||||
\c pkg-config to get the appropriate compiler and linker flags.
|
||||
|
||||
1. To get the compiler flags, use the following:
|
||||
|
||||
\code
|
||||
pkg-config --cflags qt-boostable
|
||||
\endcode
|
||||
|
||||
2. To get the linker flags, use the following:
|
||||
|
||||
\code
|
||||
pkg-config --libs qt-boostable
|
||||
\endcode
|
||||
|
||||
\section running Running boosted application
|
||||
|
||||
Check that applauncherd package is installed and applancherd daemon is
|
||||
running. You can now run your application as usual as
|
||||
/usr/bin/application_binary, or use the qtboosted launching by running:
|
||||
|
||||
\code
|
||||
invoker --type=q /usr/bin/application_binary
|
||||
\endcode
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue