diff options
| author | ruki <[email protected]> | 2021-09-16 23:54:41 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-16 23:54:41 +0800 |
| commit | 8e41cd06d4f77d7a3f8544be7d719ea399412d93 (patch) | |
| tree | ef6eb60e6d267eb81ab19673f6c46666f0aa656f | |
| parent | b0de078312f7c87f54c9229b913992a495a3b2ed (diff) | |
fix find_package again
8 files changed, 156 insertions, 114 deletions
diff --git a/tests/projects/package/toolchain_muslcc/xmake-requires.lock b/tests/projects/package/toolchain_muslcc/xmake-requires.lock index 4adae3fbb..9b6e40634 100644 --- a/tests/projects/package/toolchain_muslcc/xmake-requires.lock +++ b/tests/projects/package/toolchain_muslcc/xmake-requires.lock @@ -1,103 +1,145 @@ -{ - __meta__ = { - version = "1.0" - }, - ["macosx|x86_64"] = { - ["autoconf#31fecfc4"] = { - repo = { - branch = "master", - commit = "4498f11267de5112199152ab030ed139c985ad5a", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "2.71" - }, - ["automake#31fecfc4"] = { - repo = { - branch = "master", - commit = "eda7adee81bac151f87c507030cc0dd8ab299462", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "1.16.4" - }, - ["cmake#31fecfc4"] = { - repo = { - branch = "master", - commit = "4498f11267de5112199152ab030ed139c985ad5a", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "3.21.0" - }, - ["gmp#31fecfc4"] = { - repo = { - branch = "master", - commit = "c1b4838c9b1e7a2c52d9bf1a9beafeaee7305e30", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "6.2.1" - }, - ["libisl 0.22#67114504"] = { - repo = { - branch = "master", - commit = "eda7adee81bac151f87c507030cc0dd8ab299462", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "0.22" - }, - ["libogg#31fecfc4"] = { - repo = { - branch = "master", - commit = "eda7adee81bac151f87c507030cc0dd8ab299462", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "v1.3.4" - }, - ["libplist#31fecfc4"] = { - repo = { - branch = "master", - commit = "eda7adee81bac151f87c507030cc0dd8ab299462", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "2.2.0" - }, - ["libtool#31fecfc4"] = { - repo = { - branch = "master", - commit = "eda7adee81bac151f87c507030cc0dd8ab299462", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "2.4.6" - }, - ["m4#31fecfc4"] = { - repo = { - branch = "master", - commit = "c1b4838c9b1e7a2c52d9bf1a9beafeaee7305e30", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "1.4.19" - }, - ["muslcc#31fecfc4"] = { - repo = { - branch = "master", - commit = "eda7adee81bac151f87c507030cc0dd8ab299462", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "20210202" - }, - ["pkg-config#31fecfc4"] = { - repo = { - branch = "master", - commit = "c1b4838c9b1e7a2c52d9bf1a9beafeaee7305e30", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "0.29.2" - }, - ["zlib#31fecfc4"] = { - repo = { - branch = "master", - commit = "eda7adee81bac151f87c507030cc0dd8ab299462", - url = "https://gitee.com/tboox/xmake-repo.git" - }, - version = "1.2.11" - } - } +{
+ __meta__ = {
+ version = "1.0"
+ },
+ ["macosx|x86_64"] = {
+ ["autoconf#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "4498f11267de5112199152ab030ed139c985ad5a",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "2.71"
+ },
+ ["automake#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "eda7adee81bac151f87c507030cc0dd8ab299462",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "1.16.4"
+ },
+ ["cmake#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "4498f11267de5112199152ab030ed139c985ad5a",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "3.21.0"
+ },
+ ["gmp#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "c1b4838c9b1e7a2c52d9bf1a9beafeaee7305e30",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "6.2.1"
+ },
+ ["libisl 0.22#67114504"] = {
+ repo = {
+ branch = "master",
+ commit = "eda7adee81bac151f87c507030cc0dd8ab299462",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "0.22"
+ },
+ ["libogg#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "eda7adee81bac151f87c507030cc0dd8ab299462",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "v1.3.4"
+ },
+ ["libplist#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "eda7adee81bac151f87c507030cc0dd8ab299462",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "2.2.0"
+ },
+ ["libtool#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "eda7adee81bac151f87c507030cc0dd8ab299462",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "2.4.6"
+ },
+ ["m4#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "c1b4838c9b1e7a2c52d9bf1a9beafeaee7305e30",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "1.4.19"
+ },
+ ["muslcc#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "eda7adee81bac151f87c507030cc0dd8ab299462",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "20210202"
+ },
+ ["pkg-config#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "c1b4838c9b1e7a2c52d9bf1a9beafeaee7305e30",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "0.29.2"
+ },
+ ["zlib#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "eda7adee81bac151f87c507030cc0dd8ab299462",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "1.2.11"
+ }
+ },
+ ["windows|x64"] = {
+ ["cmake#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "8e8c5e4d1c7e8b047b23333594d23b4b85163aed",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "3.21.0"
+ },
+ ["libogg#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "2b1cb74b289ae3221241985db4401a495c42fde3",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "v1.3.4"
+ },
+ ["make#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "2b1cb74b289ae3221241985db4401a495c42fde3",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "4.3"
+ },
+ ["muslcc#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "2b1cb74b289ae3221241985db4401a495c42fde3",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "20210202"
+ },
+ ["zlib#31fecfc4"] = {
+ repo = {
+ branch = "master",
+ commit = "2b1cb74b289ae3221241985db4401a495c42fde3",
+ url = "https://gitee.com/tboox/xmake-repo.git"
+ },
+ version = "1.2.11"
+ }
+ }
}
\ No newline at end of file diff --git a/xmake/core/sandbox/modules/import/core/project/target.lua b/xmake/core/sandbox/modules/import/core/project/target.lua index 205d15d61..07424cad3 100644 --- a/xmake/core/sandbox/modules/import/core/project/target.lua +++ b/xmake/core/sandbox/modules/import/core/project/target.lua @@ -26,13 +26,13 @@ local target = require("project/target") local raise = require("sandbox/modules/raise") -- get the filename from the given name and kind -function sandbox_core_project_target.filename(name, kind) - return target.filename(name, kind) +function sandbox_core_project_target.filename(name, kind, opt) + return target.filename(name, kind, opt) end -- get the link name of the target file -function sandbox_core_project_target.linkname(filename) - return target.linkname(filename) +function sandbox_core_project_target.linkname(filename, opt) + return target.linkname(filename, opt) end -- return module diff --git a/xmake/modules/package/manager/apt/find_package.lua b/xmake/modules/package/manager/apt/find_package.lua index f27968c0e..3fee1034f 100644 --- a/xmake/modules/package/manager/apt/find_package.lua +++ b/xmake/modules/package/manager/apt/find_package.lua @@ -67,7 +67,7 @@ function main(name, opt) result.linkdirs = result.linkdirs or {} result.libfiles = result.libfiles or {} table.insert(result.linkdirs, path.directory(line)) - table.insert(result.links, target.linkname(path.filename(line))) + table.insert(result.links, target.linkname(path.filename(line), {plat = opt.plat})) table.insert(result.libfiles, path.join(path.directory(line), path.filename(line))) end end diff --git a/xmake/modules/package/manager/brew/find_package.lua b/xmake/modules/package/manager/brew/find_package.lua index 49db5a464..d5f679f7a 100644 --- a/xmake/modules/package/manager/brew/find_package.lua +++ b/xmake/modules/package/manager/brew/find_package.lua @@ -97,11 +97,11 @@ function main(name, opt) if pkgdir then local links = {} for _, libfile in ipairs(os.files(path.join(pkgdir, "lib", "*.a"))) do - table.insert(links, target.linkname(path.filename(libfile))) + table.insert(links, target.linkname(path.filename(libfile), {plat = opt.plat})) end for _, libfile in ipairs(os.files(path.join(pkgdir, "lib", opt.plat == "macosx" and "*.dylib" or "*.so"))) do if not os.islink(libfile) then - table.insert(links, target.linkname(path.filename(libfile))) + table.insert(links, target.linkname(path.filename(libfile), {plat = opt.plat})) end end opt.links = links diff --git a/xmake/modules/package/manager/conda/find_package.lua b/xmake/modules/package/manager/conda/find_package.lua index 5d2634d63..747e1bc9b 100644 --- a/xmake/modules/package/manager/conda/find_package.lua +++ b/xmake/modules/package/manager/conda/find_package.lua @@ -124,7 +124,7 @@ function main(name, opt) result.linkdirs = result.linkdirs or {} result.libfiles = result.libfiles or {} table.insert(result.linkdirs, path.join(packagedir, path.directory(line))) - table.insert(result.links, target.linkname(path.filename(line))) + table.insert(result.links, target.linkname(path.filename(line), {plat = opt.plat})) table.insert(result.libfiles, path.join(packagedir, path.directory(line), path.filename(line))) end diff --git a/xmake/modules/package/manager/dub/find_package.lua b/xmake/modules/package/manager/dub/find_package.lua index 55ad2d6ef..8543a8bfb 100644 --- a/xmake/modules/package/manager/dub/find_package.lua +++ b/xmake/modules/package/manager/dub/find_package.lua @@ -67,7 +67,7 @@ function main(name, opt) if pkgdir then local links = {} for _, libraryfile in ipairs(os.files(path.join(pkgdir, libpattern))) do - table.insert(links, target.linkname(path.filename(libraryfile))) + table.insert(links, target.linkname(path.filename(libraryfile), {plat = opt.plat})) end local includedirs = {} local dubjson = path.join(pkgdir, "dub.json") diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua index 56ac15d23..8bb4de8e8 100644 --- a/xmake/modules/package/manager/vcpkg/find_package.lua +++ b/xmake/modules/package/manager/vcpkg/find_package.lua @@ -116,7 +116,7 @@ function main(name, opt) result.linkdirs = result.linkdirs or {} result.libfiles = result.libfiles or {} table.insert(result.linkdirs, path.join(installdir, path.directory(line))) - table.insert(result.links, target.linkname(path.filename(line))) + table.insert(result.links, target.linkname(path.filename(line), {plat = plat})) table.insert(result.libfiles, path.join(installdir, path.directory(line), path.filename(line))) end end diff --git a/xmake/modules/package/manager/xmake/find_package.lua b/xmake/modules/package/manager/xmake/find_package.lua index 379e29cbe..c594c8135 100644 --- a/xmake/modules/package/manager/xmake/find_package.lua +++ b/xmake/modules/package/manager/xmake/find_package.lua @@ -82,14 +82,14 @@ function _find_package_from_repo(name, opt) for _, file in ipairs(os.files(path.join(installdir, libdir, "*"))) do if file:endswith(".lib") or file:endswith(".a") then found = true - table.insert(links, target.linkname(path.filename(file))) + table.insert(links, target.linkname(path.filename(file), {plat = opt.plat})) table.insert(libfiles, file) end end if not found then for _, file in ipairs(os.files(path.join(installdir, "lib", "*"))) do if file:endswith(".so") or file:match(".+%.so%..+$") or file:endswith(".dylib") then -- maybe symlink to libxxx.so.1 - table.insert(links, target.linkname(path.filename(file))) + table.insert(links, target.linkname(path.filename(file), {plat = opt.plat})) table.insert(libfiles, file) end end |
