Skip to content

Commit

Permalink
Added Windows layout management option
Browse files Browse the repository at this point in the history
The new `windowsLayout` project option is enabled by default on Windows.
If this opotion is disabled manually, installed files will follow
the Unix-like FHS (Filesystem Hierarchy Standard).
  • Loading branch information
podsvirov committed Feb 3, 2023
1 parent f0b998a commit ed6c3de
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion qbs/imports/TiledPlugin.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ DynamicLibrary {
Group {
qbs.install: true
qbs.installDir: {
if (qbs.targetOS.contains("windows"))
if (project.windowsLayout)
return "plugins/tiled"
else if (qbs.targetOS.contains("macos"))
return "Tiled.app/Contents/PlugIns"
Expand Down
2 changes: 1 addition & 1 deletion qbs/imports/TiledQtGuiApplication.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ QtGuiApplication {
Group {
qbs.install: true
qbs.installDir: {
if (qbs.targetOS.contains("windows")) {
if (project.windowsLayout) {
return "";
} else if (qbs.targetOS.contains("darwin")) {
// Non-bundle applications are installed into the main Tiled.app bundle
Expand Down
8 changes: 7 additions & 1 deletion src/libtiled/libtiled.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ DynamicLibrary {
if (project.staticZstd || pkgConfigZstd.found)
defs.push("TILED_ZSTD_SUPPORT");

if (project.windowsLayout)
defs.push("TILED_WINDOWS_LAYOUT");

return defs;
}
cpp.dynamicLibraries: {
Expand Down Expand Up @@ -201,7 +204,10 @@ DynamicLibrary {
qbs.install: true
qbs.installDir: {
if (qbs.targetOS.contains("windows"))
return ""
if (project.windowsLayout)
return ""
else
return "bin"
else
return "lib"
}
Expand Down
2 changes: 1 addition & 1 deletion src/libtiled/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void PluginManager::loadPlugins()
QString pluginPath = QCoreApplication::applicationDirPath();
#endif

#if defined(Q_OS_WIN32)
#if defined(TILED_WINDOWS_LAYOUT)
pluginPath += QStringLiteral("/plugins/tiled");
#elif defined(Q_OS_MAC)
pluginPath += QStringLiteral("/../PlugIns");
Expand Down
5 changes: 4 additions & 1 deletion src/libtiledquick/libtiledquick.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ DynamicLibrary {
qbs.install: true
qbs.installDir: {
if (qbs.targetOS.contains("windows"))
return ""
if (project.windowsLayout)
return ""
else
return "bin"
else
return "lib"
}
Expand Down
2 changes: 1 addition & 1 deletion src/tiled/languagemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ LanguageManager::LanguageManager()
, mAppTranslator(nullptr)
{
mTranslationsDir = QCoreApplication::applicationDirPath();
#if defined(Q_OS_WIN32)
#if defined(TILED_WINDOWS_LAYOUT)
mTranslationsDir += QStringLiteral("/translations");
#elif defined(Q_OS_MAC)
mTranslationsDir += QStringLiteral("/../Translations");
Expand Down
8 changes: 7 additions & 1 deletion src/tiled/libtilededitor.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ DynamicLibrary {
if (project.snapshot)
defs.push("TILED_SNAPSHOT");

if (project.windowsLayout)
defs.push("TILED_WINDOWS_LAYOUT");

if (qbs.targetOS.contains("linux") && project.dbus && Qt.dbus.present)
defs.push("TILED_ENABLE_DBUS");

Expand Down Expand Up @@ -598,7 +601,10 @@ DynamicLibrary {
qbs.install: true
qbs.installDir: {
if (qbs.targetOS.contains("windows"))
return ""
if (project.windowsLayout)
return ""
else
return "bin"
else
return "lib"
}
Expand Down
2 changes: 1 addition & 1 deletion src/tiledquick/tiledquick.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ QtGuiApplication {
condition: !qbs.targetOS.contains("darwin")
qbs.install: true
qbs.installDir: {
if (qbs.targetOS.contains("windows"))
if (project.windowsLayout)
return ""
else
return "bin"
Expand Down
1 change: 1 addition & 0 deletions tiled.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Project {
property bool installHeaders: false
property bool useRPaths: true
property bool windowsInstaller: false
property bool windowsLayout: qbs.targetOS.contains("windows")
property bool staticZstd: false
property bool sentry: false
property bool dbus: true
Expand Down
2 changes: 1 addition & 1 deletion translations/translations.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Product {
fileTagsFilter: product.type
qbs.install: true
qbs.installDir: {
if (qbs.targetOS.contains("windows"))
if (project.windowsLayout)
return "translations"
else if (qbs.targetOS.contains("macos"))
return "Tiled.app/Contents/Translations"
Expand Down

0 comments on commit ed6c3de

Please sign in to comment.