Merged in TurkeyMan/premake-dev/gccprefix (pull request #154)

Added new API gccprefix
This commit is contained in:
Jason Perkins 2015-03-11 12:03:12 -04:00
commit d5b5abe43e
3 changed files with 22 additions and 2 deletions

View File

@ -452,6 +452,13 @@
kind = "string",
}
api.register {
name = "gccprefix",
scope = "config",
kind = "string",
tokens = true,
}
api.register {
name = "icon",
scope = "project",

View File

@ -308,14 +308,18 @@
--
gcc.tools = {
cc = "gcc",
cxx = "g++",
ar = "ar",
rc = "windres"
}
function gcc.gettoolname(cfg, tool)
local names = gcc.tools[cfg.architecture] or gcc.tools[cfg.system] or {}
local name = names[tool]
if tool == "rc" then
name = name or "windres"
if not name and (tool == "rc" or cfg.gccprefix) and gcc.tools[tool] then
name = (cfg.gccprefix or "") .. gcc.tools[tool]
end
return name

View File

@ -38,6 +38,15 @@
test.isequal("windres", gcc.gettoolname(cfg, "rc"))
end
function suite.tools_withPrefix()
gccprefix "test-prefix-"
prepare()
test.isequal("test-prefix-gcc", gcc.gettoolname(cfg, "cc"))
test.isequal("test-prefix-g++", gcc.gettoolname(cfg, "cxx"))
test.isequal("test-prefix-ar", gcc.gettoolname(cfg, "ar"))
test.isequal("test-prefix-windres", gcc.gettoolname(cfg, "rc"))
end
--
-- By default, the -MMD -MP are used to generate dependencies.