Merge pull request #507 from Blizzard/rule-cpp-output
Allow rules to generate code that subsequently gets compiled.
This commit is contained in:
commit
a4a8ee19f8
@ -61,6 +61,7 @@
|
|||||||
|
|
||||||
m.elements.computeInputsGroup = function(r)
|
m.elements.computeInputsGroup = function(r)
|
||||||
return {
|
return {
|
||||||
|
m.computeCompileInputsTargets,
|
||||||
m.computeLinkInputsTargets,
|
m.computeLinkInputsTargets,
|
||||||
m.computeLibInputsTargets,
|
m.computeLibInputsTargets,
|
||||||
}
|
}
|
||||||
@ -254,6 +255,15 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function m.computeCompileInputsTargets(r)
|
||||||
|
p.push('<ComputeCompileInputsTargets>')
|
||||||
|
p.w('$(ComputeCompileInputsTargets);')
|
||||||
|
p.w('Compute%sOutput;', r.name)
|
||||||
|
p.pop('</ComputeCompileInputsTargets>')
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function m.dependsOnTargets(r)
|
function m.dependsOnTargets(r)
|
||||||
p.w('DependsOnTargets="$(%sDependsOn);Compute%sOutput"', r.name, r.name)
|
p.w('DependsOnTargets="$(%sDependsOn);Compute%sOutput"', r.name, r.name)
|
||||||
end
|
end
|
||||||
@ -267,11 +277,14 @@
|
|||||||
|
|
||||||
|
|
||||||
function m.linkLib(r)
|
function m.linkLib(r)
|
||||||
local linkable
|
local linkable, compileable
|
||||||
for i = 1, #r.buildoutputs do
|
for i = 1, #r.buildoutputs do
|
||||||
if (path.islinkable(r.buildoutputs[i])) then
|
if (path.islinkable(r.buildoutputs[i])) then
|
||||||
linkable = true
|
linkable = true
|
||||||
end
|
end
|
||||||
|
if (path.iscppfile(r.buildoutputs[i])) then
|
||||||
|
compileable = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if linkable then
|
if linkable then
|
||||||
for i, el in pairs { 'Link', 'Lib', 'ImpLib' } do
|
for i, el in pairs { 'Link', 'Lib', 'ImpLib' } do
|
||||||
@ -281,6 +294,12 @@
|
|||||||
p.pop()
|
p.pop()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if compileable then
|
||||||
|
p.push('<ClCompile', el)
|
||||||
|
p.w('Include="%%(%sOutputs.Identity)"', r.name)
|
||||||
|
p.w('Condition="\'%%(Extension)\'==\'.cc\' or \'%%(Extension)\'==\'.cpp\' or \'%%(Extension)\'==\'.cxx\' or \'%%(Extension)\'==\'.c\'" />')
|
||||||
|
p.pop()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -302,7 +321,7 @@
|
|||||||
function m.outputs(r)
|
function m.outputs(r)
|
||||||
p.w('<%sOutputs', r.name)
|
p.w('<%sOutputs', r.name)
|
||||||
p.w(' Condition="\'@(%s)\' != \'\' and \'%%(%s.ExcludedFromBuild)\' != \'true\'"', r.name, r.name)
|
p.w(' Condition="\'@(%s)\' != \'\' and \'%%(%s.ExcludedFromBuild)\' != \'true\'"', r.name, r.name)
|
||||||
p.w(' Include="%%(%s.Outputs)" />', r.name)
|
p.w(' Include="%%(%s.Outputs)" />', r.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ int do_isabsolute(const char* path)
|
|||||||
if (path[0] == '"')
|
if (path[0] == '"')
|
||||||
return do_isabsolute(path + 1);
|
return do_isabsolute(path + 1);
|
||||||
|
|
||||||
// $(foo)
|
// $(foo) and %(foo)
|
||||||
if (path[0] == '$' && path[1] == '(')
|
if ((path[0] == '%' || path[0] == '$') && path[1] == '(')
|
||||||
{
|
{
|
||||||
path += 2;
|
path += 2;
|
||||||
closing = strchr(path, ')');
|
closing = strchr(path, ')');
|
||||||
|
Loading…
Reference in New Issue
Block a user