From a8e3c0823bf452378184e126e7ef0f1867800d2a Mon Sep 17 00:00:00 2001 From: fy Date: Wed, 12 Dec 2018 17:17:16 +0800 Subject: `package.tools.cmake` works with `configs` --- xmake/modules/package/tools/cmake.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 2334f449f..efee315be 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -30,11 +30,21 @@ import("lib.detect.find_file") function install(package, configs) os.mkdir("build/install") local oldir = os.cd("build") + local argv = {} + + for name, value in pairs(configs) do + value = tostring(value):trim() + if value ~= "" then + table.insert(argv, value) + end + end + if is_plat("windows") and is_arch("x64") then - os.vrun("cmake -A x64 -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")) + os.vrunv(format("cmake -A x64 -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")), argv) else - os.vrun("cmake -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")) + os.vrunv(format("cmake -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")), argv) end + if is_host("windows") then local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!") os.vrun("msbuild \"%s\" -nologo -t:Rebuild -p:Configuration=%s -p:Platform=%s", slnfile, package:debug() and "Debug" or "Release", is_arch("x64") and "x64" or "Win32") -- cgit v1.3.1 From e1c447a8178ca22e315243a8b673b85b85742c8e Mon Sep 17 00:00:00 2001 From: fy Date: Wed, 12 Dec 2018 17:45:48 +0800 Subject: vrunv fix --- xmake/modules/package/tools/cmake.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index efee315be..d73e3c0e1 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -30,7 +30,14 @@ import("lib.detect.find_file") function install(package, configs) os.mkdir("build/install") local oldir = os.cd("build") - local argv = {} + + local argv = { + "-DCMAKE_INSTALL_PREFIX=\"" .. path.absolute("install") .. "\"" + } + + if is_plat("windows") and is_arch("x64") then + table.insert(argv, "-A x64") + end for name, value in pairs(configs) do value = tostring(value):trim() @@ -39,11 +46,7 @@ function install(package, configs) end end - if is_plat("windows") and is_arch("x64") then - os.vrunv(format("cmake -A x64 -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")), argv) - else - os.vrunv(format("cmake -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")), argv) - end + os.vrunv("cmake", argv) if is_host("windows") then local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!") -- cgit v1.3.1 From 4c59f260714576e2c23aa068b4a1beae62756fd3 Mon Sep 17 00:00:00 2001 From: fy Date: Wed, 12 Dec 2018 18:34:43 +0800 Subject: cmake "-A x64" fix --- xmake/modules/package/tools/cmake.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index d73e3c0e1..3cf548d0a 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -36,7 +36,8 @@ function install(package, configs) } if is_plat("windows") and is_arch("x64") then - table.insert(argv, "-A x64") + table.insert(argv, "-A") + table.insert(argv, "x64") end for name, value in pairs(configs) do @@ -46,6 +47,7 @@ function install(package, configs) end end + table.insert(argv, '..') os.vrunv("cmake", argv) if is_host("windows") then -- cgit v1.3.1