Added Ben Henning's GSoC2013 work: premake build system.

This commit is contained in:
Ryan C. Gordon 2013-11-10 00:38:37 -05:00
parent 694010e6e4
commit 5595fbc315
473 changed files with 89151 additions and 1 deletions

29
premake/patches/709.patch Executable file
View file

@ -0,0 +1,29 @@
# HG changeset patch
# User Ben Henning
# Date 1375901577 25200
# Wed Aug 07 11:52:57 2013 -0700
# Node ID 1d820b5754a9bc79b5c4c6a26d1acc170ebf4784
# Parent 0af3bf0e3755477eafb247935db77b2765df2d19
Updated the GCC make option to handle its linker cmomand generation a bit
differently. Rather than putting the sibling libraries before the linker
flags, they are put after. This allows for some extra flexibility in putting
custom linker libraries before the list of sibling libraries, in case one of
them depends on it.
diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua
--- a/src/actions/make/make_cpp.lua
+++ b/src/actions/make/make_cpp.lua
@@ -267,11 +267,12 @@
_p(' LINKCMD = $(AR) -rcs $(TARGET) $(OBJECTS)')
end
else
+ -- Ben: changed order of ALL_LDFLAGS and LIBS (switched them)
-- this was $(TARGET) $(LDFLAGS) $(OBJECTS)
-- but had trouble linking to certain static libs so $(OBJECTS) moved up
-- then $(LDFLAGS) moved to end
-- https://sourceforge.net/tracker/?func=detail&aid=3430158&group_id=71616&atid=531880
- _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(ALL_LDFLAGS)', iif(cfg.language == "C", "CC", "CXX"))
+ _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', iif(cfg.language == "C", "CC", "CXX"))
end
end

30
premake/patches/711.patch Executable file
View file

@ -0,0 +1,30 @@
# HG changeset patch
# User Ben Henning
# Date 1376453463 25200
# Tue Aug 13 21:11:03 2013 -0700
# Node ID a5f8b4f709722222e02fa481873d76ad25255e09
# Parent 8b24d45e6a5d717876a7b32b64e99043c95328e5
Implemented Xcode recognizing bitmap and wave files as resources, plus properly
set their types recognizable by Xcode itself.
diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
--- a/src/actions/xcode/xcode_common.lua
+++ b/src/actions/xcode/xcode_common.lua
@@ -32,6 +32,8 @@
[".nib"] = "Resources",
[".xib"] = "Resources",
[".icns"] = "Resources",
+ [".bmp"] = "Resources",
+ [".wav"] = "Resources",
}
return categories[path.getextension(node.name)]
end
@@ -85,6 +87,8 @@
[".strings"] = "text.plist.strings",
[".xib"] = "file.xib",
[".icns"] = "image.icns",
+ [".bmp"] = "image.bmp",
+ [".wav"] = "audio.wav",
}
return types[path.getextension(node.path)] or "text"
end

58
premake/patches/712.patch Executable file
View file

@ -0,0 +1,58 @@
# HG changeset patch
# User Ben Henning
# Date 1376509869 25200
# Wed Aug 14 12:51:09 2013 -0700
# Node ID e8558df4fbdb173a2b9ed0d354d6c3e76b376698
# Parent a5f8b4f709722222e02fa481873d76ad25255e09
Fixed a bug in Xcode project generation wherein pre/prelink/post-build commands
would not be properly executed if the premake script only had the commands
in configuration blocks, rather than in the project block. According to the
website, these commands can exist in both blocks and the Xcode script does
properly generate the commands, it just doesn't add a single line which allows
Xcode to execute the commands at the correct stage. This patch fixes those
issues.
diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
--- a/src/actions/xcode/xcode_common.lua
+++ b/src/actions/xcode/xcode_common.lua
@@ -432,20 +432,37 @@
for _, node in ipairs(tr.products.children) do
local name = tr.project.name
+ -- This function checks whether there are build commands of a specific
+ -- type to be executed; they will be generated correctly, but the project
+ -- commands will not contain any per-configuration commands, so the logic
+ -- has to be extended a bit to account for that.
+ local function hasBuildCommands(which)
+ -- standard check...this is what existed before
+ if #tr.project[which] > 0 then
+ return true
+ end
+ -- what if there are no project-level commands? check configs...
+ for _, cfg in ipairs(tr.configs) do
+ if #cfg[which] > 0 then
+ return true
+ end
+ end
+ end
+
_p(2,'%s /* %s */ = {', node.targetid, name)
_p(3,'isa = PBXNativeTarget;')
_p(3,'buildConfigurationList = %s /* Build configuration list for PBXNativeTarget "%s" */;', node.cfgsection, name)
_p(3,'buildPhases = (')
- if #tr.project.prebuildcommands > 0 then
+ if hasBuildCommands('prebuildcommands') then
_p(4,'9607AE1010C857E500CD1376 /* Prebuild */,')
end
_p(4,'%s /* Resources */,', node.resstageid)
_p(4,'%s /* Sources */,', node.sourcesid)
- if #tr.project.prelinkcommands > 0 then
+ if hasBuildCommands('prelinkcommands') then
_p(4,'9607AE3510C85E7E00CD1376 /* Prelink */,')
end
_p(4,'%s /* Frameworks */,', node.fxstageid)
- if #tr.project.postbuildcommands > 0 then
+ if hasBuildCommands('postbuildcommands') then
_p(4,'9607AE3710C85E8F00CD1376 /* Postbuild */,')
end
_p(3,');')

64
premake/patches/713.patch Executable file
View file

