summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-10-10 23:40:54 +0800
committerruki <[email protected]>2018-10-10 16:05:28 +0800
commit02ba003928edb4bc2aae98ba1156013d996284cb (patch)
tree54a746f2254bece2be23fa832d0b3e604394c532
parent65f9d3c587300983795c6d744ac847779473fd3b (diff)
fix cmake for x86 on windows
-rw-r--r--xmake/actions/build/trybuild.lua6
-rw-r--r--xmake/modules/package/tools/cmake.lua6
2 files changed, 10 insertions, 2 deletions
diff --git a/xmake/actions/build/trybuild.lua b/xmake/actions/build/trybuild.lua
index 526428496..898aae7c5 100644
--- a/xmake/actions/build/trybuild.lua
+++ b/xmake/actions/build/trybuild.lua
@@ -46,7 +46,11 @@ end
function _build_for_cmakelists(buildfile)
os.mkdir("build")
os.cd("build")
- os.vrun("cmake -A %s -DCMAKE_INSTALL_PREFIX=\"%s\" ..", os.arch(), path.absolute("install"))
+ if is_host("windows") and os.arch() == "x64" then
+ os.vrun("cmake -A x64 -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install"))
+ else
+ os.vrun("cmake -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install"))
+ end
if is_host("windows") then
local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!")
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 0eeef1bfc..2334f449f 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -30,7 +30,11 @@ import("lib.detect.find_file")
function install(package, configs)
os.mkdir("build/install")
local oldir = os.cd("build")
- os.vrun("cmake -A $(arch) -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install"))
+ if is_plat("windows") and is_arch("x64") then
+ os.vrun("cmake -A x64 -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install"))
+ else
+ os.vrun("cmake -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install"))
+ 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")