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