Merge branch 'switch-bytecode-flag' into release-alpha8
This commit is contained in:
commit
0c655706eb
@ -74,8 +74,8 @@
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "no-bytecode",
|
||||
description = "Don't embed bytecode, but instead use the stripped souce code."
|
||||
trigger = "bytecode",
|
||||
description = "Embed scripts as bytecode instead of stripped souce code"
|
||||
}
|
||||
|
||||
--
|
||||
|
@ -1,8 +1,8 @@
|
||||
--
|
||||
-- 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, which causes
|
||||
-- issues in Mac OS X Universal builds.
|
||||
-- Embeds minified versions of the actual scripts by default, rather than
|
||||
-- bytecode, as bytecodes are not portable to different architectures. Use
|
||||
-- the `--bytecode` flag to override.
|
||||
--
|
||||
|
||||
local scriptCount = 0
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
local function addScript(result, filename, name, data)
|
||||
if not data then
|
||||
if not _OPTIONS["no-bytecode"] then
|
||||
if _OPTIONS["bytecode"] then
|
||||
verbosef("Compiling... " .. filename)
|
||||
local output = path.replaceextension(filename, ".luac")
|
||||
local res, err = os.compile(filename, output);
|
||||
|
@ -111,7 +111,11 @@
|
||||
--
|
||||
|
||||
print("Updating embedded scripts...")
|
||||
z = execQuiet("premake5 embed")
|
||||
if kind == "source" then
|
||||
z = execQuiet("premake5 embed")
|
||||
else
|
||||
z = execQuiet("premake5 --bytecode embed")
|
||||
end
|
||||
if z ~= 0 then
|
||||
error("failed to update the embedded scripts", 0)
|
||||
end
|
||||
|
@ -118,6 +118,8 @@
|
||||
|
||||
|
||||
function p.project.bake(self)
|
||||
verbosef(' Baking %s...', self.name)
|
||||
|
||||
self.solution = self.workspace
|
||||
local wks = self.workspace
|
||||
|
||||
|
@ -19,12 +19,18 @@ int os_isfile(lua_State* L)
|
||||
int do_isfile(const char* filename)
|
||||
{
|
||||
struct stat buf;
|
||||
#if PLATFORM_WINDOWS
|
||||
DWORD attrib = GetFileAttributesA(filename);
|
||||
if (attrib != INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
return (attrib & FILE_ATTRIBUTE_DIRECTORY) == 0;
|
||||
}
|
||||
#else
|
||||
if (stat(filename, &buf) == 0)
|
||||
{
|
||||
return ((buf.st_mode & S_IFDIR) == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user