diff options
author | Jason Perkins <starkos@industriousone.com> | 2013-08-17 23:07:20 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2013-08-17 23:07:20 +0400 |
commit | c78e37f993e410c7a7eb0858dc57f5a2cc1e8100 (patch) | |
tree | 53ff74bad3745a1a53049ebf3144511c2cfa4c5d /src | |
parent | 24159a810efe620a96883f8977ab76b9940912e0 (diff) |
Enable custom source trees for Xcode frameworks using VS-esque variables such as "$(SDKROOT)/OpenGLES.framework" (Ben Henning)
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/xcode/xcode_common.lua | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua index e18feed..5a610bf 100644 --- a/src/actions/xcode/xcode_common.lua +++ b/src/actions/xcode/xcode_common.lua @@ -318,18 +318,36 @@ local pth, src if xcode.isframework(node.path) then --respect user supplied paths - if string.find(node.path,'/') then - if string.find(node.path,'^%.')then + -- look for special variable-starting paths for different sources + local nodePath = node.path + local _, matchEnd, variable = string.find(nodePath, "^%$%((.+)%)/") + if variable then + -- by skipping the last '/' we support the same absolute/relative + -- paths as before + nodePath = string.sub(nodePath, matchEnd + 1) + end + if string.find(nodePath,'/') then + if string.find(nodePath,'^%.')then error('relative paths are not currently supported for frameworks') end - pth = node.path + pth = nodePath + else + pth = "/System/Library/Frameworks/" .. nodePath + end + -- if it starts with a variable, use that as the src instead + if variable then + src = variable + -- if we are using a different source tree, it has to be relative + -- to that source tree, so get rid of any leading '/' + if string.find(pth, '^/') then + pth = string.sub(pth, 2) + end else - pth = "/System/Library/Frameworks/" .. node.path + src = "<absolute>" end - src = "absolute" else -- something else; probably a source code file - src = "group" + src = "<group>" -- if the parent node is virtual, it won't have a local path -- of its own; need to use full relative path from project @@ -340,7 +358,7 @@ end end - _p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "<%s>"; };', + _p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "%s"; };', node.id, node.name, xcode.getfiletype(node), node.name, pth, src) end end |