Refactor build system.
This commit is contained in:
@@ -1,21 +1,16 @@
|
||||
include(../config.pri)
|
||||
include(../common/defines.pri)
|
||||
|
||||
QT += qml quick core network sql
|
||||
TEMPLATE += app
|
||||
TARGET = qcma_android
|
||||
TEMPLATE=app
|
||||
QT += network sql
|
||||
CONFIG += mobility
|
||||
|
||||
android {
|
||||
QT += androidextras
|
||||
QT += androidextras
|
||||
}
|
||||
|
||||
QT -= gui
|
||||
LIBS += -L../common -lqcma_common
|
||||
CONFIG += mobility
|
||||
|
||||
# this library needs to link statically their deps but Qt doesn't pass --static to PKGCONFIG
|
||||
QMAKE_CXXFLAGS += $$system(pkg-config --static --cflags libvitamtp)
|
||||
LIBS += -lvitamtp -lxml2 -liconv
|
||||
|
||||
SOURCES += \
|
||||
main_android.cpp \
|
||||
@@ -34,3 +29,9 @@ DISTFILES += \
|
||||
android-src/gradlew.bat
|
||||
|
||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-src
|
||||
|
||||
include(../common/common.pri)
|
||||
|
||||
android {
|
||||
LIBS += -lvitamtp -lxml2 -liconv
|
||||
}
|
||||
|
@@ -25,10 +25,15 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QHostInfo>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QTextStream>
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <QAndroidJniObject>
|
||||
#endif
|
||||
|
||||
#include <vitamtp.h>
|
||||
|
||||
ServiceManager::ServiceManager(QObject *obj_parent)
|
||||
@@ -211,9 +216,13 @@ void ServiceManager::loadDefaultSettings()
|
||||
|
||||
settings.setValue("protocolVersion", VITAMTP_PROTOCOL_MAX_VERSION);
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
QString deviceName = QAndroidJniObject::getStaticObjectField(
|
||||
"android/os/Build", "MODEL", "Ljava/lang/String;")
|
||||
.toString();
|
||||
#else
|
||||
QString deviceName = QHostInfo::localHostName();
|
||||
#endif
|
||||
|
||||
qDebug("Detected device model: %s", qPrintable(deviceName));
|
||||
settings.setValue("hostName", deviceName);
|
||||
|
39
cli/cli.pro
39
cli/cli.pro
@@ -1,31 +1,34 @@
|
||||
include(../config.pri)
|
||||
include(../common/defines.pri)
|
||||
|
||||
TARGET = qcma_cli
|
||||
# remove linked gui libs
|
||||
QT -= gui
|
||||
|
||||
QT += core network sql
|
||||
TEMPLATE += app
|
||||
QT += network sql core
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT -= gui
|
||||
|
||||
LIBS += -L../common -lqcma_common
|
||||
TARGET = qcma_cli
|
||||
|
||||
SOURCES += \
|
||||
main_cli.cpp \
|
||||
singlecoreapplication.cpp \
|
||||
headlessmanager.cpp
|
||||
main_cli.cpp \
|
||||
singlecoreapplication.cpp \
|
||||
headlessmanager.cpp
|
||||
|
||||
HEADERS += \
|
||||
singlecoreapplication.h \
|
||||
headlessmanager.h
|
||||
singlecoreapplication.h \
|
||||
headlessmanager.h
|
||||
|
||||
include(../common/common.pri)
|
||||
|
||||
DISABLE_FFMPEG {
|
||||
PKGCONFIG = libvitamtp
|
||||
} else {
|
||||
# find packages using pkg-config
|
||||
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
|
||||
}
|
||||
# Linux-only config
|
||||
unix:!macx {
|
||||
# installation prefix
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr/local
|
||||
}
|
||||
|
||||
BINDIR = $$PREFIX/bin
|
||||
DATADIR = $$PREFIX/share
|
||||
MANDIR = $$DATADIR/man/man1
|
||||
|
||||
man_cli.files = qcma_cli.1
|
||||
man_cli.path = $$MANDIR
|
||||
target.path = $$BINDIR
|
||||
|
15
common/common.pri
Normal file
15
common/common.pri
Normal file
@@ -0,0 +1,15 @@
|
||||
INCLUDEPATH += $$PWD
|
||||
DEPENDPATH += $$PWD
|
||||
|
||||
!android {
|
||||
PKGCONFIG += libvitamtp
|
||||
}
|
||||
|
||||
!DISABLE_FFMPEG {
|
||||
PKGCONFIG += libavformat libavcodec libavutil libswscale
|
||||
}
|
||||
|
||||
unix|win32: LIBS += -L ../common/ -lqcma_common
|
||||
|
||||
win32:!win32-g++: PRE_TARGETDEPS += ../common/qcma_common.lib
|
||||
else:unix|win32-g++: PRE_TARGETDEPS += ../common/libqcma_common.a
|
@@ -1,9 +1,10 @@
|
||||
include(../config.pri)
|
||||
|
||||
TARGET = qcma_common
|
||||
QT += core network sql
|
||||
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib
|
||||
TARGET = qcma_common
|
||||
|
||||
SOURCES += \
|
||||
capability.cpp \
|
||||
@@ -36,12 +37,12 @@ HEADERS += \
|
||||
qlistdb.h \
|
||||
database.h
|
||||
|
||||
DISABLE_FFMPEG {
|
||||
PKGCONFIG = libvitamtp
|
||||
} else {
|
||||
PKGCONFIG += libvitamtp
|
||||
|
||||
!DISABLE_FFMPEG {
|
||||
DEFINES += FFMPEG_ENABLED
|
||||
SOURCES += avdecoder.cpp
|
||||
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
|
||||
PKGCONFIG += libavformat libavcodec libavutil libswscale
|
||||
}
|
||||
|
||||
OTHER_FILES += \
|
||||
|
@@ -1,2 +0,0 @@
|
||||
INCLUDEPATH += $$IN_PWD
|
||||
DEPENDPATH += $$IN_PWD
|
11
config.pri
11
config.pri
@@ -20,15 +20,6 @@ QMAKE_CXXFLAGS += -Wno-write-strings -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MA
|
||||
unix:!macx {
|
||||
# largefile support
|
||||
DEFINES += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE
|
||||
|
||||
# installation prefix
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr/local
|
||||
}
|
||||
|
||||
BINDIR = $$PREFIX/bin
|
||||
DATADIR = $$PREFIX/share
|
||||
MANDIR = $$DATADIR/man/man1
|
||||
}
|
||||
|
||||
# Windows config
|
||||
@@ -41,8 +32,6 @@ win32 {
|
||||
macx {
|
||||
# OS X icon
|
||||
ICON = resources/images/qcma.icns
|
||||
# re-enable pkg-config on OS X (brew installs pkg-config files)
|
||||
QT_CONFIG -= no-pkg-config
|
||||
}
|
||||
|
||||
# try to get the current git version + hash
|
||||
|
31
gui/gui.pro
31
gui/gui.pro
@@ -1,9 +1,8 @@
|
||||
include(../config.pri)
|
||||
include(../common/defines.pri)
|
||||
|
||||
TARGET = qcma
|
||||
TEMPLATE += app
|
||||
QT += gui widgets network sql
|
||||
TEMPLATE += app
|
||||
TARGET = qcma
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
@@ -51,19 +50,23 @@ OTHER_FILES += \
|
||||
resources/qcma.desktop \
|
||||
qcma.rc
|
||||
|
||||
RESOURCES += gui.qrc
|
||||
include(../common/common.pri)
|
||||
|
||||
DISABLE_FFMPEG {
|
||||
PKGCONFIG = libvitamtp
|
||||
} else {
|
||||
# find packages using pkg-config
|
||||
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
|
||||
}
|
||||
RESOURCES += gui.qrc
|
||||
|
||||
#Linux-only config
|
||||
unix:!macx {
|
||||
PKGCONFIG += libnotify
|
||||
|
||||
# installation prefix
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr/local
|
||||
}
|
||||
|
||||
BINDIR = $$PREFIX/bin
|
||||
DATADIR = $$PREFIX/share
|
||||
MANDIR = $$DATADIR/man/man1
|
||||
|
||||
# config for desktop file and icon
|
||||
desktop.path = $$DATADIR/applications
|
||||
desktop.files += resources/$${TARGET}.desktop
|
||||
@@ -84,11 +87,3 @@ win32 {
|
||||
# Windows icon
|
||||
RC_FILE = qcma.rc
|
||||
}
|
||||
|
||||
unix|win32: LIBS += -L$$OUT_PWD/../common/ -lqcma_common
|
||||
|
||||
INCLUDEPATH += $$PWD/../common
|
||||
DEPENDPATH += $$PWD/../common
|
||||
|
||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../common/qcma_common.lib
|
||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../common/libqcma_common.a
|
||||
|
10
qcma.pro
10
qcma.pro
@@ -5,7 +5,6 @@
|
||||
#-------------------------------------------------
|
||||
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
SUBDIRS = common
|
||||
|
||||
unix:!macx:!android {
|
||||
@@ -13,7 +12,6 @@ unix:!macx:!android {
|
||||
SUBDIRS += cli
|
||||
cli.depends = common
|
||||
|
||||
# The appindicator and kde extensions are linux only too
|
||||
ENABLE_APPINDICATOR {
|
||||
SUBDIRS += appindicator
|
||||
appindicator.depends = gui
|
||||
@@ -24,10 +22,14 @@ unix:!macx:!android {
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
unix {
|
||||
# Compile the Qt Quick binary only on Android
|
||||
SUBDIRS += android
|
||||
android.depends = common
|
||||
} else {
|
||||
}
|
||||
|
||||
!android {
|
||||
# Build the Qt Widgets binary on all platforms, except Android
|
||||
SUBDIRS += gui
|
||||
gui.depends = common
|
||||
}
|
||||
|
Reference in New Issue
Block a user