Merge latest development branch

This commit is contained in:
Jason Perkins 2014-10-02 17:11:34 -04:00
commit a9f862293b
11 changed files with 214 additions and 27 deletions

View File

@ -29,6 +29,7 @@
excludes
{
"src/host/lua-5.1.4/src/lauxlib.c",
"src/host/lua-5.1.4/src/lua.c",
"src/host/lua-5.1.4/src/luac.c",
"src/host/lua-5.1.4/src/print.c",

View File

@ -133,6 +133,13 @@
api.alias("buildoutputs", "buildOutputs")
api.register {
name = "buildinputs",
scope = "config",
kind = "list:path",
tokens = true,
}
api.register {
name = "buildrule", -- DEPRECATED
scope = "config",

View File

@ -154,7 +154,12 @@
_x('ifeq ($(config),%s)', cfg.shortname)
local output = project.getrelative(prj, filecfg.buildoutputs[1])
_x('%s: %s', output, filecfg.relpath)
local dependencies = filecfg.relpath
if filecfg.buildinputs and #filecfg.buildinputs > 0 then
local inputs = project.getrelative(prj, filecfg.buildinputs)
dependencies = dependencies .. " " .. table.concat(inputs, " ")
end
_x('%s: %s', output, dependencies)
_p('\t@echo "%s"', filecfg.buildmessage or ("Building " .. filecfg.relpath))
for _, cmd in ipairs(filecfg.buildcommands) do
_p('\t$(SILENT) %s', cmd)
@ -172,10 +177,10 @@
function make.cppObjects(prj)
-- create lists for intermediate files, at the project level and
-- for each configuration
local root = { objects={}, resources={} }
local root = { objects={}, resources={}, customfiles={} }
local configs = {}
for cfg in project.eachconfig(prj) do
configs[cfg] = { objects={}, resources={} }
configs[cfg] = { objects={}, resources={}, customfiles={} }
end
-- now walk the list of files in the project
@ -235,6 +240,8 @@
local output = project.getrelative(prj, filecfg.buildoutputs[1])
if path.isobjectfile(output) then
table.insert(configs[cfg].objects, output)
else
table.insert(configs[cfg].customfiles, output)
end
end
end
@ -254,11 +261,12 @@
listobjects('OBJECTS :=', root.objects, 'o')
listobjects('RESOURCES :=', root.resources, 'res')
listobjects('CUSTOMFILES :=', root.customfiles)
-- ...then individual configurations, as needed
for cfg in project.eachconfig(prj) do
local files = configs[cfg]
if #files.objects > 0 or #files.resources > 0 then
if #files.objects > 0 or #files.resources > 0 or #files.customfiles > 0 then
_x('ifeq ($(config),%s)', cfg.shortname)
if #files.objects > 0 then
listobjects(' OBJECTS +=', files.objects)
@ -266,6 +274,9 @@
if #files.resources > 0 then
listobjects(' RESOURCES +=', files.resources)
end
if #files.customfiles > 0 then
listobjects(' CUSTOMFILES +=', files.customfiles)
end
_p('endif')
_p('')
end
@ -332,7 +343,7 @@
function make.cppTargetRules(prj)
_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES) ${CUSTOMFILES}')
_p('\t@echo Linking %s', prj.name)
_p('\t$(SILENT) $(LINKCMD)')
_p('\t$(POSTBUILDCMDS)')

View File

@ -1034,6 +1034,11 @@
local outputs = project.getrelative(filecfg.project, filecfg.buildoutputs)
p.x('Outputs="%s"', table.concat(outputs, ' '))
if filecfg.buildinputs and #filecfg.buildinputs > 0 then
local inputs = project.getrelative(filecfg.project, filecfg.buildinputs)
p.x('AdditionalDependencies="%s"', table.concat(inputs, ';'))
end
end
end

View File

@ -656,6 +656,11 @@
if filecfg.buildmessage then
m.element("Message", condition, '%s', filecfg.buildmessage)
end
if filecfg.buildinputs and #filecfg.buildinputs > 0 then
local inputs = project.getrelative(prj, filecfg.buildinputs)
m.element("AdditionalInputs", condition, '%s', table.concat(inputs, ";"))
end
end
end
@ -816,17 +821,34 @@
-- Generate the list of project dependencies.
--
m.elements.projectReferences = function(prj, ref)
if prj.flags.Managed then
return {
m.referenceProject,
m.referencePrivate,
m.referenceOutputAssembly,
m.referenceCopyLocalSatelliteAssemblies,
m.referenceLinkLibraryDependencies,
m.referenceUseLibraryDependences,
}
else
return {
m.referenceProject,
}
end
end
function m.projectReferences(prj)
local deps = project.getdependencies(prj)
if #deps > 0 then
_p(1,'<ItemGroup>')
for _, dep in ipairs(deps) do
local relpath = project.getrelative(prj, vstudio.projectfile(dep))
_x(2,'<ProjectReference Include=\"%s\">', path.translate(relpath))
_p(3,'<Project>{%s}</Project>', dep.uuid)
_p(2,'</ProjectReference>')
local refs = project.getdependencies(prj)
if #refs > 0 then
p.push('<ItemGroup>')
for _, ref in ipairs(refs) do
local relpath = project.getrelative(prj, vstudio.projectfile(ref))
p.push('<ProjectReference Include=\"%s\">', path.translate(relpath))
p.callArray(m.elements.projectReferences, prj, ref)
p.pop('</ProjectReference>')
end
_p(1,'</ItemGroup>')
p.pop('</ItemGroup>')
end
end
@ -1402,7 +1424,6 @@
end
function m.propertySheetGroup(prj)
for cfg in project.eachconfig(prj) do
m.propertySheets(cfg)
@ -1410,6 +1431,35 @@
end
function m.referenceCopyLocalSatelliteAssemblies(prj, ref)
p.w('<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>')
end
function m.referenceLinkLibraryDependencies(prj, ref)
p.w('<LinkLibraryDependencies>true</LinkLibraryDependencies>')
end
function m.referenceOutputAssembly(prj, ref)
p.w('<ReferenceOutputAssembly>true</ReferenceOutputAssembly>')
end
function m.referencePrivate(prj, ref)
p.w('<Private>true</Private>')
end
function m.referenceProject(prj, ref)
p.w('<Project>{%s}</Project>', ref.uuid)
end
function m.referenceUseLibraryDependences(prj, ref)
p.w('<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>')
end
function m.resourceAdditionalIncludeDirectories(cfg)
m.additionalIncludeDirectories(cfg, table.join(cfg.includedirs, cfg.resincludedirs))

View File

@ -79,8 +79,13 @@
formats = { "lib%s.so", "%s.so" }
path = os.getenv("LD_LIBRARY_PATH") or ""
for _, v in ipairs(parse_ld_so_conf("/etc/ld.so.conf")) do
path = path .. ":" .. v
for _, prefix in ipairs({"", "/opt"}) do
local conf_file = prefix .. "/etc/ld.so.conf"
if os.isfile(conf_file) then
for _, v in ipairs(parse_ld_so_conf(conf_file)) do
path = path .. ":" .. v
end
end
end
end

View File

@ -92,3 +92,30 @@ obj/Release/hello.obj: hello.x
endif
]]
end
function suite.customBuildRuleWithAdditionalInputs()
files { "hello.x" }
filter "files:**.x"
buildmessage "Compiling %{file.name}"
buildcommands {
'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"',
'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"'
}
buildoutputs { "%{cfg.objdir}/%{file.basename}.obj" }
buildinputs { "%{file.path}.inc", "%{file.path}.inc2" }
prepare()
test.capture [[
ifeq ($(config),debug)
obj/Debug/hello.obj: hello.x hello.x.inc hello.x.inc2
@echo "Compiling hello.x"
$(SILENT) cxc -c "hello.x" -o "obj/Debug/hello.xo"
$(SILENT) c2o -c "obj/Debug/hello.xo" -o "obj/Debug/hello.obj"
endif
ifeq ($(config),release)
obj/Release/hello.obj: hello.x hello.x.inc hello.x.inc2
@echo "Compiling hello.x"
$(SILENT) cxc -c "hello.x" -o "obj/Release/hello.xo"
$(SILENT) c2o -c "obj/Release/hello.xo" -o "obj/Release/hello.obj"
endif
]]
end

