diff options
| -rw-r--r-- | xmake/core/package/package.lua | 8 | ||||
| -rw-r--r-- | xmake/modules/package/tools/autoconf.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/package/tools/make.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/package/tools/meson.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/package/tools/scons.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/private/action/require/impl/package.lua | 7 |
7 files changed, 18 insertions, 11 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index fd1dce8ae..ed6042518 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -411,8 +411,12 @@ function _instance:plaindeps() end -- get library deps with correct link order -function _instance:librarydeps() - return self._LIBRARYDEPS +function _instance:librarydeps(opt) + if opt and opt.private then + return self._LIBRARYDEPS_WITH_PRIVATE + else + return self._LIBRARYDEPS + end end -- get parents diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index 1512173dd..faa842d54 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -362,7 +362,7 @@ function buildenvs(package, opt) end local ACLOCAL_PATH = {} local PKG_CONFIG_PATH = {} - for _, dep in ipairs(package:librarydeps()) do + for _, dep in ipairs(package:librarydeps({private = true})) do local pkgconfig = path.join(dep:installdir(), "lib", "pkgconfig") if os.isdir(pkgconfig) then table.insert(PKG_CONFIG_PATH, pkgconfig) @@ -390,7 +390,7 @@ function autogen_envs(package, opt) local envs = {NOCONFIGURE = "yes"} local ACLOCAL_PATH = {} local PKG_CONFIG_PATH = {} - for _, dep in ipairs(package:librarydeps()) do + for _, dep in ipairs(package:librarydeps({private = true})) do local pkgconfig = path.join(dep:installdir(), "lib", "pkgconfig") if os.isdir(pkgconfig) then table.insert(PKG_CONFIG_PATH, pkgconfig) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 2174508e2..c0076a83c 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -739,11 +739,13 @@ function buildenvs(package, opt) end -- add environments for cmake/find_packages + -- and we need also find them from private libraries, + -- @see https://github.com/xmake-io/xmake-repo/pull/2553 local CMAKE_LIBRARY_PATH = {} local CMAKE_INCLUDE_PATH = {} local CMAKE_PREFIX_PATH = {} local PKG_CONFIG_PATH = {} - for _, dep in ipairs(package:librarydeps()) do + for _, dep in ipairs(package:librarydeps({private = true})) do if dep:is_system() then local fetchinfo = dep:fetch() if fetchinfo then diff --git a/xmake/modules/package/tools/make.lua b/xmake/modules/package/tools/make.lua index 283f3d290..7b172ed3f 100644 --- a/xmake/modules/package/tools/make.lua +++ b/xmake/modules/package/tools/make.lua @@ -69,7 +69,7 @@ function buildenvs(package) end local ACLOCAL_PATH = {} local PKG_CONFIG_PATH = {} - for _, dep in ipairs(package:librarydeps()) do + for _, dep in ipairs(package:librarydeps({private = true})) do local pkgconfig = path.join(dep:installdir(), "lib", "pkgconfig") if os.isdir(pkgconfig) then table.insert(PKG_CONFIG_PATH, pkgconfig) diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua index 6527a2e2b..1a73328cb 100644 --- a/xmake/modules/package/tools/meson.lua +++ b/xmake/modules/package/tools/meson.lua @@ -396,7 +396,7 @@ function buildenvs(package, opt) end local ACLOCAL_PATH = {} local PKG_CONFIG_PATH = {} - for _, dep in ipairs(package:librarydeps()) do + for _, dep in ipairs(package:librarydeps({private = true})) do local pkgconfig = path.join(dep:installdir(), "lib", "pkgconfig") if os.isdir(pkgconfig) then table.insert(PKG_CONFIG_PATH, pkgconfig) diff --git a/xmake/modules/package/tools/scons.lua b/xmake/modules/package/tools/scons.lua index 1b59db92e..f9208042d 100644 --- a/xmake/modules/package/tools/scons.lua +++ b/xmake/modules/package/tools/scons.lua @@ -75,7 +75,7 @@ function buildenvs(package, opt) end local ACLOCAL_PATH = {} local PKG_CONFIG_PATH = {} - for _, dep in ipairs(package:librarydeps()) do + for _, dep in ipairs(package:librarydeps({private = true})) do local pkgconfig = path.join(dep:installdir(), "lib", "pkgconfig") if os.isdir(pkgconfig) then table.insert(PKG_CONFIG_PATH, pkgconfig) diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 77b4abbd0..ea7d8d621 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -296,13 +296,13 @@ end -- -- orderdeps: a -> b -> c -- -function _sort_librarydeps(package) +function _sort_librarydeps(package, opt) -- we must use native deps list instead of package:deps() to generate correct link order local orderdeps = {} for _, dep in ipairs(package:plaindeps()) do - if dep and dep:is_library() and not dep:is_private() then + if dep and dep:is_library() and (opt and opt.private or not dep:is_private()) then table.insert(orderdeps, dep) - table.join2(orderdeps, _sort_librarydeps(dep)) + table.join2(orderdeps, _sort_librarydeps(dep, opt)) end end return orderdeps @@ -936,6 +936,7 @@ function _load_packages(requires, opt) package._PLAINDEPS = plaindeps package._ORDERDEPS = table.unique(_sort_packagedeps(package)) package._LIBRARYDEPS = table.reverse_unique(_sort_librarydeps(package)) + package._LIBRARYDEPS_WITH_PRIVATE = table.reverse_unique(_sort_librarydeps(package, {private = true})) end end |
