diff options
| author | ruki <[email protected]> | 2018-12-02 21:42:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-12-02 21:42:40 +0800 |
| commit | a0005982fa5e99c6c910ab7f5602f7b9809993c2 (patch) | |
| tree | 7157868111b3ceace52c066cb663c28bb48fc809 /xmake/modules/lib/detect/pkg_config.lua | |
| parent | 47b2b81350a97f8434403df141102bcf5b2bb148 (diff) | |
improve to switch debug mode for packages
Diffstat (limited to 'xmake/modules/lib/detect/pkg_config.lua')
| -rw-r--r-- | xmake/modules/lib/detect/pkg_config.lua | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/xmake/modules/lib/detect/pkg_config.lua b/xmake/modules/lib/detect/pkg_config.lua index 1f18e15ef..7766b0dcd 100644 --- a/xmake/modules/lib/detect/pkg_config.lua +++ b/xmake/modules/lib/detect/pkg_config.lua @@ -69,22 +69,27 @@ function info(name, opt) os.addenv("PKG_CONFIG_PATH", unpack(configdirs)) end + -- only find debug package? clear the other pkg-config pathes + if opt.mode == "debug" then + os.setenv("PKG_CONFIG_PATH", nil) + end + -- attempt to get pkg-config path from `brew --prefix` if no flags local brewprefix = nil if not flags then -- find the config directories from the prefix directories of xmake local platsubdirs = path.join(config.get("plat") or os.host(), config.get("arch") or os.arch()) - os.addenv("PKG_CONFIG_PATH", path.join(config.directory(), "prefix", platsubdirs, "release", "lib", "pkgconfig")) - os.addenv("PKG_CONFIG_PATH", path.join(config.directory(), "prefix", platsubdirs, "debug", "lib", "pkgconfig")) - os.addenv("PKG_CONFIG_PATH", path.join(global.directory(), "prefix", platsubdirs, "release", "lib", "pkgconfig")) - os.addenv("PKG_CONFIG_PATH", path.join(global.directory(), "prefix", platsubdirs, "debug", "lib", "pkgconfig")) + os.addenv("PKG_CONFIG_PATH", path.join(config.directory(), "prefix", platsubdirs, opt.mode or "release", "lib", "pkgconfig")) + os.addenv("PKG_CONFIG_PATH", path.join(global.directory(), "prefix", platsubdirs, opt.mode or "release", "lib", "pkgconfig")) -- find the prefix directory of brew directly, because `brew --prefix name` is too slow! - local pcfile = find_file(name .. ".pc", "/usr/local/Cellar/" .. (opt.brewhint or name) .. "/*/lib/pkgconfig") - if pcfile then - brewprefix = path.directory(path.directory(path.directory(pcfile))) - os.addenv("PKG_CONFIG_PATH", path.directory(pcfile)) + if opt.mode ~= "debug" then + local pcfile = find_file(name .. ".pc", "/usr/local/Cellar/" .. (opt.brewhint or name) .. "/*/lib/pkgconfig") + if pcfile then + brewprefix = path.directory(path.directory(path.directory(pcfile))) + os.addenv("PKG_CONFIG_PATH", path.directory(pcfile)) + end end end |
