summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/cmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-12-02 00:54:31 +0800
committerruki <[email protected]>2020-12-02 00:54:31 +0800
commitb0384dc3b81f05d4028f9e06dbb6caaa46f42013 (patch)
tree4cbf771e45362e726dabcd2bf9bdb326081a9d76 /xmake/modules/package/tools/cmake.lua
parent7d1894ff02004c542f44794af00d537bd756c07a (diff)
add tools/gn and ninja
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
-rw-r--r--xmake/modules/package/tools/cmake.lua21
1 files changed, 3 insertions, 18 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 6787f6ac4..9878a57c8 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -26,6 +26,7 @@ import("core.tool.linker")
import("core.tool.compiler")
import("lib.detect.find_file")
import("lib.detect.find_tool")
+import("package.tools.ninja")
-- translate windows bin path
function _translate_windows_bin_path(bin_path)
@@ -432,15 +433,7 @@ end
-- do build for ninja
function _build_for_ninja(package, configs, opt)
opt = opt or {}
- local njob = tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
- local ninja = assert(find_tool("ninja"), "ninja not found!")
- local argv = {"-C", os.curdir()}
- if option.get("verbose") then
- table.insert(argv, "-v")
- end
- table.insert(argv, "-j")
- table.insert(argv, njob)
- os.vrunv(ninja.program, argv, {envs = opt.envs or buildenvs(package, opt)})
+ ninja.build(package, {}, {envs = opt.envs or buildenvs(package, opt)})
end
-- do build for cmake/build
@@ -512,15 +505,7 @@ end
-- do install for ninja
function _install_for_ninja(package, configs, opt)
opt = opt or {}
- local njob = tostring(math.ceil(os.cpuinfo().ncpu * 3 / 2))
- local ninja = assert(find_tool("ninja"), "ninja not found!")
- local argv = {"install", "-C", os.curdir()}
- if option.get("verbose") then
- table.insert(argv, "-v")
- end
- table.insert(argv, "-j")
- table.insert(argv, njob)
- os.vrunv(ninja.program, argv, {envs = opt.envs or buildenvs(package, opt)})
+ ninja.install(package, {}, {envs = opt.envs or buildenvs(package, opt)})
_install_files_for_cmake(package, opt)
end