diff options
| author | ruki <[email protected]> | 2022-02-07 22:49:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-02-07 10:57:31 +0800 |
| commit | 35e9deaaa950521472ba54bf2fffb5f20e32011d (patch) | |
| tree | 880257c9c93ca27defbb299906462a7fe2ac70c0 | |
| parent | e5739724f0bade30cb6c4afafd772c0ddea152d2 (diff) | |
improve gn tools
| -rw-r--r-- | xmake/modules/package/tools/gn.lua | 19 | ||||
| -rw-r--r-- | xmake/modules/package/tools/ninja.lua | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/xmake/modules/package/tools/gn.lua b/xmake/modules/package/tools/gn.lua index 362373c2c..65a50a05d 100644 --- a/xmake/modules/package/tools/gn.lua +++ b/xmake/modules/package/tools/gn.lua @@ -36,6 +36,25 @@ end -- get configs function _get_configs(package, configs, opt) + configs = configs or {} + if not package:is_plat("windows") then + configs.cc = package:build_getenv("cc") + configs.cxx = package:build_getenv("cxx") + else + configs.extra_cflags = {(package:config("vs_runtime"):startswith("MT") and "/MT" or "/MD")} + end + if package:is_plat("macosx") then + configs.extra_ldflags = {"-lstdc++"} + local xcode = toolchain.load("xcode", {plat = package:plat(), arch = package:arch()}) + configs.xcode_sysroot = xcode:config("xcode_sysroot") + end + if package:is_arch("x86", "i386") then + configs.target_cpu = "x86" + elseif package:is_arch("x64", "x86_64") then + configs.target_cpu = "x64" + elseif package:is_arch("arm64", "arm64-v8a") then + configs.target_cpu = "arm64" + end return configs end diff --git a/xmake/modules/package/tools/ninja.lua b/xmake/modules/package/tools/ninja.lua index 0d3ad9708..30eb7ca64 100644 --- a/xmake/modules/package/tools/ninja.lua +++ b/xmake/modules/package/tools/ninja.lua @@ -31,7 +31,7 @@ function build(package, configs, opt) local argv = {} if opt.target then table.insert(argv, opt.target) - end + end table.insert(argv, "-C") table.insert(argv, buildir) if option.get("verbose") then |
