Added frameworks to PBXBuildFile

This commit is contained in:
starkos 2009-11-05 21:25:27 +00:00
parent 5f48d7414e
commit 74a37071f8
3 changed files with 32 additions and 1 deletions

View File

@ -22,7 +22,9 @@
},
onsolution = function(sln)
premake.generate(sln, "%%.xcodeproj/project.pbxproj", premake.xcode.solution)
-- Must ensure a unique name; project may have same name as solution, and they
-- share the same file extension. How to handle?
-- premake.generate(sln, "%%.xcodeproj/project.pbxproj", premake.xcode.solution)
end,
onproject = function(prj)

View File

@ -46,6 +46,23 @@
end
})
-- the special folder "Frameworks" lists all of frameworks linked to project;
tr.frameworks = tree.new("Frameworks")
for cfg in premake.eachconfig(prj) do
for _, link in ipairs(cfg.links) do
local name = path.getname(link)
if xcode.isframework(name) and not tr.frameworks.children[name] then
node = tree.insert(tr.frameworks, tree.new(name))
node.path = link
end
end
end
-- only add it to the tree if there are frameworks to link
if #tr.frameworks.children > 0 then
tree.insert(tr, tr.frameworks)
end
-- Final setup
tree.traverse(tr, {
onnode = function(node)

View File

@ -56,3 +56,15 @@
/* End PBXBuildFile section */
]]
end
function suite.PBXBuildFile_ListsFrameworks()
links { "Cocoa.framework" }
prepare()
xcode.PBXBuildFile(tr)
test.capture [[
/* Begin PBXBuildFile section */
[Cocoa.framework:build] /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = [Cocoa.framework] /* Cocoa.framework */; };
/* End PBXBuildFile section */
]]
end