diff options
| author | ruki <[email protected]> | 2020-11-11 23:38:35 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-11-11 23:38:35 +0800 |
| commit | 1c0b961dc0c2fd50be0c5d2676d362a5d38b0cf2 (patch) | |
| tree | b4deb1020e1665c9ebf1328f4ce30d3abb56a883 | |
| parent | b492db92027dfdbb073f430d04e929ab826116fb (diff) | |
improve xrepo/fetch
| -rw-r--r-- | xmake/actions/require/fetch.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/require/xmake.lua | 1 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 7 | ||||
| -rw-r--r-- | xmake/modules/private/xrepo/action/fetch.lua | 4 |
4 files changed, 12 insertions, 2 deletions
diff --git a/xmake/actions/require/fetch.lua b/xmake/actions/require/fetch.lua index 657d53fa7..d76228f0b 100644 --- a/xmake/actions/require/fetch.lua +++ b/xmake/actions/require/fetch.lua @@ -49,7 +49,7 @@ function main(requires_raw) local fetchinfos = {} local nodeps = not (fetchmodes and fetchmodes:has("deps")) for _, instance in irpairs(package.load_packages(requires, {requires_extra = requires_extra, nodeps = nodeps})) do - local fetchinfo = instance:fetch() + local fetchinfo = instance:fetch({external = (fetchmodes and fetchmodes:has("external") or false)}) if fetchinfo then table.insert(fetchinfos, fetchinfo) end diff --git a/xmake/actions/require/xmake.lua b/xmake/actions/require/xmake.lua index f8ac94595..a774d8414 100644 --- a/xmake/actions/require/xmake.lua +++ b/xmake/actions/require/xmake.lua @@ -63,6 +63,7 @@ task("require") " $ xmake require --fetch tbox" } , {nil, "fetch_modes","kv", nil, "Set the modes of fetching packages.", "e.g.", + " $ xmake require --fetch --fetch_modes=cflags,external tbox", " $ xmake require --fetch --fetch_modes=deps,cflags,ldflags tbox" } , {'s', "search", "k", nil, "Search for the given packages from repositories.", "e.g.", diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 232bfc23c..2efbf797c 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -870,7 +870,12 @@ function _instance:fetch(opt) end -- use sysincludedirs/-isystem instead of -I? - local external = self:requireinfo().external + local external + if opt.external ~= nil then + external = opt.external + else + external = self:requireinfo().external + end if external == nil then external = true end diff --git a/xmake/modules/private/xrepo/action/fetch.lua b/xmake/modules/private/xrepo/action/fetch.lua index 028e3db3d..b4c0b4f61 100644 --- a/xmake/modules/private/xrepo/action/fetch.lua +++ b/xmake/modules/private/xrepo/action/fetch.lua @@ -44,6 +44,7 @@ function menu_options() {nil, "deps", "k", nil, "Fetch packages with dependencies." }, {nil, "cflags", "k", nil, "Fetch cflags of the given packages." }, {nil, "ldflags", "k", nil, "Fetch ldflags of the given packages."}, + {'e', "external", "k", nil, "Show cflags as external packages with -isystem."}, {}, {nil, "packages", "vs", nil, "The packages list.", "e.g.", @@ -135,6 +136,9 @@ function _fetch_packages(packages) if option.get("ldflags") then table.insert(fetchmodes, "ldflags") end + if option.get("external") then + table.insert(fetchmodes, "external") + end if #fetchmodes > 0 then table.insert(require_argv, "--fetch_modes=" .. table.concat(fetchmodes, ',')) end |