@ -0,0 +1,64 @@
# HG changeset patch
# User Ben Henning
# Date 1376606083 25200
# Thu Aug 15 15:34:43 2013 -0700
# Node ID 8c9cd352c70012a64779356bff3c81998c3fb6a0
# Parent e8558df4fbdb173a2b9ed0d354d6c3e76b376698
Implemented the option to set custom source trees for Xcode frameworks (links)
using Visual Studio-esque variables, such as "$(SDKROOT)/OpenGLES.framework".
diff --git a/src/actions/xcode/xcode_common.lua b/src/actions/xcode/xcode_common.lua
--- 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/" .. node.path
+ pth = "/System/Library/Frameworks/" .. nodePath
end
- src = "absolute"
+ -- 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
+ src = "<absolute>"
+ end
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

71
premake/patches/iOS.patch Executable file
View file

@ -0,0 +1,71 @@
# HG changeset patch
# User Guido Lorenz <guido@superquadratic.net>
# Date 1314134634 -7200
# Node ID 5552b57a6b3e541edac2cf0ef3f66a361e9c774e
# Parent 60bda91095e1b823134fc7341e2c34ca7c198341
Added iOS platform (Xcode only).
diff -r 60bda91095e1 -r 5552b57a6b3e src/actions/xcode/_xcode.lua
--- a/src/actions/xcode/_xcode.lua Fri Aug 19 08:58:23 2011 -0400
+++ b/src/actions/xcode/_xcode.lua Tue Aug 23 23:23:54 2011 +0200
@@ -28,6 +28,7 @@
Universal32 = "32-bit Universal",
Universal64 = "64-bit Universal",
Universal = "Universal",
+ iOS = "iOS",
},
default_platform = "Universal",
@@ -79,6 +80,7 @@
Universal32 = "32-bit Universal",
Universal64 = "64-bit Universal",
Universal = "Universal",
+ iOS = "iOS",
},
default_platform = "Universal",
diff -r 60bda91095e1 -r 5552b57a6b3e src/actions/xcode/xcode_common.lua
--- a/src/actions/xcode/xcode_common.lua Fri Aug 19 08:58:23 2011 -0400
+++ b/src/actions/xcode/xcode_common.lua Tue Aug 23 23:23:54 2011 +0200
@@ -724,9 +724,15 @@
Universal32 = "$(ARCHS_STANDARD_32_BIT)",
Universal64 = "$(ARCHS_STANDARD_64_BIT)",
Universal = "$(ARCHS_STANDARD_32_64_BIT)",
+ iOS = "$(ARCHS_UNIVERSAL_IPHONE_OS)",
}
_p(4,'ARCHS = "%s";', archs[cfg.platform])
+ if cfg.platform == "iOS" then
+ _p(4,'SDKROOT = %s;', "iphoneos")
+ _p(4,'CODE_SIGN_IDENTITY = "%s";', "iPhone Developer")
+ end
+
local targetdir = path.getdirectory(cfg.buildtarget.bundlepath)
if targetdir ~= "." then
_p(4,'CONFIGURATION_BUILD_DIR = "$(SYMROOT)";');
diff -r 60bda91095e1 -r 5552b57a6b3e src/base/cmdline.lua
--- a/src/base/cmdline.lua Fri Aug 19 08:58:23 2011 -0400
+++ b/src/base/cmdline.lua Tue Aug 23 23:23:54 2011 +0200
@@ -71,6 +71,7 @@
{ "universal", "Mac OS X Universal, 32- and 64-bit" },
{ "universal32", "Mac OS X Universal, 32-bit only" },
{ "universal64", "Mac OS X Universal, 64-bit only" },
+ { "ios", "iOS" },
{ "ps3", "Playstation 3 (experimental)" },
{ "xbox360", "Xbox 360 (experimental)" },
}
diff -r 60bda91095e1 -r 5552b57a6b3e src/base/globals.lua
--- a/src/base/globals.lua Fri Aug 19 08:58:23 2011 -0400
+++ b/src/base/globals.lua Tue Aug 23 23:23:54 2011 +0200
@@ -38,6 +38,11 @@
{
cfgsuffix = "univ64",
},
+ iOS =
+ {
+ cfgsuffix = "ios",
+ iscrosscompiler = true,
+ },
PS3 =
{
cfgsuffix = "ps3",

View file

@ -0,0 +1,26 @@
The patches in this directory are targeted to the premake4 stable branch, based
on the date of these files and the repository.
1. 709.patch: this patch corrects the linking order for generated GNU makefiles.
More information on this patch can be found at:
https://sourceforge.net/p/premake/bugs/279/
2. iOS.patch: this patch adds a iOS as a platform option for premake, allowing
for potential iOS Xcode project generation.
3. 711.patch: this patch adds support for Xcode recognizing files added to
Xcode projects with the extensions of .bmp or .wav as resource files with
the respective file types of image and audio. This is needed to properly
bundle the Xcode-iOS resources with the app package. See the following for
more information:
https://sourceforge.net/p/premake/patches/165/
4. 712.patch: this patch fixes an issue in Xcode that prevents post-build
commands from working for multiple configurations. This is why I had to have
debug and release configurations disabled for so long. They are now reenabled
and should be working fine. For more information:
https://sourceforge.net/p/premake/bugs/280/
5. 713.patch: this patch allows custom source trees to be set in Xcode links
using variables similar to Visual Studio variables. This is necessary to
properly link to frameworks for iOS projects. For more information:
https://sourceforge.net/p/premake/patches/166/
The repository containing these changes can be found at:
https://bitbucket.org/gsocben/premake-stable-sdlgsoc2013