aboutsummaryrefslogtreecommitdiffstats
path: root/examples/install-bundle
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2015-05-01 19:52:58 -0700
committerJake Petroules <jake.petroules@petroules.com>2015-05-04 09:17:38 +0000
commit805c6b95db2e6d1f754797a14fce6d5254b3e2f2 (patch)
tree59cb4142cb5cb7e0fe85b8b2d31b3ad1d10c343c /examples/install-bundle
parenta4f4a305ae49914b7a6a8d83b8ae79e1c98723f1 (diff)
Add an example demonstrating how to properly install bundle products.
Change-Id: Iee310389b2c64f5c2b1df1ad59f3260a2fa294f6 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'examples/install-bundle')
-rw-r--r--examples/install-bundle/coreutils.cpp4
-rw-r--r--examples/install-bundle/coreutils.h1
-rw-r--r--examples/install-bundle/install-bundle.qbs57
-rw-r--r--examples/install-bundle/main.cpp10
4 files changed, 72 insertions, 0 deletions
diff --git a/examples/install-bundle/coreutils.cpp b/examples/install-bundle/coreutils.cpp
new file mode 100644
index 000000000..9010bb0f6
--- /dev/null
+++ b/examples/install-bundle/coreutils.cpp
@@ -0,0 +1,4 @@
+int foo()
+{
+ return 42;
+}
diff --git a/examples/install-bundle/coreutils.h b/examples/install-bundle/coreutils.h
new file mode 100644
index 000000000..5d5f8f0c9
--- /dev/null
+++ b/examples/install-bundle/coreutils.h
@@ -0,0 +1 @@
+int foo();
diff --git a/examples/install-bundle/install-bundle.qbs b/examples/install-bundle/install-bundle.qbs
new file mode 100644
index 000000000..660b77a66
--- /dev/null
+++ b/examples/install-bundle/install-bundle.qbs
@@ -0,0 +1,57 @@
+import qbs
+import qbs.FileInfo
+
+Project {
+ CppApplication {
+ Depends { name: "coreutils" }
+ Depends { name: "Qt"; submodules: ["core", "gui", "widgets"] }
+
+ name: "window"
+ targetName: bundle.isBundle ? "Window" : "window"
+ files: ["main.cpp"]
+
+ property bool install: true
+ property string installDir: bundle.isBundle ? "Applications" : "bin"
+
+ Group {
+ fileTagsFilter: ["application"]
+ qbs.install: install
+ qbs.installDir: bundle.isBundle ? FileInfo.joinPaths(installDir, FileInfo.path(bundle.executablePath)) : installDir
+ }
+
+ Group {
+ fileTagsFilter: ["infoplist"]
+ qbs.install: install && bundle.isBundle && !bundle.embedInfoPlist
+ qbs.installDir: FileInfo.joinPaths(installDir, FileInfo.path(bundle.infoPlistPath))
+ }
+
+ Group {
+ fileTagsFilter: ["pkginfo"]
+ qbs.install: install && bundle.isBundle
+ qbs.installDir: FileInfo.joinPaths(installDir, FileInfo.path(bundle.pkgInfoPath))
+ }
+ }
+
+ DynamicLibrary {
+ Depends { name: "cpp" }
+
+ name: "coreutils"
+ targetName: bundle.isBundle ? "CoreUtils" : "coreutils"
+ files: ["coreutils.cpp"]
+
+ property bool install: true
+ property string installDir: bundle.isBundle ? "Library/Frameworks" : "lib"
+
+ Group {
+ fileTagsFilter: ["dynamiclibrary", "dynamiclibrary_symlink"]
+ qbs.install: install
+ qbs.installDir: bundle.isBundle ? FileInfo.joinPaths(installDir, FileInfo.path(bundle.executablePath)) : installDir
+ }
+
+ Group {
+ fileTagsFilter: ["infoplist"]
+ qbs.install: install && bundle.isBundle && !bundle.embedInfoPlist
+ qbs.installDir: FileInfo.joinPaths(installDir, FileInfo.path(bundle.infoPlistPath))
+ }
+ }
+}
diff --git a/examples/install-bundle/main.cpp b/examples/install-bundle/main.cpp
new file mode 100644
index 000000000..8f3288637
--- /dev/null
+++ b/examples/install-bundle/main.cpp
@@ -0,0 +1,10 @@
+#include <QApplication>
+#include <QWidget>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QWidget window;
+ window.show();
+ return app.exec();
+}