diff options
author | starkos <none@none> | 2009-07-16 19:20:15 +0400 |
---|---|---|
committer | starkos <none@none> | 2009-07-16 19:20:15 +0400 |
commit | 37faff9006870d5b323cfa2acb53d79d42fc6a25 (patch) | |
tree | caf0d690da84d1cb2a49cfff942d361dfe32e7ab /premake4.lua | |
parent | da9ad7f437c44840f319ed9500649466c945101b (diff) |
Started a release script
Diffstat (limited to 'premake4.lua')
-rw-r--r-- | premake4.lua | 115 |
1 files changed, 42 insertions, 73 deletions
diff --git a/premake4.lua b/premake4.lua index f537574..29eb7f5 100644 --- a/premake4.lua +++ b/premake4.lua @@ -2,25 +2,16 @@ -- Premake 4.x build configuration script -- -if (_ACTION == "vs2002" or _ACTION == "vs2003") then - error( - "\nBecause of compiler limitations, Visual Studio 2002 and 2003 aren't able to\n" .. - "build this version of Premake. Use the free Visual Studio Express instead.", 0) -end - - - -- --- Use the --to=path option to control where the project files get generated. I use --- this to create project files for each supported toolset, each in their own folder, --- in preparation for deployment. +-- Earlier versions of Visual Studio limit static strings to 1K (IIRC) and choke on +-- the embedded scripts. I'll work around it if people complain. -- - newoption { - trigger = "to", - value = "path", - description = "Set the output location for the generated files" - } + if (_ACTION == "vs2002" or _ACTION == "vs2003") then + error( + "\nBecause of compiler limitations, Visual Studio 2002 and 2003 aren't able to\n" .. + "build this version of Premake. Use the free Visual Studio Express instead.", 0) + end @@ -40,7 +31,6 @@ end kind "ConsoleApp" flags { "No64BitChecks", "ExtraWarnings" } includedirs { "src/host/lua-5.1.4/src" } - location ( _OPTIONS["to"] ) files { @@ -92,65 +82,44 @@ end -- --- Embed the Lua scripts into src/host/scripts.c as static data buffers. --- I embed the actual scripts, rather than Lua bytecodes, because the --- bytecodes are not portable to different architectures. +-- Use the --to=path option to control where the project files get generated. I use +-- this to create project files for each supported toolset, each in their own folder, +-- in preparation for deployment. -- - local function embedfile(out, fname) - local f = io.open(fname) - local s = f:read("*a") - f:close() - - -- strip tabs - s = s:gsub("[\t]", "") - - -- strip any CRs - s = s:gsub("[\r]", "") - - -- strip out comments - s = s:gsub("\n%-%-[^\n]*", "") - - -- escape backslashes - s = s:gsub("\\", "\\\\") - - -- strip duplicate line feeds - s = s:gsub("\n+", "\n") - - -- strip out leading comments - s = s:gsub("^%-%-\n", "") - - -- escape line feeds - s = s:gsub("\n", "\\n") - - -- escape double quote marks - s = s:gsub("\"", "\\\"") - - out:write("\t\"") - out:write(s) - out:write("\",\n") - end + newoption { + trigger = "to", + value = "path", + description = "Set the output location for the generated files" + } + + +-- +-- Use the embed action to convert all of the Lua scripts into C strings, which +-- can then be built into the executable. Always embed the scripts before creating +-- a release build. +-- + + dofile("scripts/embed.lua") - premake.actions["embed"] = { + newaction { + trigger = "embed", description = "Embed scripts in scripts.c; required before release builds", - execute = function () - -- load the manifest of script files - scripts = dofile("src/_manifest.lua") - table.insert(scripts, "_premake_main.lua") - - -- open scripts.c and write the file header - local out = io.open("src/host/scripts.c", "w+b") - out:write("/* Premake's Lua scripts, as static data buffers for release mode builds */\n") - out:write("/* To regenerate this file, run: premake4 embed */ \n\n") - out:write("const char* builtin_scripts[] = {\n") - - for i,fn in ipairs(scripts) do - print(fn) - s = embedfile(out, "src/"..fn) - end - - out:write("\t0\n};\n"); - out:close() - end + execute = doembed + } + + +-- +-- Use the release action to prepare source and binary packages for a new release. +-- This action isn't complete yet; a release still requires some manual work. +-- + + + dofile("scripts/release.lua") + + newaction { + trigger = "release", + description = "Prepare a new release (incomplete)", + execute = dorelease } |