diff options
| author | ruki <[email protected]> | 2022-09-12 22:48:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-09-12 22:48:06 +0800 |
| commit | 208ff8a0f5cab29ebfa49d390ab95ce693bec134 (patch) | |
| tree | 1cfcc57d94932f9097702429fc0392df630fee36 /xmake/modules/package/tools/autoconf.lua | |
| parent | 104e96b9e2ea5c06208b0c993a7f5c0c943c5d23 (diff) | |
support cross-compilation for macos
Diffstat (limited to 'xmake/modules/package/tools/autoconf.lua')
| -rw-r--r-- | xmake/modules/package/tools/autoconf.lua | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index 77797e93a..216b05f1b 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -60,6 +60,17 @@ function _map_linkflags(package, targetkind, sourcekinds, name, values) return linker.map_flags(targetkind, sourcekinds, name, values, {target = package}) end +-- is cross compilation? +function _is_cross_compilation(package) + if not package:is_plat(os.subhost()) then + return true + end + if package:is_plat("macosx") and not package:is_arch(os.subarch()) then + return true + end + return false +end + -- get configs function _get_configs(package, configs) @@ -68,8 +79,8 @@ function _get_configs(package, configs) table.insert(configs, "--prefix=" .. _translate_paths(package, package:installdir())) -- add host for cross-complation - if not configs.host and not package:is_plat(os.subhost()) then - if package:is_plat("iphoneos") then + if not configs.host and _is_cross_compilation(package) then + if package:is_plat("iphoneos", "macosx") then local triples = { arm64 = "aarch64-apple-darwin", @@ -157,7 +168,7 @@ function buildenvs(package, opt) local envs = {} local cross = false local cflags, cxxflags, cppflags, asflags, ldflags, shflags, arflags - if package:is_plat(os.subhost()) and not package:config("toolchains") then + if not _is_cross_compilation(package) and not package:config("toolchains") then cppflags = {} cflags = table.join(table.wrap(package:config("cxflags")), package:config("cflags")) cxxflags = table.join(table.wrap(package:config("cxflags")), package:config("cxxflags")) |
