diff options
| author | ruki <[email protected]> | 2022-03-02 12:16:22 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-02 12:16:22 +0800 |
| commit | 12ae1475549eb6979f9e07b6d95a996beb5c931d (patch) | |
| tree | f85ab9f89554c4c543b2a8cba723282092c8188c | |
| parent | fa099d4f9c233a3400bf31e3ace4e33b8af1f526 (diff) | |
| parent | c007b1042c087f1f076ab1050911f423382e5746 (diff) | |
Merge pull request #2117 from xmake-io/toolchain
support toolchains for other platforms
| -rw-r--r-- | xmake/modules/package/tools/autoconf.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 3 | ||||
| -rw-r--r-- | xmake/modules/private/action/require/impl/package.lua | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index 5b33d64b0..9cd684551 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -156,7 +156,7 @@ function buildenvs(package, opt) opt = opt or {} local envs = {} local cppflags = {} - if package:is_plat(os.subhost()) then + if package:is_plat(os.subhost()) and not package:config("toolchains") then local cflags = table.join(table.wrap(package:config("cxflags")), package:config("cflags")) local cxxflags = table.join(table.wrap(package:config("cxflags")), package:config("cxxflags")) local asflags = table.copy(table.wrap(package:config("asflags"))) @@ -258,7 +258,7 @@ function buildenvs(package, opt) envs.CPP = _translate_windows_bin_path(envs.CPP) envs.RANLIB = _translate_windows_bin_path(envs.RANLIB) end - elseif package:is_plat("cross") then + elseif package:is_plat("cross") or package:has_tool("ar", "ar") then -- only for cross-toolchain envs.CXX = package:build_getenv("cxx") if not envs.ARFLAGS or envs.ARFLAGS == "" then diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 102772314..5aebc74ef 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -503,7 +503,8 @@ function _get_configs(package, configs, opt) _get_configs_for_appleos(package, configs, opt) elseif package:is_plat("mingw") then _get_configs_for_mingw(package, configs, opt) - elseif not package:is_plat(os.subhost()) then + elseif not package:is_plat(os.subhost()) or + package:config("toolchains") then -- we need pass toolchains _get_configs_for_cross(package, configs, opt) else _get_configs_for_generic(package, configs, opt) diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 3534723d2..dbeb13d9a 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -460,7 +460,7 @@ function _init_requireinfo(requireinfo, package, opt) if opt.is_toplevel then requireinfo.is_toplevel = true if not package:is_headeronly() then - if package:is_cross() and package:is_library() then + if package:is_library() then requireinfo.configs.toolchains = requireinfo.configs.toolchains or project.get("target.toolchains") or get_config("toolchain") end requireinfo.configs.vs_runtime = requireinfo.configs.vs_runtime or project.get("target.runtimes") or get_config("vs_runtime") |
