premake/patches/712.patch
changeset 7925 f090a47eb7f7
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/premake/patches/712.patch	Sun Nov 10 00:38:37 2013 -0500
     1.3 @@ -0,0 +1,58 @@
     1.4 +# HG changeset patch
     1.5 +# User Ben Henning
     1.6 +# Date 1376509869 25200
     1.7 +#      Wed Aug 14 12:51:09 2013 -0700
     1.8 +# Node ID e8558df4fbdb173a2b9ed0d354d6c3e76b376698
     1.9 +# Parent  a5f8b4f709722222e02fa481873d76ad25255e09
    1.10 +Fixed a bug in Xcode project generation wherein pre/prelink/post-build commands
    1.11 +would not be properly executed if the premake script only had the commands
    1.12 +in configuration blocks, rather than in the project block. According to the
    1.13 +website, these commands can exist in both blocks and the Xcode script does
    1.14 +properly generate the commands, it just doesn't add a single line which allows
    1.15 +Xcode to execute the commands at the correct stage. This patch fixes those
    1.16 +issues.
    1.17 +
    1.18 +diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
    1.19 +--- a/src/actions/xcode/xcode_common.lua
    1.20 ++++ b/src/actions/xcode/xcode_common.lua
    1.21 +@@ -432,20 +432,37 @@
    1.22 + 		for _, node in ipairs(tr.products.children) do
    1.23 + 			local name = tr.project.name
    1.24 + 			
    1.25 ++			-- This function checks whether there are build commands of a specific
    1.26 ++			-- type to be executed; they will be generated correctly, but the project
    1.27 ++			-- commands will not contain any per-configuration commands, so the logic
    1.28 ++			-- has to be extended a bit to account for that.
    1.29 ++			local function hasBuildCommands(which)
    1.30 ++				-- standard check...this is what existed before
    1.31 ++				if #tr.project[which] > 0 then
    1.32 ++					return true
    1.33 ++				end
    1.34 ++				-- what if there are no project-level commands? check configs...
    1.35 ++				for _, cfg in ipairs(tr.configs) do
    1.36 ++					if #cfg[which] > 0 then
    1.37 ++						return true
    1.38 ++					end
    1.39 ++				end
    1.40 ++			end
    1.41 ++			
    1.42 + 			_p(2,'%s /* %s */ = {', node.targetid, name)
    1.43 + 			_p(3,'isa = PBXNativeTarget;')
    1.44 + 			_p(3,'buildConfigurationList = %s /* Build configuration list for PBXNativeTarget "%s" */;', node.cfgsection, name)
    1.45 + 			_p(3,'buildPhases = (')
    1.46 +-			if #tr.project.prebuildcommands > 0 then
    1.47 ++			if hasBuildCommands('prebuildcommands') then
    1.48 + 				_p(4,'9607AE1010C857E500CD1376 /* Prebuild */,')
    1.49 + 			end
    1.50 + 			_p(4,'%s /* Resources */,', node.resstageid)
    1.51 + 			_p(4,'%s /* Sources */,', node.sourcesid)
    1.52 +-			if #tr.project.prelinkcommands > 0 then
    1.53 ++			if hasBuildCommands('prelinkcommands') then
    1.54 + 				_p(4,'9607AE3510C85E7E00CD1376 /* Prelink */,')
    1.55 + 			end
    1.56 + 			_p(4,'%s /* Frameworks */,', node.fxstageid)
    1.57 +-			if #tr.project.postbuildcommands > 0 then
    1.58 ++			if hasBuildCommands('postbuildcommands') then
    1.59 + 				_p(4,'9607AE3710C85E8F00CD1376 /* Postbuild */,')
    1.60 + 			end
    1.61 + 			_p(3,');')