aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXpol Wan <xpolife@gmail.com>2016-05-03 10:21:21 +0800
committerXpol Wan <xpolife@gmail.com>2016-05-03 10:21:21 +0800
commit58c492d6dafb4592c863a11565ab7ad53c9c7537 (patch)
tree6385ec3b829d12885fef8f59f3954d8cdb41bd3a
parent09da2f695b3e531e8bc88082e9f06f3875685cab (diff)
downloadluarocks-58c492d6dafb4592c863a11565ab7ad53c9c7537.tar.gz
luarocks-58c492d6dafb4592c863a11565ab7ad53c9c7537.tar.bz2
luarocks-58c492d6dafb4592c863a11565ab7ad53c9c7537.zip
Add cross compiling support for MSVC.
This is needed, when native compiler is not installed but cross compiler does.
-rw-r--r--install.bat27
1 files changed, 16 insertions, 11 deletions
diff --git a/install.bat b/install.bat
index 053fdfd6..8e89aafe 100644
--- a/install.bat
+++ b/install.bat
@@ -508,17 +508,22 @@ local function get_msvc_env_setup_cmd()
508 -- 1. try visual studio command line tools 508 -- 1. try visual studio command line tools
509 local vcdir = get_visual_studio_directory() 509 local vcdir = get_visual_studio_directory()
510 if vcdir then 510 if vcdir then
511 -- 1.1. try vcvarsall.bat 511 local vcvars_bats = {
512 local vcvarsall = vcdir .. 'vcvarsall.bat' 512 x86 = {
513 if exists(vcvarsall) then 513 "bin\\vcvars32.bat", -- prefers native compiler
514 return ('call "%s"%s'):format(vcvarsall, x64 and ' amd64' or '') 514 "bin\\amd64_x86\\vcvarsamd64_x86.bat"-- then cross compiler
515 end 515 },
516 516 x86_64 = {
517 -- 1.2. try vcvars32.bat / vcvars64.bat 517 "bin\\amd64\\vcvars64.bat", -- prefers native compiler
518 local relative_path = x64 and "bin\\amd64\\vcvars64.bat" or "bin\\vcvars32.bat" 518 "bin\\x86_amd64\\vcvarsx86_amd64.bat" -- then cross compiler
519 local full_path = vcdir .. relative_path 519 }
520 if exists(full_path) then 520 }
521 return ('call "%s"'):format(full_path) 521 assert(vcvars_bats[vars.UNAME_M], "vars.UNAME_M: only x86 and x86_64 are supported")
522 for _, bat in ipairs(vcvars_bats[vars.UNAME_M]) do
523 local full_path = vcdir .. bat
524 if exists(full_path) then
525 return ('call "%s"'):format(full_path)
526 end
522 end 527 end
523 end 528 end
524 529