mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:04:06 +00:00
Improve CC detection using premake
Before premake 5.0.0-beta3 if --cc wasn't specified the gnu make default was used unless overridden via env. Now premake always chooses a compiler sidestepping gnu make choice. So use the premake pick unless explicitly overridden via CC in env or via option to premake. Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
@@ -42,25 +42,15 @@ newoption { category = "Pyrogenesis", trigger = "libdir", description = "Directo
|
||||
-- Root directory of project checkout relative to this .lua file
|
||||
rootdir = "../.."
|
||||
|
||||
-- detect compiler for non-Windows
|
||||
if os.istarget("macosx") then
|
||||
cc = "clang"
|
||||
elseif os.istarget("bsd") and os.getversion().description == "FreeBSD" then
|
||||
cc = "clang"
|
||||
elseif not os.istarget("windows") then
|
||||
-- Determine C compiler
|
||||
local cc = nil
|
||||
if os.getenv("CC") then
|
||||
cc = os.getenv("CC")
|
||||
if cc == nil or cc == "" then
|
||||
local hasgcc = os.execute("which gcc > .gccpath")
|
||||
local f = io.open(".gccpath", "r")
|
||||
local gccpath = f:read("*line")
|
||||
f:close()
|
||||
os.execute("rm .gccpath")
|
||||
if gccpath == nil then
|
||||
cc = "clang"
|
||||
else
|
||||
cc = "gcc"
|
||||
end
|
||||
end
|
||||
elseif _OPTIONS["cc"] then
|
||||
cc = _OPTIONS["cc"]
|
||||
else
|
||||
-- assumes cc name is toolset name
|
||||
cc = premake.action.current().toolset
|
||||
end
|
||||
|
||||
-- detect CPU architecture (simplistic)
|
||||
|
||||
Reference in New Issue
Block a user