From 75a12f5e305adfa4fd7d3bb8abb13ec8460a4df8 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 14 Jun 2017 19:50:21 +0800 Subject: improve find_package on linux --- .../sandbox/modules/import/lib/detect/find_package.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_package.lua b/xmake/core/sandbox/modules/import/lib/detect/find_package.lua index 98c233392..0bc4bcd26 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_package.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_package.lua @@ -79,17 +79,22 @@ function sandbox_lib_detect_find_package._find_from_systemdirs(name, opt) -- add default search pathes on pc host local pathes = {} - if (opt.plat == "linux" or opt.plat == "macosx") then + if opt.plat == "linux" or opt.plat == "macosx" then table.insert(pathes, "/usr/local/lib") table.insert(pathes, "/usr/lib") table.insert(pathes, "/opt/local/lib") table.insert(pathes, "/opt/lib") + if opt.plat == "linux" and opt.arch == "x86_64" then + table.insert(pathes, "/usr/local/lib/x86_64-linux-gnu") + table.insert(pathes, "/usr/lib/x86_64-linux-gnu") + end end -- attempt to get links from pkg-config + local pkginfo = nil local links = opt.links if not links then - local pkginfo = pkg_config.info(name) + pkginfo = pkg_config.info(name) if pkginfo then links = pkginfo.links end @@ -106,6 +111,11 @@ function sandbox_lib_detect_find_package._find_from_systemdirs(name, opt) end end + -- not found? only add links + if not result and pkginfo and pkginfo.links then + result = {links = pkginfo.links} + end + -- ok return result end -- cgit v1.3.1