Merged in TurkeyMan/premake-dev/gccprefix (pull request #154)
Added new API gccprefix
This commit is contained in:
commit
d5b5abe43e
@ -452,6 +452,13 @@
|
||||
kind = "string",
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "gccprefix",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
tokens = true,
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "icon",
|
||||
scope = "project",
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user