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

View File

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

View File

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

View File

@ -92,7 +92,7 @@
ctx.language = premake.CPP
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.
context.addterms(ctx, ctx.kind)
@ -103,8 +103,8 @@
ctx.baked = true
-- Fill in some additional state. Copying the keys over from the
-- scripted project object allows custom values to passed through to
-- extension scripts.
-- scripted project object allows custom values set in the project
-- script to be passed through to extension scripts.
for key, value in pairs(prj) do
ctx[key] = value
@ -465,6 +465,8 @@
fcfg.basename = path.getbasename(filename)
fcfg.path = fcfg.relpath
fcfg.objname = project.getfileobject(prj, filename)
return fcfg
end
@ -508,6 +510,16 @@
-- make sure I have the project, and not it's root configuration
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
prj.fileobjects = prj.fileobjects or {}

View File

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