713.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # HG changeset patch
  2. # User Ben Henning
  3. # Date 1376606083 25200
  4. # Thu Aug 15 15:34:43 2013 -0700
  5. # Node ID 8c9cd352c70012a64779356bff3c81998c3fb6a0
  6. # Parent e8558df4fbdb173a2b9ed0d354d6c3e76b376698
  7. Implemented the option to set custom source trees for Xcode frameworks (links)
  8. using Visual Studio-esque variables, such as "$(SDKROOT)/OpenGLES.framework".
  9. diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
  10. --- a/src/actions/xcode/xcode_common.lua
  11. +++ b/src/actions/xcode/xcode_common.lua
  12. @@ -318,18 +318,36 @@
  13. local pth, src
  14. if xcode.isframework(node.path) then
  15. --respect user supplied paths
  16. - if string.find(node.path,'/') then
  17. - if string.find(node.path,'^%.')then
  18. + -- look for special variable-starting paths for different sources
  19. + local nodePath = node.path
  20. + local _, matchEnd, variable = string.find(nodePath, "^%$%((.+)%)/")
  21. + if variable then
  22. + -- by skipping the last '/' we support the same absolute/relative
  23. + -- paths as before
  24. + nodePath = string.sub(nodePath, matchEnd + 1)
  25. + end
  26. + if string.find(nodePath,'/') then
  27. + if string.find(nodePath,'^%.')then
  28. error('relative paths are not currently supported for frameworks')
  29. end
  30. - pth = node.path
  31. + pth = nodePath
  32. else
  33. - pth = "/System/Library/Frameworks/" .. node.path
  34. + pth = "/System/Library/Frameworks/" .. nodePath
  35. end
  36. - src = "absolute"
  37. + -- if it starts with a variable, use that as the src instead
  38. + if variable then
  39. + src = variable
  40. + -- if we are using a different source tree, it has to be relative
  41. + -- to that source tree, so get rid of any leading '/'
  42. + if string.find(pth, '^/') then
  43. + pth = string.sub(pth, 2)
  44. + end
  45. + else
  46. + src = "<absolute>"
  47. + end
  48. else
  49. -- something else; probably a source code file
  50. - src = "group"
  51. + src = "<group>"
  52. -- if the parent node is virtual, it won't have a local path
  53. -- of its own; need to use full relative path from project
  54. @@ -340,7 +358,7 @@
  55. end
  56. end
  57. - _p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "<%s>"; };',
  58. + _p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = "%s"; path = "%s"; sourceTree = "%s"; };',
  59. node.id, node.name, xcode.getfiletype(node), node.name, pth, src)
  60. end
  61. end