diff options
| author | ruki <[email protected]> | 2021-01-02 00:56:35 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-01-02 00:56:35 +0800 |
| commit | e61c1c15aacb34ebd1f5c11e271d2047febb9250 (patch) | |
| tree | 3ede2cadb194f22d944c75030f53e265ead648d8 | |
| parent | f56db4a0eaf275f10cfb967f5dd5508fc3c9e37e (diff) | |
fix register packages
| -rw-r--r-- | tests/projects/package/depconfigs/xmake.lua | 28 | ||||
| -rw-r--r-- | xmake/actions/require/install.lua | 4 |
2 files changed, 29 insertions, 3 deletions
diff --git a/tests/projects/package/depconfigs/xmake.lua b/tests/projects/package/depconfigs/xmake.lua index 3f949375d..d366f06ce 100644 --- a/tests/projects/package/depconfigs/xmake.lua +++ b/tests/projects/package/depconfigs/xmake.lua @@ -10,14 +10,40 @@ target("test") set_kind("binary") add_files("src/*.c") add_packages("libpng") + before_build(function (target) + local found + for _, linkdir in ipairs(target:pkg("libpng"):get("linkdirs")) do + if linkdir:find("zlib/1.2.10", 1, true) then + found = true + end + end + assert(found, "package(zlib 1.2.10) not found!") + end) target("test2") set_kind("binary") add_files("src/*.c") add_packages("libtiff") + before_build(function (target) + local found + for _, linkdir in ipairs(target:pkg("libtiff"):get("linkdirs")) do + if linkdir:find("zlib", 1, true) then + found = true + end + end + assert(found, "package(zlib) not found!") + end) target("test3") set_kind("binary") add_files("src/*.c") add_packages("libwebp") - + before_build(function (target) + local found + for _, linkdir in ipairs(target:pkg("libwebp"):get("linkdirs")) do + if linkdir:find("zlib", 1, true) then + found = true + end + end + assert(found, "package(zlib) not found!") + end) diff --git a/xmake/actions/require/install.lua b/xmake/actions/require/install.lua index cedc3e434..90366b1b6 100644 --- a/xmake/actions/require/install.lua +++ b/xmake/actions/require/install.lua @@ -115,9 +115,9 @@ function _register_required_packages(packages) local registered_in_group = {} for _, instance in ipairs(packages) do - -- only register the first package in same group + -- only register the first package in same group and root packages local group = instance:group() - if not group or not registered_in_group[group] then + if not instance:parents() and (not group or not registered_in_group[group]) then -- do not register binary package local requireinfo = project.require(instance:alias() or instance:name()) |
