Skip to content

Commit

Permalink
Fixed integration issues in debug/release modes.
Browse files Browse the repository at this point in the history
Added build directory.
Reverted application resource file.
Added linkLocalLibrary function.
Reverted qmldir and plugins.qmltypes
  • Loading branch information
dinusv committed May 9, 2017
1 parent 37086fc commit 6d67d1e
Show file tree
Hide file tree
Showing 35 changed files with 555 additions and 454 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
livecv.pro.user
bin/*
build/*
!build/.gitignore
45 changes: 35 additions & 10 deletions .qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
#
# Since it is highly advisable to use a shadow build configuration,
# we should not mess with the build directory at all, thats qmake's domain.
SOURCE_ROOT_PWD = $$PWD
BUILD_ROOT_PWD = $$shadowed($$PWD)
DEPLOY_ROOT_PWD = $$PWD/bin
CONFIG_DIR = $$SOURCE_ROOT_PWD/config

PROJECT_ROOT = $$PWD
DEPLOY_ROOT = $$OUT_PWD/bin

#BUILD_ROOT_PWD = $$shadowed($$PWD)
#DEPLOY_ROOT_PWD = $$OUT_PWD
#CONFIG_DIR = $$PROJECT_ROOT/config

# --- Functions required for easier bootstrapping ---
# Determines the path to the requested config file and returns it for use with
Expand All @@ -25,14 +28,36 @@ CONFIG_DIR = $$SOURCE_ROOT_PWD/config
# Example:
# include($$getConfigFile(config_foo.pri))

defineReplace(getConfigFile){
#defineReplace(getConfigFile){

# FILE = $$CONFIG_DIR/$$1
# !exists($$FILE): error(Missing config file $$FILE)
# return($$FILE)
#}

# --- Using C++ 11 ---

CONFIG *= c++11

# --- Preparing for build mode specific paths ---

# USE_BUILD_MODE_PATHS triggers the usage of specific build paths depending on whether
# you are building in debug or release mode
# This is enabled per default for windows builds and disabled per default for
# unix builds.
# You can override this default setting by either defining the variable
# beforehand or passing an own value to qmake

# Uncomment one of the following for a quick override
# USE_BUILD_MODE_PATHS = true
# USE_BUILD_MODE_PATHS = false

FILE = $$CONFIG_DIR/$$1
!exists($$FILE): error(Missing config file $$FILE)
return($$FILE)
!defined(USE_BUILD_MODE_PATHS){
win32:USE_BUILD_MODE_PATHS = true
else: USE_BUILD_MODE_PATHS = false
}

# --- Bootstrapping utility functions and paths that are required globally---

include($$getConfigFile(config_functions.pri))
include($$getConfigFile(config_paths.pri))
include($$PWD/config/config_functions.pri)
include($$PWD/config/config_paths.pri)
39 changes: 18 additions & 21 deletions application/application.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@ TEMPLATE = app
TARGET = livecv
QT += qml quick

include($$getConfigFile(use_lcveditor.pri))
include($$getConfigFile(use_qmljsparser.pri))
include($$getConfigFile(use_plugin_live.pri))
linkLocalLibrary(../editor/lcveditor, lcveditor)
linkLocalLibrary(../editor/qmljsparser, qmljsparser)
linkLocalLibrary(../plugins/live, live)

DESTDIR = $$PATH_DEPLOY_APPLICATION
#DESTDIR = $$PATH_DEPLOY_APPLICATION

# Load library paths
# ------------------

unix{
QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN\''
}

QMAKE_LFLAGS += \
"-Wl,-rpath,\'\$$ORIGIN\'" \
"-Wl,-rpath,\'\$$ORIGIN/plugins\'" \
"-Wl,-rpath,\'\$$ORIGIN/plugins/live\'" \
"-Wl,-rpath,\'\$$ORIGIN/plugins/lcvcore\'"

##TODO: Revert
win32{
Release:DESTDIR = release/../release #fix for app current path
Release:OBJECTS_DIR = release/.obj
Release:MOC_DIR = release/.moc
Release:RCC_DIR = release/.rcc

Debug:DESTDIR = debug/../debug #fix for app current path
Debug:OBJECTS_DIR = debug/.obj
Debug:MOC_DIR = debug/.moc
Debug:RCC_DIR = debug/.rcc
}

# Application
Expand All @@ -32,16 +39,6 @@ RC_ICONS = $$PWD/icons/livecv.ico
RESOURCES += $$PWD/application.qrc

OTHER_FILES += \
qml/*

PLUGIN_DEPLOY_FROM = $$shell_path($$PATH_SOURCE_APPLICATION/qml)
PLUGIN_DEPLOY_TO = $$shell_path($$PATH_DEPLOY_APPLICATION)

plugincopy.commands = $$QMAKE_COPY_DIR $$PLUGIN_DEPLOY_FROM $$PLUGIN_DEPLOY_TO

first.depends = $(first) plugincopy
export(first.depends)
export(plugincopy.commands)
$$PWD/qml/*.qml

QMAKE_EXTRA_TARGETS += first plugincopy

4 changes: 1 addition & 3 deletions application/application.qrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<RCC>
<!--
<qresource prefix="/">
<qresource prefix="/">
<file alias="main.qml">qml/main.qml</file>
<file alias="Editor.qml">qml/Editor.qml</file>
<file alias="LogWindow.qml">qml/LogWindow.qml</file>
Expand All @@ -14,7 +13,6 @@
<file alias="ContextMenuStyle.qml">qml/ContextMenuStyle.qml</file>
<file alias="License.qml">qml/License.qml</file>
</qresource>
!-->
<qresource prefix="/fonts">
<file alias="UbuntuMono-Bold.ttf">fonts/UbuntuMono-Bold.ttf</file>
<file alias="UbuntuMono-Italic.ttf">fonts/UbuntuMono-Italic.ttf</file>
Expand Down
Empty file added application/icons/.gitignore
Empty file.
1 change: 1 addition & 0 deletions application/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
****************************************************************************/

