Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/build/premake/premake5.lua
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | if cc == nil or cc == "" then | ||||
if gccpath == nil then | if gccpath == nil then | ||||
cc = "clang" | cc = "clang" | ||||
else | else | ||||
cc = "gcc" | cc = "gcc" | ||||
end | end | ||||
end | end | ||||
end | end | ||||
-- detect CPU architecture (simplistic, currently only supports x86, amd64 and ARM) | -- detect CPU architecture (simplistic) | ||||
arch = "x86" | arch = "x86" | ||||
macos_arch = "x86_64" | macos_arch = "x86_64" | ||||
if _OPTIONS["android"] then | if _OPTIONS["android"] then | ||||
arch = "arm" | arch = "arm" | ||||
elseif os.istarget("windows") then | elseif os.istarget("windows") then | ||||
if os.getenv("PROCESSOR_ARCHITECTURE") == "amd64" or os.getenv("PROCESSOR_ARCHITEW6432") == "amd64" then | if os.getenv("PROCESSOR_ARCHITECTURE") == "amd64" or os.getenv("PROCESSOR_ARCHITEW6432") == "amd64" then | ||||
arch = "amd64" | arch = "amd64" | ||||
end | end | ||||
else | else | ||||
arch = os.getenv("HOSTTYPE") | |||||
-- Force x86_64 on Mac OS for now, as Spidermonkey 78 isn't Apple Silicon compatible. | |||||
if os.istarget("macosx") then | |||||
arch = "amd64" | |||||
macos_arch = "x86_64" | |||||
elseif arch == "x86_64" or arch == "amd64" then | |||||
arch = "amd64" | |||||
else | |||||
os.execute(cc .. " -dumpmachine > .gccmachine.tmp") | os.execute(cc .. " -dumpmachine > .gccmachine.tmp") | ||||
local f = io.open(".gccmachine.tmp", "r") | local f = io.open(".gccmachine.tmp", "r") | ||||
local machine = f:read("*line") | local machine = f:read("*line") | ||||
f:close() | f:close() | ||||
if string.find(machine, "x86_64") == 1 or string.find(machine, "amd64") == 1 then | -- Special handling on mac os where xcode needs special flags. | ||||
if os.istarget("macosx") then | |||||
if string.find(machine, "arm64") then | |||||
arch = "aarch64" | |||||
macos_arch = "arm64" | |||||
else | |||||
arch = "amd64" | |||||
macos_arch = "x86_64" | |||||
end | |||||
elseif string.find(machine, "x86_64") == 1 or string.find(machine, "amd64") == 1 then | |||||
arch = "amd64" | arch = "amd64" | ||||
elseif string.find(machine, "i.86") == 1 then | elseif string.find(machine, "i.86") == 1 then | ||||
arch = "x86" | arch = "x86" | ||||
elseif string.find(machine, "arm") == 1 then | elseif string.find(machine, "arm") == 1 then | ||||
arch = "arm" | arch = "arm" | ||||
elseif string.find(machine, "aarch64") == 1 then | elseif string.find(machine, "aarch64") == 1 then | ||||
arch = "aarch64" | arch = "aarch64" | ||||
elseif string.find(machine, "e2k") == 1 then | elseif string.find(machine, "e2k") == 1 then | ||||
arch = "e2k" | arch = "e2k" | ||||
elseif string.find(machine, "ppc64") == 1 or string.find(machine, "powerpc64") == 1 then | elseif string.find(machine, "ppc64") == 1 or string.find(machine, "powerpc64") == 1 then | ||||
arch = "ppc64" | arch = "ppc64" | ||||
else | else | ||||
print("WARNING: Cannot determine architecture from GCC, assuming x86") | print("WARNING: Cannot determine architecture from GCC, assuming x86") | ||||
end | end | ||||
end | end | ||||
end | |||||
-- Test whether we need to link libexecinfo. | -- Test whether we need to link libexecinfo. | ||||
-- This is mostly the case on musl systems, as well as on BSD systems : only glibc provides the | -- This is mostly the case on musl systems, as well as on BSD systems : only glibc provides the | ||||
-- backtrace symbols we require in the libc, for other libcs we use the libexecinfo library. | -- backtrace symbols we require in the libc, for other libcs we use the libexecinfo library. | ||||
local link_execinfo = false | local link_execinfo = false | ||||
if os.istarget("bsd") then | if os.istarget("bsd") then | ||||
link_execinfo = true | link_execinfo = true | ||||
elseif os.istarget("linux") then | elseif os.istarget("linux") then | ||||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | else | ||||
end | end | ||||
end | end | ||||
if _OPTIONS["coverage"] then | if _OPTIONS["coverage"] then | ||||
buildoptions { "-fprofile-arcs", "-ftest-coverage" } | buildoptions { "-fprofile-arcs", "-ftest-coverage" } | ||||
links { "gcov" } | links { "gcov" } | ||||
end | end | ||||
-- MacOS 10.12 only supports processors with SSE 4.1, so enable that. | -- MacOS 10.12 only supports intel processors with SSE 4.1, so enable that. | ||||
if os.istarget("macosx") then | if os.istarget("macosx") and arch == "amd64" then | ||||
buildoptions { "-msse4.1" } | buildoptions { "-msse4.1" } | ||||
end | end | ||||
-- Check if SDK path should be used | -- Check if SDK path should be used | ||||
if _OPTIONS["sysroot"] then | if _OPTIONS["sysroot"] then | ||||
buildoptions { "-isysroot " .. _OPTIONS["sysroot"] } | buildoptions { "-isysroot " .. _OPTIONS["sysroot"] } | ||||
linkoptions { "-Wl,-syslibroot," .. _OPTIONS["sysroot"] } | linkoptions { "-Wl,-syslibroot," .. _OPTIONS["sysroot"] } | ||||
end | end | ||||
▲ Show 20 Lines • Show All 1,197 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator