premake/patches/713.patch
changeset 7925 f090a47eb7f7
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/premake/patches/713.patch	Sun Nov 10 00:38:37 2013 -0500
     1.3 @@ -0,0 +1,64 @@
     1.4 +# HG changeset patch
     1.5 +# User Ben Henning
     1.6 +# Date 1376606083 25200
     1.7 +#      Thu Aug 15 15:34:43 2013 -0700
     1.8 +# Node ID 8c9cd352c70012a64779356bff3c81998c3fb6a0
     1.9 +# Parent  e8558df4fbdb173a2b9ed0d354d6c3e76b376698
    1.10 +Implemented the option to set custom source trees for Xcode frameworks (links)
    1.11 +using Visual Studio-esque variables, such as "$(SDKROOT)/OpenGLES.framework".
    1.12 +
    1.13 +diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
    1.14 +--- a/src/actions/xcode/xcode_common.lua
    1.15 ++++ b/src/actions/xcode/xcode_common.lua
    1.16 +@@ -318,18 +318,36 @@
    1.17 + 					local pth, src
    1.18 + 					if xcode.isframework(node.path) then
    1.19 + 						--respect user supplied paths
    1.20 +-						if string.find(node.path,'/')  then
    1.21 +-							if string.find(node.path,'^%.')then
    1.22 ++						-- look for special variable-starting paths for different sources
    1.23 ++						local nodePath = node.path
    1.24 ++						local _, matchEnd, variable = string.find(nodePath, "^%$%((.+)%)/")
    1.25 ++						if variable then
    1.26 ++							-- by skipping the last '/' we support the same absolute/relative
    1.27 ++							-- paths as before
    1.28 ++							nodePath = string.sub(nodePath, matchEnd + 1)
    1.29 ++						end
    1.30 ++						if string.find(nodePath,'/')  then
    1.31 ++							if string.find(nodePath,'^%.')then
    1.32 + 								error('relative paths are not currently supported for frameworks')
    1.33 + 							end
    1.34 +-							pth = node.path
    1.35 ++							pth = nodePath
    1.36 + 						else
    1.37 +-							pth = "/System/Library/Frameworks/" .. node.path
    1.38 ++							pth = "/System/Library/Frameworks/" .. nodePath
    1.39 + 						end
    1.40 +-						src = "absolute"
    1.41 ++						-- if it starts with a variable, use that as the src instead
    1.42 ++						if variable then
    1.43 ++							src = variable
    1.44 ++							-- if we are using a different source tree, it has to be relative
    1.45 ++							-- to that source tree, so get rid of any leading '/'
    1.46 ++							if string.find(pth, '^/') then
    1.47 ++								pth = string.sub(pth, 2)
    1.48 ++							end
    1.49 ++						else
    1.50 ++							src = "<absolute>"
    1.51 ++						end
    1.52 + 					else
    1.53 + 						-- something else; probably a source code file
    1.54 +-						src = "group"
    1.55 ++						src = "<group>"
    1.56 + 
    1.57 + 						-- if the parent node is virtual, it won't have a local path
    1.58 + 						-- of its own; need to use full relative path from project
    1.59 +@@ -340,7 +358,7 @@
    1.60 + 						end
    1.61 + 					end
    1.62 + 					
    1.63 +-					_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "<%s>"; };',
    1.64 ++					_p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "%s"; };',
    1.65 + 						node.id, node.name, xcode.getfiletype(node), node.name, pth, src)
    1.66 + 				end
    1.67 + 			end