From b6b4418db975e3c6003376b28f74d669cdf58ea4 Mon Sep 17 00:00:00 2001
From: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Date: Tue, 13 Aug 2013 12:21:25 +0200
Subject: [PATCH] Detach common.pri from the nano browser examples.

Move common.pri to the root directory to be able to use it with tests.
Remove nano browser specific logic (util.h include and common resources)
from this file and use relative paths in the examples instead.

This also remove unnecessary directives:
- lib doesn't have to be added to INCLUDEPATH since proper modules are used
- util.h doesn't need to be added to HEADERS, moc doesn't need to go through it
- MOC_DIR doesn't have to be adjusted anymore

Change-Id: Id706e7f2ef7c9607bdcd0ba63afecf5b5854262b
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
---
 common.pri                                        |  6 ++++++
 examples/common.pri                               | 15 ---------------
 .../quick/quicknanobrowser/quicknanobrowser.pro   |  5 +++--
 examples/quick/quicknanobrowser/quickwindow.cpp   |  2 +-
 .../widgetsnanobrowser/widgetsnanobrowser.pro     |  4 +++-
 .../widgets/widgetsnanobrowser/widgetwindow.cpp   |  2 +-
 6 files changed, 14 insertions(+), 20 deletions(-)
 create mode 100644 common.pri
 delete mode 100644 examples/common.pri

diff --git a/common.pri b/common.pri
new file mode 100644
index 000000000..844ef5edb
--- /dev/null
+++ b/common.pri
@@ -0,0 +1,6 @@
+macx:LIBPATH = $$getOutDir()/$$getConfigDir()
+else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib
+
+# Allows examples/tests to link to libQt5WebEngineCore which
+# isn't deployed properly yet.
+QMAKE_RPATHDIR += $$LIBPATH
diff --git a/examples/common.pri b/examples/common.pri
deleted file mode 100644
index dac92e865..000000000
--- a/examples/common.pri
+++ /dev/null
@@ -1,15 +0,0 @@
-INCLUDEPATH += $$absolute_path(../lib, $$PWD) \
-               $$absolute_path(common, $$PWD)
-
-macx:LIBPATH = $$getOutDir()/$$getConfigDir()
-else:LIBPATH = $$getOutDir()/$$getConfigDir()/lib
-
-HEADERS += common/util.h
-
-RESOURCES += $$absolute_path(common/common_resources.qrc)
-
-QMAKE_RPATHDIR += $$LIBPATH
-
-# Quick hack for now as we mess with that for the gyp generation step.
-MOC_DIR=$$PWD/.moc
-
diff --git a/examples/quick/quicknanobrowser/quicknanobrowser.pro b/examples/quick/quicknanobrowser/quicknanobrowser.pro
index da71b034c..c32540a71 100644
--- a/examples/quick/quicknanobrowser/quicknanobrowser.pro
+++ b/examples/quick/quicknanobrowser/quicknanobrowser.pro
@@ -1,14 +1,15 @@
 TEMPLATE = app
 TARGET = quicknanobrowser
 
-include(../../common.pri)
+include($$QTWEBENGINE_ROOT/common.pri)
 
 HEADERS = quickwindow.h
 SOURCES = quickwindow.cpp main.cpp
 
 OTHER_FILES += quickwindow.qml
-RESOURCES += resources.qrc
 
+RESOURCES += resources.qrc
+RESOURCES += ../../common/common_resources.qrc
 
 QT += qml quick
 qtHaveModule(widgets) {
diff --git a/examples/quick/quicknanobrowser/quickwindow.cpp b/examples/quick/quicknanobrowser/quickwindow.cpp
index 1f753c691..3b89aa205 100644
--- a/examples/quick/quicknanobrowser/quickwindow.cpp
+++ b/examples/quick/quicknanobrowser/quickwindow.cpp
@@ -41,7 +41,7 @@
 
 #include "quickwindow.h"
 
-#include "util.h"
+#include "../../common/util.h"
 
 #include <QFileInfo>
 #include <QObject>
diff --git a/examples/widgets/widgetsnanobrowser/widgetsnanobrowser.pro b/examples/widgets/widgetsnanobrowser/widgetsnanobrowser.pro
index 4a4cefd42..bd9e53a90 100644
--- a/examples/widgets/widgetsnanobrowser/widgetsnanobrowser.pro
+++ b/examples/widgets/widgetsnanobrowser/widgetsnanobrowser.pro
@@ -1,9 +1,11 @@
 TEMPLATE = app
 TARGET = widgetsnanobrowser
 
-include(../../common.pri)
+include($$QTWEBENGINE_ROOT/common.pri)
 
 HEADERS = widgetwindow.h
 SOURCES = widgetwindow.cpp main.cpp
 
+RESOURCES += ../../common/common_resources.qrc
+
 QT += webenginewidgets
diff --git a/examples/widgets/widgetsnanobrowser/widgetwindow.cpp b/examples/widgets/widgetsnanobrowser/widgetwindow.cpp
index a1ab56d0a..1b83e89dd 100644
--- a/examples/widgets/widgetsnanobrowser/widgetwindow.cpp
+++ b/examples/widgets/widgetsnanobrowser/widgetwindow.cpp
@@ -42,7 +42,7 @@
 #include "widgetwindow.h"
 
 #include "qwebcontentsview.h"
-#include "util.h"
+#include "../../common/util.h"
 
 #include <QShortcut>
 
-- 
GitLab