View File

@ -71,6 +71,8 @@ OBJECTS := \
RESOURCES := \
CUSTOMFILES := \
ifeq ($(config),debug)
OBJECTS += \
$(OBJDIR)/hello_debug.o \
@ -123,6 +125,8 @@ OBJECTS := \
RESOURCES := \
CUSTOMFILES := \
ifeq ($(config),debug)
OBJECTS += \
obj/Debug/hello.obj \
@ -147,6 +151,8 @@ OBJECTS := \
RESOURCES := \
CUSTOMFILES := \
ifeq ($(config),release)
OBJECTS += \
$(OBJDIR)/hello.o \
@ -166,6 +172,8 @@ OBJECTS := \
RESOURCES := \
CUSTOMFILES := \
ifeq ($(config),release)
OBJECTS += \
$(OBJDIR)/hello.o \

View File

@ -375,6 +375,35 @@
]]
end
function suite.customBuildTool_onBuildRuleWithAdditionalInputs()
files { "hello.x" }
filter "files:**.x"
buildmessage "Compiling $(InputFile)"
buildcommands {
'cxc -c "$(InputFile)" -o "$(IntDir)/$(InputName).xo"',
'c2o -c "$(IntDir)/$(InputName).xo" -o "$(IntDir)/$(InputName).obj"'
}
buildoutputs { "$(IntDir)/$(InputName).obj" }
buildinputs { "common.x.inc", "common.x.inc2" }
prepare()
test.capture [[
<Files>
<File
RelativePath="hello.x"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="cxc -c &quot;$(InputFile)&quot; -o &quot;$(IntDir)/$(InputName).xo&quot;&#x0D;&#x0A;c2o -c &quot;$(IntDir)/$(InputName).xo&quot; -o &quot;$(IntDir)/$(InputName).obj&quot;"
Outputs="$(IntDir)/$(InputName).obj"
AdditionalDependencies="common.x.inc;common.x.inc2"
/>
</FileConfiguration>
]]
end
--
-- If two files at different folder levels have the same name, a different

