aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kampas <martin.kampas@jolla.com>2016-09-06 07:45:37 +0200
committerJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2016-10-05 18:24:51 +0000
commit7f15bd630863fd956cd489888b0b156d8020edc4 (patch)
treea017301f4cf9872df7fb0b778fa9003342201354
parent5cc4ce743c461f8763f2328d3020acf01eac0974 (diff)
Extract shared library
See http://lists.qt-project.org/pipermail/automotive/2016-August/000062.html Change-Id: Ib3cacfac2928ff2e2ca1d4cbd5e4f18947b3fe71 Reviewed-by: Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>
-rw-r--r--doc/installation.qdoc68
-rw-r--r--doc/usage.qdoc15
-rw-r--r--examples/app/app.pro4
-rw-r--r--qmllive.pri12
-rw-r--r--qmllive.pro7
-rw-r--r--src/bench/bench.pro17
-rw-r--r--src/bench/qmlpreviewadapter.cpp7
-rw-r--r--src/bench/reload.pro2
-rw-r--r--src/contentadapterinterface.h4
-rw-r--r--src/lib.pri9
-rw-r--r--src/lib.pro36
-rw-r--r--src/lib/lib.pro14
-rw-r--r--src/livehubengine.h4
-rw-r--r--src/livenodeengine.h3
-rw-r--r--src/liveruntime.h5
-rw-r--r--src/logger.h4
-rw-r--r--src/logreceiver.h4
-rw-r--r--src/previewGenerator/previewGenerator.pro16
-rw-r--r--src/qmlhelper.h4
-rw-r--r--src/qmllive.cpp (renamed from src/lib/qmllive.cpp)0
-rw-r--r--src/qmllive.h (renamed from src/lib/qmllive.h)0
-rw-r--r--src/qmllive_global.h (renamed from src/lib/qmllive_global.h)0
-rw-r--r--src/remotelogger.h5
-rw-r--r--src/remotepublisher.h4
-rw-r--r--src/remotereceiver.h4
-rw-r--r--src/runtime/runtime.pro13
-rw-r--r--src/src.pri15
-rw-r--r--src/src.pro20
28 files changed, 216 insertions, 80 deletions
diff --git a/doc/installation.qdoc b/doc/installation.qdoc
index d68b2be..e612b62 100644
--- a/doc/installation.qdoc
+++ b/doc/installation.qdoc
@@ -49,7 +49,13 @@
$ make
\endcode
-The desktop executable is available at `./bin/qmllivebench`.
+QML Live Bench can be started directly from build directory by executing
+\c{./bin/qmllivebench}. Optionally it can be installed with
+
+\code
+ $ make install
+\endcode
+
\chapter Building for device
@@ -57,14 +63,22 @@ The desktop executable is available at `./bin/qmllivebench`.
target.}
\code
- $ qmake # from cross compiler toolchain
+ # using qmake from cross compiler toolchain
+ $ qmake "CONFIG+=skip-bench skip-examples static-link-runtime"
$ make
\endcode
-You need to cross-compile QmlLive and copy the `./bin/qmlliveruntime` onto the
+You need to cross-compile QmlLive and copy the \c{./bin/qmlliveruntime} binary onto the
target.
-\chapter Build documentation
+Optionally it can be packaged with the help of
+
+\code
+ $ make install INSTALL_ROOT=...
+\endcode
+
+
+\chapter Building documentation
\code
$ export QT_INSTALL_DOCS=$QTSRC/qtbase/doc
@@ -73,4 +87,50 @@ target.
The documentation will be available at \tt{doc/html/index.html}.
+
+\chapter Build options reference
+
+The following values can be added to qmake \c CONFIG variable:
+
+\table
+\header
+ \li Option
+ \li Description
+
+\row
+ \li skip-bench
+ \li Do not build \l{Workbench}{QML Live Bench}
+
+\row
+ \li skip-examples
+ \li Do not build examples
+
+\row
+ \li skip-runtime
+ \li Do not build \l{QmlLive Runtime}{QML Live Runtime}
+
+\row
+ \li skip-tests
+ \li Do not build tests
+
+\row
+ \li static-link-runtime
+ \li Produce a single-binary QML Live Runtime executable. Without this option
+ enabled QML Live Runtime executable requires the \c libqmllive dynamic
+ library to be copied to the target.
+\endtable
+
+The following custom qmake variables are recognized:
+
+\table
+\header
+ \li Variable
+ \li Description
+
+\row
+ \li PREFIX
+ \li Installation prefix. Defaults to \c{$$[QT_INSTALL_PREFIX]}.
+\endtable
+
+
*/
diff --git a/doc/usage.qdoc b/doc/usage.qdoc
index fd9c0ff..ed67e4a 100644
--- a/doc/usage.qdoc
+++ b/doc/usage.qdoc
@@ -152,10 +152,23 @@ any QML component.
You can create your own custom runtime with the QmlLive features. This allows you to use your QML view setup with your additional C++ code together with the QmlLive system.
-For this you need to add \tt{$(QMLLIVEPROJECT)/src/src.pri} to your project folder and use the \b{LiveNodeEngine} class to be able to receive workspace changes and active document updates. By default, the IPC will listen on the port 10234.
+For this you need to use the \b{LiveNodeEngine} class to be able to receive
+workspace changes and active document updates. By default, the IPC will listen
+on the port 10234.
Here is a short example of a minimal custom runtime:
\snippet ../examples/app/main.cpp 0
+On platforms where pkg-config is supported simply add the following to your
+project file if QML Live is installed on your build host:
+
+\code
+CONFIG += link_pkgconfig
+PKGCONFIG += qmllive
+\endcode
+
+Another option is to compile everything directly into your application by
+including \c{$(QMLLIVEPROJECT)/src/src.pri} in your project file.
+
*/
diff --git a/examples/app/app.pro b/examples/app/app.pro
index f8ce6b5..e7f577d 100644
--- a/examples/app/app.pro
+++ b/examples/app/app.pro
@@ -1,7 +1,9 @@
TEMPLATE = app
TARGET = app
-include(../../src/src.pri)
+QT *= quick
+
+include(../../src/lib.pri)
SOURCES += main.cpp
OTHER_FILES += \
diff --git a/qmllive.pri b/qmllive.pri
index e0cc675..bf0dc84 100644
--- a/qmllive.pri
+++ b/qmllive.pri
@@ -1,3 +1,15 @@
+android|ios {
+ message("Note: the bench, examples and shared library will not be built on this platform")
+ CONFIG += skip-bench skip-examples static-link-runtime
+}
+
+VERSION = 0.1.0
+isEmpty(PREFIX): PREFIX = $$[QT_INSTALL_PREFIX]
+
+VERSIONS = $$split(VERSION, ".")
+VERSION_MAJOR = $$member(VERSIONS, 0)
+unset(VERSIONS)
+
# from qtcreator.pri
defineTest(minQtVersion) {
maj = $$1
diff --git a/qmllive.pro b/qmllive.pro
index 60a4cf0..0cdf245 100644
--- a/qmllive.pro
+++ b/qmllive.pro
@@ -10,11 +10,10 @@ include(doc/doc.pri)
!minQtVersion(5, 4, 0):error("You need at least Qt 5.4.0 to build this application")
TEMPLATE = subdirs
+CONFIG += ordered
-SUBDIRS += \
- src \
- tests
-
+SUBDIRS += src
+!CONFIG(skip-tests): SUBDIRS += tests
!CONFIG(skip-examples): SUBDIRS += examples
OTHER_FILES += \
diff --git a/src/bench/bench.pro b/src/bench/bench.pro
index 4f814ac..3cfa528 100644
--- a/src/bench/bench.pro
+++ b/src/bench/bench.pro
@@ -1,3 +1,5 @@
+include(../../qmllive.pri)
+
TEMPLATE = app
TARGET = qmllivebench
DESTDIR = $$BUILD_DIR/bin
@@ -45,7 +47,6 @@ HEADERS += \
autodiscoveryhostsdialog.h \
options.h
-
FORMS += \
optionsdialog.ui \
hostsoptionpage.ui \
@@ -54,18 +55,12 @@ FORMS += \
autodiscoveryhostsdialog.ui
include(../widgets/widgets.pri)
-include(../src.pri)
+include(../lib.pri)
# install rules
-isEmpty(PREFIX) {
- target.path = $$[QT_INSTALL_BINS]
-} else {
- macos: INSTALLSUBDIR=$${TARGET}.app/Contents/MacOS/
- macos: CONFIG -= app_bundle
- target.path = $$PREFIX
-}
-
+macx*: CONFIG -= app_bundle
+target.path = $$PREFIX/bin
INSTALLS += target
win32: RC_FILE = ../../icons/appicon.rc
-osx: ICON = ../../icons/appicon.icns
+macx*: ICON = ../../icons/appicon.icns
diff --git a/src/bench/qmlpreviewadapter.cpp b/src/bench/qmlpreviewadapter.cpp
index 375b413..ac5415e 100644
--- a/src/bench/qmlpreviewadapter.cpp
+++ b/src/bench/qmlpreviewadapter.cpp
@@ -61,13 +61,12 @@ QImage QmlPreviewAdapter::preview(const QString &path, const QSize &requestedSiz
return QImage();
}
+ static const QString program = QCoreApplication::applicationDirPath() +
#ifdef Q_OS_WINDOWS
- static const QString suffix = ".exe";
+ QStringLiteral("/previewGenerator.exe");
#else
- static const QString suffix;
+ QStringLiteral("/../libexec/qmllive/previewGenerator");
#endif
-
- static const QString program = QCoreApplication::applicationDirPath() + QDir::separator() + "previewGenerator" + suffix;
static const QStringList arguments("QmlLiveBench");
if (proc()->state() != QProcess::Running) {
diff --git a/src/bench/reload.pro b/src/bench/reload.pro
index 89a9668..86f973a 100644
--- a/src/bench/reload.pro
+++ b/src/bench/reload.pro
@@ -7,7 +7,7 @@ QT = gui core
qt5:QT += quick widgets core-private
else:QT += declarative
-osx: CONFIG -= app_bundle
+macx*: CONFIG -= app_bundle
qt5:DEFINES += USING_QT5
else:DEFINES += USING_QT4
diff --git a/src/contentadapterinterface.h b/src/contentadapterinterface.h
index b1043d5..7903dc5 100644
--- a/src/contentadapterinterface.h
+++ b/src/contentadapterinterface.h
@@ -35,11 +35,13 @@
#include <QUrl>
#include <QImage>
+#include "qmllive_global.h"
+
QT_FORWARD_DECLARE_CLASS(QDeclarativeContext);
QT_FORWARD_DECLARE_CLASS(QQmlContext);
//! [0]
-class ContentAdapterInterface
+class QMLLIVESHARED_EXPORT ContentAdapterInterface
{
public:
diff --git a/src/lib.pri b/src/lib.pri
new file mode 100644
index 0000000..230cb88
--- /dev/null
+++ b/src/lib.pri
@@ -0,0 +1,9 @@
+include(../qmllive.pri)
+
+INCLUDEPATH += $${PWD}
+
+win32: LIBS += -L$${BUILD_DIR}/lib -lqmllive$${VERSION_MAJOR}
+else: LIBS += -L$${BUILD_DIR}/lib -lqmllive
+
+# This can be simply eliminated by passing '-after QMAKE_RPATHDIR=' to qmake
+QMAKE_RPATHDIR += $${BUILD_DIR}/lib
diff --git a/src/lib.pro b/src/lib.pro
new file mode 100644
index 0000000..89baf59
--- /dev/null
+++ b/src/lib.pro
@@ -0,0 +1,36 @@
+include(../qmllive.pri)
+
+TEMPLATE = lib
+TARGET = qmllive
+
+DESTDIR = $${BUILD_DIR}/lib
+DEFINES += QMLLIVE_LIBRARY
+
+macx*: QMAKE_SONAME_PREFIX = @rpath
+
+SOURCES += \
+ qmllive.cpp
+
+public_headers += \
+ qmllive_global.h \
+ qmllive.h
+
+include(src.pri)
+
+win32: target.path = $${PREFIX}/bin
+else: target.path = $${PREFIX}/lib
+INSTALLS += target
+
+headers.files = $$public_headers
+headers.path = $${PREFIX}/include/qmllive
+INSTALLS += headers
+
+!win32 {
+ CONFIG += create_pc create_prl no_install_prl
+ QMAKE_PKGCONFIG_NAME = qmllive
+ QMAKE_PKGCONFIG_DESCRIPTION = Qt QML Live Library
+ QMAKE_PKGCONFIG_PREFIX = $$PREFIX
+ QMAKE_PKGCONFIG_LIBDIR = ${prefix}/lib
+ QMAKE_PKGCONFIG_INCDIR = ${prefix}/include/qmllive
+ QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+}
diff --git a/src/lib/lib.pro b/src/lib/lib.pro
deleted file mode 100644
index 81af9ea..0000000
--- a/src/lib/lib.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TEMPLATE = lib
-TARGET = qmllive
-
-
-DESTDIR = ../../libs
-DEFINES += QMLLIVE_LIBRARY
-
-SOURCES += \
- qmllive.cpp
-
-HEADERS +=\
- qmllive_global.h \
- qmllive.h
-
diff --git a/src/livehubengine.h b/src/livehubengine.h
index 763ae05..362c7db 100644
--- a/src/livehubengine.h
+++ b/src/livehubengine.h
@@ -33,10 +33,12 @@
#include <QtCore>
+#include "qmllive_global.h"
+
class Watcher;
class ContentPluginFactory;
-class LiveHubEngine : public QObject
+class QMLLIVESHARED_EXPORT LiveHubEngine : public QObject
{
Q_OBJECT
public:
diff --git a/src/livenodeengine.h b/src/livenodeengine.h
index ce8a56f..df030e1 100644
--- a/src/livenodeengine.h
+++ b/src/livenodeengine.h
@@ -35,12 +35,13 @@
#include <QtQuick>
#include "contentadapterinterface.h"
+#include "qmllive_global.h"
class LiveRuntime;
class ContentPluginFactory;
class OverlayUrlInterceptor;
-class LiveNodeEngine : public QObject
+class QMLLIVESHARED_EXPORT LiveNodeEngine : public QObject
{
Q_OBJECT
diff --git a/src/liveruntime.h b/src/liveruntime.h
index 61cf37f..7be16ab 100644
--- a/src/liveruntime.h
+++ b/src/liveruntime.h
@@ -34,15 +34,14 @@
#include <QtCore>
#include <QtGui>
+#include "qmllive_global.h"
-class LiveRuntime : public QObject
+class QMLLIVESHARED_EXPORT LiveRuntime : public QObject
{
Q_OBJECT
-
Q_PROPERTY(qreal screenWidth READ screenWidth WRITE setScreenWidth NOTIFY screenWidthChanged)
Q_PROPERTY(qreal screenHeight READ screenHeight WRITE setScreenHeight NOTIFY screenHeightChanged)
-
public:
explicit LiveRuntime(QObject *parent = 0);
qreal screenWidth() const;
diff --git a/src/logger.h b/src/logger.h
index f6eb147..a5e0b49 100644
--- a/src/logger.h
+++ b/src/logger.h
@@ -35,10 +35,12 @@
#include <QMutex>
#include <QUrl>
+#include "qmllive_global.h"
-class Logger : public QObject
+class QMLLIVESHARED_EXPORT Logger : public QObject
{
Q_OBJECT
+
public:
explicit Logger(QObject *parent = 0);
virtual ~Logger();
diff --git a/src/logreceiver.h b/src/logreceiver.h
index 10796de..bd4ddfb 100644
--- a/src/logreceiver.h
+++ b/src/logreceiver.h
@@ -35,9 +35,11 @@
#include <QUrl>
#include <QHostAddress>
+#include "qmllive_global.h"
+
QT_FORWARD_DECLARE_CLASS(QUdpSocket);
-class LogReceiver : public QObject
+class QMLLIVESHARED_EXPORT LogReceiver : public QObject
{
Q_OBJECT
public:
diff --git a/src/previewGenerator/previewGenerator.pro b/src/previewGenerator/previewGenerator.pro
index 39e2986..59b3cda 100644
--- a/src/previewGenerator/previewGenerator.pro
+++ b/src/previewGenerator/previewGenerator.pro
@@ -1,16 +1,14 @@
+include(../../qmllive.pri)
+
TEMPLATE = app
TARGET = previewGenerator
-DESTDIR = $$BUILD_DIR/bin
+win32: DESTDIR = $$BUILD_DIR/bin
+else: DESTDIR = $$BUILD_DIR/libexec/qmllive
# install rules
-isEmpty(PREFIX) {
- target.path = $$[QT_INSTALL_BINS]
-} else {
- macos: INSTALLSUBDIR=$${TARGET}.app/Contents/MacOS/
- macos: CONFIG -= app_bundle
- target.path = $$PREFIX
-}
-
+macx*: CONFIG -= app_bundle
+win32: target.path = $$PREFIX/bin
+else: target.path = $$PREFIX/libexec/qmllive
INSTALLS += target
QT = gui core quick widgets
diff --git a/src/qmlhelper.h b/src/qmlhelper.h
index 3df7bad..38e2552 100644
--- a/src/qmlhelper.h
+++ b/src/qmlhelper.h
@@ -35,7 +35,9 @@
#include <QtQml>
#include <QtQuick>
-class QmlHelper : public QObject
+#include "qmllive_global.h"
+
+class QMLLIVESHARED_EXPORT QmlHelper : public QObject
{
Q_OBJECT
public:
diff --git a/src/lib/qmllive.cpp b/src/qmllive.cpp
index 6318cf5..6318cf5 100644
--- a/src/lib/qmllive.cpp
+++ b/src/qmllive.cpp
diff --git a/src/lib/qmllive.h b/src/qmllive.h
index a1503b0..a1503b0 100644
--- a/src/lib/qmllive.h
+++ b/src/qmllive.h
diff --git a/src/lib/qmllive_global.h b/src/qmllive_global.h
index ce64734..ce64734 100644
--- a/src/lib/qmllive_global.h
+++ b/src/qmllive_global.h
diff --git a/src/remotelogger.h b/src/remotelogger.h
index 9db3e5e..6b4f947 100644
--- a/src/remotelogger.h
+++ b/src/remotelogger.h
@@ -35,11 +35,14 @@
#include <QHostAddress>
#include <QtQuick>
+#include "qmllive_global.h"
+
QT_FORWARD_DECLARE_CLASS(QUdpSocket);
-class RemoteLogger : public Logger
+class QMLLIVESHARED_EXPORT RemoteLogger : public Logger
{
Q_OBJECT
+
public:
explicit RemoteLogger(QObject *parent = 0);
diff --git a/src/remotepublisher.h b/src/remotepublisher.h
index a500cca..8d69f9b 100644
--- a/src/remotepublisher.h
+++ b/src/remotepublisher.h
@@ -34,10 +34,12 @@
#include <QtCore>
#include <QAbstractSocket>
+#include "qmllive_global.h"
+
class LiveHubEngine;
class IpcClient;
-class RemotePublisher : public QObject
+class QMLLIVESHARED_EXPORT RemotePublisher : public QObject
{
Q_OBJECT
public:
diff --git a/src/remotereceiver.h b/src/remotereceiver.h
index 941ccd8..aba3eed 100644
--- a/src/remotereceiver.h
+++ b/src/remotereceiver.h
@@ -36,13 +36,15 @@
#include <QQmlError>
+#include "qmllive_global.h"
+
class LiveNodeEngine;
class IpcServer;
class IpcClient;
QT_FORWARD_DECLARE_CLASS(QTcpSocket);
-class RemoteReceiver : public QObject
+class QMLLIVESHARED_EXPORT RemoteReceiver : public QObject
{
Q_OBJECT
diff --git a/src/runtime/runtime.pro b/src/runtime/runtime.pro
index 7d9fd7c..917fdc9 100644
--- a/src/runtime/runtime.pro
+++ b/src/runtime/runtime.pro
@@ -1,19 +1,20 @@
+include(../../qmllive.pri)
+
TARGET = qmlliveruntime
DESTDIR = $$BUILD_DIR/bin
QT *= widgets quick
-osx: CONFIG -= app_bundle
+macx*: CONFIG -= app_bundle
SOURCES += main.cpp
win32: RC_FILE = ../../icons/appicon.rc
-include(../widgets/widgets.pri)
-include(../src.pri)
+static-link-runtime: include(../src.pri)
+else: include(../lib.pri)
RESOURCES += \
qml.qrc
-
-
-
+target.path = $$PREFIX/bin
+INSTALLS += target
diff --git a/src/src.pri b/src/src.pri
index 08201f5..55dd139 100644
--- a/src/src.pri
+++ b/src/src.pri
@@ -21,20 +21,23 @@ SOURCES += \
$$PWD/logreceiver.cpp \
$$PWD/fontadapter.cpp
-HEADERS += \
- $$PWD/watcher.h \
+public_headers += \
$$PWD/livehubengine.h \
$$PWD/livenodeengine.h \
$$PWD/qmlhelper.h \
$$PWD/liveruntime.h \
+ $$PWD/logger.h \
+ $$PWD/logreceiver.h \
$$PWD/remotepublisher.h \
$$PWD/remotereceiver.h \
$$PWD/contentadapterinterface.h \
+ $$PWD/remotelogger.h
+
+HEADERS += \
+ $$public_headers \
+ $$PWD/watcher.h \
$$PWD/imageadapter.h \
$$PWD/contentpluginfactory.h \
- $$PWD/logger.h \
- $$PWD/remotelogger.h \
- $$PWD/logreceiver.h \
$$PWD/fontadapter.h
OTHER_FILES += \
@@ -51,5 +54,3 @@ RESOURCES += \
$$PWD/livert.qrc
include(ipc/ipc.pri)
-
-
diff --git a/src/src.pro b/src/src.pro
index ff4c072..b18eb1c 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -1,13 +1,21 @@
+include(../qmllive.pri)
+
TEMPLATE = subdirs
CONFIG += ordered
-!android:!ios {
- SUBDIRS += bench \
- previewGenerator
+skip-bench:skip-examples:static-link-runtime {
+ CONFIG += skip-lib
}
-SUBDIRS += \
- runtime
+!skip-lib {
+ SUBDIRS += lib.pro
+}
+!skip-bench {
+ SUBDIRS += bench \
+ previewGenerator
+}
-include(src.pri)
+!skip-runtime {
+ SUBDIRS += runtime
+}