Skip to content

Commit

Permalink
Qbs: Use pkg-config to depend on zlib
Browse files Browse the repository at this point in the history
This way we should support building Tiled with zlib in some strange
location, like on NixOS.

To support this on the latest version of Qbs, we need to set
Project.qbsModuleProviders since it no longer falls back on pkg-config
by default. Since this property was introduced in Qbs 1.21, this becomes
the minimum Qbs version.
  • Loading branch information
bjorn committed Jul 8, 2024
1 parent ee52b20 commit 02d6749
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/libtiled/libtiled.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ DynamicLibrary {

Depends { name: "cpp" }
Depends { name: "Qt"; submodules: "gui"; versionAtLeast: "5.12" }
Depends {
condition: !qbs.toolchain.contains("msvc")
name: "zlib"
}

Probes.PkgConfigProbe {
id: pkgConfigZstd
Expand Down Expand Up @@ -46,9 +50,6 @@ DynamicLibrary {
cpp.dynamicLibraries: {
var libs = base;

if (!qbs.toolchain.contains("msvc"))
libs.push("z");

if (pkgConfigZstd.found && !project.staticZstd)
libs = libs.concat(pkgConfigZstd.libraries);

Expand Down
6 changes: 4 additions & 2 deletions tiled.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import qbs.Environment
Project {
name: "Tiled"

qbsSearchPaths: "qbs"
minimumQbsVersion: "1.13"
minimumQbsVersion: "1.21"

qbsModuleProviders: ["Qt", "qbspkgconfig"]
qbsSearchPaths: ["qbs"]

property string version: Environment.getEnv("TILED_VERSION") || "1.11.0";
property bool snapshot: Environment.getEnv("TILED_SNAPSHOT") == "true"
Expand Down

0 comments on commit 02d6749

Please sign in to comment.