Duplicate object file names are now ordered the same across all toolsets

This commit is contained in:
Jason Perkins 2013-06-21 17:32:33 -04:00
parent e7fc3724b5
commit 2f1fe980ef
5 changed files with 23 additions and 16 deletions

View File

@ -182,15 +182,13 @@
function cpp.standardfilerules(prj, node) function cpp.standardfilerules(prj, node)
-- C/C++ file -- C/C++ file
if path.iscppfile(node.abspath) then if path.iscppfile(node.abspath) then
local objectname = project.getfileobject(prj, node.abspath) _x('$(OBJDIR)/%s.o: %s', node.objname, node.relpath)
_x('$(OBJDIR)/%s.o: %s', objectname, node.relpath)
_p('\t@echo $(notdir $<)') _p('\t@echo $(notdir $<)')
cpp.buildcommand(prj, "o", node) cpp.buildcommand(prj, "o", node)
-- resource file -- resource file
elseif path.isresourcefile(node.abspath) then elseif path.isresourcefile(node.abspath) then
local objectname = project.getfileobject(prj, node.abspath) _x('$(OBJDIR)/%s.res: %s', node.objname, node.relpath)
_x('$(OBJDIR)/%s.res: %s', objectname, node.relpath)
_p('\t@echo $(notdir $<)') _p('\t@echo $(notdir $<)')
_p('\t$(SILENT) $(RESCOMP) $< -O coff -o "$@" $(ALL_RESFLAGS)') _p('\t$(SILENT) $(RESCOMP) $< -O coff -o "$@" $(ALL_RESFLAGS)')
end end
@ -309,8 +307,7 @@
end end
-- assign a unique object file name to avoid collisions -- assign a unique object file name to avoid collisions
local objectname = project.getfileobject(prj, node.abspath) objectname = "$(OBJDIR)/" .. node.objname .. iif(kind == "objects", ".o", ".res")
objectname = "$(OBJDIR)/" .. objectname .. iif(kind == "objects", ".o", ".res")
-- if this file exists in all configurations, write it to -- if this file exists in all configurations, write it to
-- the project's list of files, else add to specific cfgs -- the project's list of files, else add to specific cfgs

View File

@ -1072,9 +1072,8 @@
function vc200x.objectFile(filecfg, depth) function vc200x.objectFile(filecfg, depth)
if path.iscppfile(filecfg.name) then if path.iscppfile(filecfg.name) then
local objectName = project.getfileobject(filecfg.project, filecfg.abspath) if filecfg.objname ~= path.getbasename(filecfg.abspath) then
if objectName ~= path.getbasename(filecfg.abspath) then _x(depth, 'ObjectFile="$(IntDir)\\%s.obj"', filecfg.objname)
_x(depth, 'ObjectFile="$(IntDir)\\%s.obj"', objectName)
end end
end end
end end

View File

@ -893,9 +893,8 @@
function vc2010.objectFileName(filecfg) function vc2010.objectFileName(filecfg)
local objectname = project.getfileobject(filecfg.project, filecfg.abspath) if filecfg.objname ~= path.getbasename(filecfg.abspath) then
if objectname ~= path.getbasename(filecfg.abspath) then _p(3,'<ObjectFileName %s>$(IntDir)\\%s.obj</ObjectFileName>', vc2010.condition(filecfg.config), filecfg.objname)
_p(3,'<ObjectFileName %s>$(IntDir)\\%s.obj</ObjectFileName>', vc2010.condition(filecfg.config), objectname)
end end
end end

View File

@ -92,7 +92,7 @@
ctx.language = premake.CPP ctx.language = premake.CPP
end end
-- The kind is a configuration level value, but it has been set at the -- The kind is a configuration level value, but if it has been set at the
-- project level allow that to influence the other project-level results. -- project level allow that to influence the other project-level results.
context.addterms(ctx, ctx.kind) context.addterms(ctx, ctx.kind)
@ -103,8 +103,8 @@
ctx.baked = true ctx.baked = true
-- Fill in some additional state. Copying the keys over from the -- Fill in some additional state. Copying the keys over from the
-- scripted project object allows custom values to passed through to -- scripted project object allows custom values set in the project
-- extension scripts. -- script to be passed through to extension scripts.
for key, value in pairs(prj) do for key, value in pairs(prj) do
ctx[key] = value ctx[key] = value
@ -465,6 +465,8 @@
fcfg.basename = path.getbasename(filename) fcfg.basename = path.getbasename(filename)
fcfg.path = fcfg.relpath fcfg.path = fcfg.relpath
fcfg.objname = project.getfileobject(prj, filename)
return fcfg return fcfg
end end
@ -508,6 +510,16 @@
-- make sure I have the project, and not it's root configuration -- make sure I have the project, and not it's root configuration
prj = prj.project or prj prj = prj.project or prj
-- Only C/C++ projects need object files
if not project.iscpp(prj) then
return nil
end
-- Only C/C++ source code files need objects
if not path.iscppfile(filename) and not path.isresourcefile(filename) then
return nil
end
-- create a list of objects if necessary -- create a list of objects if necessary
prj.fileobjects = prj.fileobjects or {} prj.fileobjects = prj.fileobjects or {}

View File

@ -114,8 +114,8 @@ OBJECTS := \
OBJECTS := \ OBJECTS := \
RESOURCES := \ RESOURCES := \
$(OBJDIR)/hello.res \
$(OBJDIR)/hello1.res \ $(OBJDIR)/hello1.res \
$(OBJDIR)/hello.res \
]] ]]
end end