-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install target packages #14
Changes from 3 commits
8974f94
10885fd
06462b7
6d3c618
12f72b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
import("core.project.config") | ||
import("core.project.project") | ||
import("core.tool.toolchain") | ||
import("target.action.install") | ||
import("target.action.uninstall") | ||
|
||
-- get targets | ||
function _get_targets(...) | ||
|
@@ -28,16 +30,10 @@ function _get_targets(...) | |
end | ||
|
||
-- install artifacts | ||
function _install_artifacts(libsdir, installdir, targets, arch) | ||
libsdir = path.join(libsdir, arch, "lib") | ||
installdir = path.join(installdir, arch) | ||
|
||
-- install targets | ||
if not os.isdir(installdir) then | ||
os.mkdir(installdir) | ||
end | ||
function _install_artifacts(installdir, targets, arch) | ||
assert(xmake.version():satisfies(">= 2.9.5"), "please update xmake to >= 2.9.5") | ||
for _, target in ipairs(targets) do | ||
os.vcp(path.join(libsdir, path.filename(target:targetfile())), installdir) | ||
install(target, {installdir = installdir, libdir = arch}) | ||
end | ||
end | ||
|
||
|
@@ -143,49 +139,55 @@ end | |
|
||
-- clean artifacts | ||
function _clean_artifacts(installdir, targets, arch) | ||
assert(xmake.version():satisfies(">= 2.9.5"), "please update xmake to >= 2.9.5") | ||
for _, target in ipairs(targets) do | ||
uninstall(target, {installdir = installdir, libdir = arch}) | ||
end | ||
|
||
-- append arch sub-directory | ||
installdir = path.join(installdir, arch) | ||
local installdir = path.join(installdir, arch) | ||
|
||
-- clean targets artifacts in the install directory | ||
for _, target in ipairs(targets) do | ||
os.tryrm(path.join(installdir, path.filename(target:targetfile()))) | ||
if os.emptydir(installdir) then | ||
os.tryrm(installdir) | ||
-- clean cxxstl | ||
local ndk_cxxstl = get_config("ndk_cxxstl") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ndk_cxxstl has been deprecated, please use runtimes. local ndk_cxxstl = get_config("runtimes") or get_config("ndk_cxxstl") |
||
if ndk_cxxstl then | ||
local cxxstl_filename | ||
if ndk_cxxstl == "c++_shared" then | ||
cxxstl_filename = "libc++_shared.so" | ||
elseif ndk_cxxstl == "gnustl_shared" then | ||
cxxstl_filename = "libgnustl_shared.so" | ||
elseif ndk_cxxstl == "stlport_shared" then | ||
cxxstl_filename = "libstlport_shared.so" | ||
end | ||
os.tryrm(installdir) | ||
end | ||
|
||
if os.emptydir(installdir) then | ||
os.rmdir(installdir) | ||
end | ||
end | ||
|
||
-- main entry | ||
function main(libsdir, installdir, archs, ...) | ||
function main(installdir, arch, clean, ...) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then |
||
|
||
-- check | ||
assert(libsdir and installdir and archs) | ||
assert(installdir and clean) | ||
|
||
-- load config | ||
config.load() | ||
|
||
-- get abi filters | ||
local abi_filters = {} | ||
for _, arch in ipairs(archs:split(',', {plain = true})) do | ||
abi_filters[arch] = true | ||
end | ||
|
||
-- do install or clean | ||
local targets = _get_targets(...) | ||
if targets and #targets > 0 then | ||
for _, arch in ipairs({"armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64"}) do | ||
if abi_filters[arch] then | ||
_install_artifacts(libsdir, installdir, targets, arch) | ||
|
||
if get_config("ndkver") >= 25 then | ||
_install_cxxstl_newer_ndk(installdir, arch) | ||
else | ||
_install_cxxstl(installdir, arch) | ||
end | ||
else | ||
_clean_artifacts(installdir, targets, arch) | ||
end | ||
assert(not targets or #targets == 0, "no targets provided, make sure to have at least one shared target in your xmake.lua or to provide one") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here it's always false. |
||
|
||
if clean == "false" then | ||
_install_artifacts(libsdir, installdir, targets, arch) | ||
|
||
if get_config("ndkver") >= 25 then | ||
_install_cxxstl_newer_ndk(installdir, arch) | ||
else | ||
_install_cxxstl(installdir, arch) | ||
end | ||
else | ||
_clean_artifacts(installdir, targets, arch) | ||
end | ||
|
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XMakeBuildTask -> XMakeInstallTask
it will break, did you test it?