import QtQuick 2.3
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
Expand Down
15 changes: 0 additions & 15 deletions application/qml/qmldir

This file was deleted.

15 changes: 0 additions & 15 deletions application/src/application.pri

This file was deleted.

32 changes: 2 additions & 30 deletions application/src/base/qlivecv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,46 +76,18 @@ QLiveCV::~QLiveCV(){
}

void QLiveCV::solveImportPaths(){

/*
* I am not completely sure about the purpose of caching all import paths,
* clearing the list and then restore all paths except the application root
* one.
*
QStringList importPaths = m_engine->engine()->importPathList();
m_engine->engine()->setImportPathList(QStringList());
for ( QStringList::iterator it = importPaths.begin(); it != importPaths.end(); ++it ){
if ( *it != dir() )
m_engine->engine()->addImportPath(*it);
}
*/

// FIXME: Magic strings are evil
QDir applicationDir {QGuiApplication::applicationDirPath()};
QDir applicationQmlDir {applicationDir.absoluteFilePath("qml")};
QDir pluginDir {applicationDir.absoluteFilePath("plugins")};
QDir livePluginDir {pluginDir.absoluteFilePath("live")};

Q_ASSERT(applicationDir.exists());
Q_ASSERT(applicationQmlDir.exists());
Q_ASSERT(pluginDir.exists());
Q_ASSERT(livePluginDir.exists());

m_engine->engine()->addImportPath(applicationQmlDir.absolutePath());
m_engine->engine()->addImportPath(pluginDir.absolutePath());


m_engine->engine()->addImportPath(dir() + "/plugins");
}

void QLiveCV::loadLibrary(const QString &library){

m_lcvlib.setFileName(library);
bool loadSuccessful = m_lcvlib.load();

if(!loadSuccessful){
qDebug() << "Loading " << library << "failed: " << m_lcvlib.errorString();
}

m_lcvlib.load();
}

void QLiveCV::loadQml(const QUrl &url){
Expand Down
4 changes: 1 addition & 3 deletions application/src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@ int main(int argc, char *argv[]){
return 0;
}

livecv.loadLibrary(livecv.dir() + "/plugins/live/live");

if ( livecv.arguments()->pluginInfoFlag() ){
printf("%s", livecv.extractPluginInfo(livecv.arguments()->pluginInfoImport()).data());
return 0;
}

livecv.loadQml(QUrl(QStringLiteral("qml/main.qml")));
livecv.loadQml(QUrl(QStringLiteral("qrc:/main.qml")));

return app.exec();
}
145 changes: 0 additions & 145 deletions application/src/scope/qproject.cpp

This file was deleted.

Loading

0 comments on commit 6d67d1e

Please sign in to comment.