Skip to content

Commit

Permalink
Qbs: Added libDir option and use convenience install properties
Browse files Browse the repository at this point in the history
Since Qbs 1.13, Application and DynamicLibrary items have convenient
"install" and "installDir" properties.

Added products.Tiled.libDir option, which can be used to change the
directory libraries are installed to. This is useful for openSUSE packaging (and possibly Fedora), which like to put 64-bit libraries in a lib64 directory (see issue #3613).
  • Loading branch information
bjorn committed Mar 16, 2023
1 parent bca8635 commit 8a7d07b
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 91 deletions.
2 changes: 1 addition & 1 deletion dist/distribute.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Product {
return list;
}
qbs.install: true
qbs.installDir: qbs.targetOS.contains("windows") ? "" : "lib"
qbs.installDir: qbs.targetOS.contains("windows") ? "" : project.libDir
}

property var pluginFiles: {
Expand Down
21 changes: 10 additions & 11 deletions qbs/imports/TiledPlugin.qbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import qbs.FileInfo

DynamicLibrary {
Depends { name: "libtiled" }
Depends { name: "cpp" }
Expand Down Expand Up @@ -32,17 +34,14 @@ DynamicLibrary {
bundle.isBundle: false
}

Group {
qbs.install: true
qbs.installDir: {
if (project.windowsLayout)
return "plugins/tiled"
else if (qbs.targetOS.contains("macos"))
return "Tiled.app/Contents/PlugIns"
else
return "lib/tiled/plugins"
}
fileTagsFilter: "dynamiclibrary"
install: true
installDir: {
if (project.windowsLayout)
return "plugins/tiled"
else if (qbs.targetOS.contains("macos"))
return "Tiled.app/Contents/PlugIns"
else
return FileInfo.joinPaths(project.libDir, "tiled/plugins")
}

FileTagger {
Expand Down
28 changes: 10 additions & 18 deletions qbs/imports/TiledQtGuiApplication.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ QtGuiApplication {
if (qbs.targetOS.contains("darwin"))
return ["@loader_path/../Frameworks"];
else
return ["$ORIGIN/../lib"];
return ["$ORIGIN/../" + project.libDir];
}
cpp.cxxLanguageVersion: "c++17"
cpp.cxxFlags: {
Expand All @@ -24,23 +24,15 @@ QtGuiApplication {
"QT_NO_URL_CAST_FROM_STRING",
]

Group {
qbs.install: true
qbs.installDir: {
if (project.windowsLayout) {
return "";
} else if (qbs.targetOS.contains("darwin")) {
// Non-bundle applications are installed into the main Tiled.app bundle
return bundle.isBundle ? "." : "Tiled.app/Contents/MacOS";
} else {
return "bin";
}
}
qbs.installSourceBase: product.buildDirectory
fileTagsFilter: {
if (qbs.targetOS.contains("darwin") && bundle.isBundle)
return ["bundle.content"];
return product.type;
install: true
installDir: {
if (project.windowsLayout) {
return "";
} else if (qbs.targetOS.contains("darwin")) {
// Non-bundle applications are installed into the main Tiled.app bundle
return isBundle ? "." : "Tiled.app/Contents/MacOS";
} else {
return "bin";
}
}
}
2 changes: 1 addition & 1 deletion qbs/imports/TiledTest.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ CppApplication {
}
return flags;
}
cpp.rpaths: FileInfo.joinPaths(cpp.rpathOrigin, "../install-root/usr/local/lib/")
cpp.rpaths: FileInfo.joinPaths(cpp.rpathOrigin, "../install-root/usr/local", project.libDir)
autotest.workingDir: sourceDirectory
}
20 changes: 8 additions & 12 deletions src/libtiled/libtiled.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,14 @@ DynamicLibrary {
cpp.includePaths: "."
}

Group {
condition: !qbs.targetOS.contains("darwin")
qbs.install: true
qbs.installDir: {
if (qbs.targetOS.contains("windows"))
if (project.windowsLayout)
return ""
else
return "bin"
install: !qbs.targetOS.contains("darwin")
installDir: {
if (qbs.targetOS.contains("windows"))
if (project.windowsLayout)
return ""
else
return "lib"
}
fileTagsFilter: "dynamiclibrary"
return "bin"
else
return project.libDir
}
}
20 changes: 8 additions & 12 deletions src/libtiledquick/libtiledquick.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,14 @@ DynamicLibrary {
cpp.includePaths: "."
}

Group {
condition: !qbs.targetOS.contains("darwin")
qbs.install: true
qbs.installDir: {
if (qbs.targetOS.contains("windows"))
if (project.windowsLayout)
return ""
else
return "bin"
install: !qbs.targetOS.contains("darwin")
installDir: {
if (qbs.targetOS.contains("windows"))
if (project.windowsLayout)
return ""
else
return "lib"
}
fileTagsFilter: "dynamiclibrary"
return "bin"
else
return project.libDir
}
}
20 changes: 8 additions & 12 deletions src/tiled/libtilededitor.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -597,18 +597,14 @@ DynamicLibrary {
cpp.includePaths: "."
}

Group {
condition: !qbs.targetOS.contains("darwin")
qbs.install: true
qbs.installDir: {
if (qbs.targetOS.contains("windows"))
if (project.windowsLayout)
return ""
else
return "bin"
install: !qbs.targetOS.contains("darwin")
installDir: {
if (qbs.targetOS.contains("windows"))
if (project.windowsLayout)
return ""
else
return "lib"
}
fileTagsFilter: "dynamiclibrary"
return "bin"
else
return project.libDir
}
}
28 changes: 9 additions & 19 deletions src/tiledquick/tiledquick.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ QtGuiApplication {
}

cpp.includePaths: ["."]
cpp.rpaths: qbs.targetOS.contains("darwin") ? ["@loader_path/../Frameworks"] : ["$ORIGIN/../lib"]
cpp.rpaths: qbs.targetOS.contains("darwin") ? ["@loader_path/../Frameworks"] : ["$ORIGIN/../" + project.libDir]
cpp.cxxLanguageVersion: "c++17"
cpp.cxxFlags: {
var flags = base;
Expand All @@ -42,24 +42,14 @@ QtGuiApplication {
targetName: "Tiled Quick"
}

Group {
condition: !qbs.targetOS.contains("darwin")
qbs.install: true
qbs.installDir: {
if (project.windowsLayout)
return ""
else
return "bin"
}
fileTagsFilter: product.type
}

// This is necessary to install the app bundle (OS X)
Group {
fileTagsFilter: ["bundle.content"]
qbs.install: true
qbs.installDir: "."
qbs.installSourceBase: product.buildDirectory
install: true
installDir: {
if (project.windowsLayout)
return ""
else if (qbs.targetOS.contains("darwin"))
return "."
else
return "bin"
}

// Include libtiled.dylib in the app bundle
Expand Down
11 changes: 6 additions & 5 deletions src/tiledquickplugin/tiledquickplugin.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ DynamicLibrary {
"tiledquickplugin.h"
]

property string installBase: qbs.targetOS.contains("darwin") ? "Tiled Quick.app/Contents/" : ""
install: true
installDir: {
var installBase = qbs.targetOS.contains("darwin") ? "Tiled Quick.app/Contents/" : "";
return installBase + "qml/org/mapeditor/Tiled";
}

Group {
name: "qmldir"
files: "qmldir"
fileTags: "qmldir"
}

Group {
qbs.install: true
qbs.installDir: installBase + "qml/org/mapeditor/Tiled"
fileTagsFilter: ["dynamiclibrary", "qmldir"]
qbs.installDir: installDir
}
}
1 change: 1 addition & 0 deletions tiled.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Project {
property string version: Environment.getEnv("TILED_VERSION") || "1.10.0";
property bool snapshot: Environment.getEnv("TILED_SNAPSHOT") == "true"
property bool release: Environment.getEnv("TILED_RELEASE") == "true"
property string libDir: "lib"
property bool installHeaders: false
property bool useRPaths: true
property bool windowsInstaller: false
Expand Down

0 comments on commit 8a7d07b

Please sign in to comment.