View File

@ -115,6 +115,28 @@
]]
end
function suite.customBuild_onBuildRuleWithAdditionalInputs()
files { "hello.cg" }
filter "files:**.cg"
buildcommands { "cgc $(InputFile)" }
buildoutputs { "$(InputName).obj" }
buildinputs { "common.cg.inc", "common.cg.inc2" }
prepare()
test.capture [[
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">common.cg.inc;common.cg.inc2</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">common.cg.inc;common.cg.inc2</AdditionalInputs>
</CustomBuild>
</ItemGroup>
]]
end
--
-- If a PCH source is specified, ensure it is included in the file configuration.

View File

@ -47,11 +47,11 @@
links { "MyProject" }
prepare()
test.capture [[
<ItemGroup>
<ProjectReference Include="MyProject.vcxproj">
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="MyProject.vcxproj">
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
</ProjectReference>
</ItemGroup>
]]
end
@ -67,11 +67,33 @@
location "build/MyProject"
prepare()
test.capture [[
<ItemGroup>
<ProjectReference Include="..\MyProject\MyProject.vcxproj">
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyProject\MyProject.vcxproj">
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
</ProjectReference>
</ItemGroup>
]]
end
--
-- Managed C++ projects write out references a little differently.
--
function suite.referencesAreRelative_onDifferentProjectLocation()
links { "MyProject" }
flags { "Managed" }
prepare()
test.capture [[
<ItemGroup>
<ProjectReference Include="MyProject.vcxproj">
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
<Private>true</Private>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
</ItemGroup>
]]
end