Browse Source

[build] Rework how the target architecture is looked up at build time.

We now check the system Mono architecture in non-Windows platforms, this is needed since Mono 5 defaults to amd64.
pull/829/head
Joao Matos 8 years ago
parent
commit
b466b17c02
  1. 22
      build/Helpers.lua
  2. 2
      build/Tests.lua
  3. 4
      build/scripts/LLVM.lua

22
build/Helpers.lua

@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
newoption {
trigger = "arch",
default = "x86",
description = "Choose a particular architecture / bitness",
allowed = {
{ "x86", "x86 32-bits" },
@ -10,6 +9,27 @@ newoption { @@ -10,6 +9,27 @@ newoption {
}
}
explicit_target_architecture = _OPTIONS["arch"]
function is_64_bits_mono_runtime()
result, errorcode = os.outputof("mono --version")
local arch = string.match(result, "Architecture:%s*([%w]+)")
return arch == "amd64"
end
function target_architecture()
-- Default to 32-bit on Windows and Mono architecture otherwise.
if explicit_target_architecture ~= nil then
return explicit_target_architecture
end
if os.is("windows") then return "x86" end
return is_64_bits_mono_runtime() and "x64" or "x86"
end
if not _OPTIONS["arch"] then
_OPTIONS["arch"] = target_architecture()
end
action = _ACTION or ""
basedir = path.getdirectory(_PREMAKE_COMMAND)

2
build/Tests.lua

@ -73,7 +73,7 @@ function SetupTestGeneratorProject(name, depends) @@ -73,7 +73,7 @@ function SetupTestGeneratorProject(name, depends)
end
function SetupTestGeneratorBuildEvent(name)
local monoExe = _OPTIONS["arch"] == "x64" and "mono64" or "mono"
local monoExe = target_architecture() == "x64" and "mono64" or "mono"
local runtimeExe = os.is("windows") and "" or monoExe .. " --debug "
if string.starts(action, "vs") then
local exePath = SafePath("$(TargetDir)" .. name .. ".Gen.exe")

4
build/scripts/LLVM.lua

@ -64,7 +64,7 @@ end @@ -64,7 +64,7 @@ end
function get_toolset_configuration_name(arch)
if not arch then
arch = _OPTIONS["arch"]
arch = target_architecture()
end
if os.is("windows") then
@ -276,7 +276,7 @@ function build_llvm(llvm_build) @@ -276,7 +276,7 @@ function build_llvm(llvm_build)
else
local options = os.is("macosx") and
"-DLLVM_ENABLE_LIBCXX=true" or ""
local is32bits = _OPTIONS["arch"] == "x86"
local is32bits = target_architecture() == "x86"
if is32bits then
options = options .. is32bits and " -DLLVM_BUILD_32_BITS=true" or ""
end

Loading…
Cancel
Save