mirror of https://github.com/axmolengine/axmol.git
Merge pull request #11301 from samuele3hu/v3_lua_jit
Add luajit support for iOS 64bit devices and related test cases
This commit is contained in:
commit
50fa15c0cd
|
@ -5557,6 +5557,12 @@
|
|||
"$(inherited)",
|
||||
"$(SRCROOT)/../external/curl/prebuilt/ios",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto";
|
||||
|
@ -5578,6 +5584,12 @@
|
|||
"$(inherited)",
|
||||
"$(SRCROOT)/../external/curl/prebuilt/ios",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto";
|
||||
|
@ -5639,6 +5651,12 @@
|
|||
"$(SRCROOT)/../external/curl/prebuilt/ios",
|
||||
"/Users/cocos2d/MyWork/cocos2d-x-develop/external/curl/prebuilt/ios",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto";
|
||||
|
@ -5660,6 +5678,12 @@
|
|||
"$(SRCROOT)/../external/curl/prebuilt/ios",
|
||||
"/Users/cocos2d/MyWork/cocos2d-x-develop/external/curl/prebuilt/ios",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../cocos/scripting/lua-bindings/manual $(SRCROOT)/../cocos/scripting/lua-bindings/auto";
|
||||
|
|
|
@ -7088,6 +7088,56 @@ tolua_lerror:
|
|||
return 0;
|
||||
}
|
||||
|
||||
int lua_cocos2dx_Application_is64BitIOSDevice(lua_State* tolua_S)
|
||||
{
|
||||
int argc = 0;
|
||||
cocos2d::Application* cobj = nullptr;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isusertype(tolua_S,1,"cc.Application",0,&tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
|
||||
cobj = (cocos2d::Application*)tolua_tousertype(tolua_S,1,0);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!cobj)
|
||||
{
|
||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Application_is64BitIOSDevice'", nullptr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
argc = lua_gettop(tolua_S)-1;
|
||||
if (argc == 0)
|
||||
{
|
||||
bool is64BitIOSDevice = false;
|
||||
Application::Platform platform = cocos2d::Application::getInstance()->getTargetPlatform();
|
||||
if (Application::Platform::OS_IPHONE == platform || Application::Platform::OS_IPAD == platform)
|
||||
{
|
||||
#if defined(__arm64__)
|
||||
is64BitIOSDevice = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
tolua_pushboolean(tolua_S, is64BitIOSDevice);
|
||||
return 1;
|
||||
}
|
||||
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Application:is64BitIOSDevice",argc, 0);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Application_is64BitIOSDevice'.",&tolua_err);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void extendApplication(lua_State* tolua_S)
|
||||
{
|
||||
lua_pushstring(tolua_S, "cc.Application");
|
||||
|
@ -7095,6 +7145,7 @@ static void extendApplication(lua_State* tolua_S)
|
|||
if (lua_istable(tolua_S,-1))
|
||||
{
|
||||
tolua_function(tolua_S, "isIOS64bit", lua_cocos2dx_Application_isIOS64bit);
|
||||
tolua_function(tolua_S, "is64BitIOSDevice", lua_cocos2dx_Application_is64BitIOSDevice);
|
||||
}
|
||||
lua_pop(tolua_S, 1);
|
||||
}
|
||||
|
|
|
@ -203,7 +203,6 @@
|
|||
15C1C2EE19874CBE00A46ACC /* tolua_fix.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE7B418BC45C200215002 /* tolua_fix.h */; };
|
||||
15EFA1F61989E528000C57D3 /* lua_cocos2dx_experimental_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15622967197780DE009C9067 /* lua_cocos2dx_experimental_auto.cpp */; };
|
||||
15EFA1F71989E582000C57D3 /* lua_cocos2dx_experimental_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 15622968197780DE009C9067 /* lua_cocos2dx_experimental_auto.hpp */; };
|
||||
15EFA5D8198B2DAA000C57D3 /* liblua.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C0D9BAFA1974D30000EC35BB /* liblua.a */; };
|
||||
15EFA5D9198B2DAA000C57D3 /* libluajit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA1F318CD8F540087CE3A /* libluajit.a */; };
|
||||
15EFA617198B2E2B000C57D3 /* lua_cocos2dx_experimental_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15622967197780DE009C9067 /* lua_cocos2dx_experimental_auto.cpp */; };
|
||||
15EFA618198B2E2B000C57D3 /* lua_cocos2dx_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE74918BC45C200215002 /* lua_cocos2dx_auto.cpp */; };
|
||||
|
@ -452,7 +451,6 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
15EFA5D8198B2DAA000C57D3 /* liblua.a in Frameworks */,
|
||||
15EFA5D9198B2DAA000C57D3 /* libluajit.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -1310,12 +1308,7 @@
|
|||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/../../../../external/lua/luajit/prebuilt/ios",
|
||||
"$(SRCROOT)/../../../../external/lua/lua/prebuilt/ios",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator7.1]" = "-llua";
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator8.0]" = "-llua";
|
||||
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../../../../external/lua/luajit/prebuilt/ios";
|
||||
PRODUCT_NAME = "libluacocos2d iOS";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
@ -1337,12 +1330,7 @@
|
|||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/../../../../external/lua/luajit/prebuilt/ios",
|
||||
"$(SRCROOT)/../../../../external/lua/lua/prebuilt/ios",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator7.1]" = "-llua";
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator8.0]" = "-llua";
|
||||
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../../../../external/lua/luajit/prebuilt/ios";
|
||||
PRODUCT_NAME = "libluacocos2d iOS";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version":"v3-deps-35",
|
||||
"version":"v3-deps-36",
|
||||
"zip_file_size":"87419231",
|
||||
"repo_name":"cocos2d-x-3rd-party-libs-bin",
|
||||
"repo_parent":"https://github.com/cocos2d/",
|
||||
|
|
|
@ -871,6 +871,14 @@
|
|||
"$(_COCOS_LIB_IOS_BEGIN)",
|
||||
"$(_COCOS_LIB_IOS_END)",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"$(_COCOS_LIB_IOS_BEGIN)",
|
||||
"$(_COCOS_LIB_IOS_END)",
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../cocos2d-x/cocos/platform/ios $(_COCOS_HEADER_IOS_BEGIN) $(_COCOS_HEADER_IOS_END)";
|
||||
|
@ -902,6 +910,14 @@
|
|||
"$(_COCOS_LIB_IOS_BEGIN)",
|
||||
"$(_COCOS_LIB_IOS_END)",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*][arch=x86_64]" = (
|
||||
"$(_COCOS_LIB_IOS_BEGIN)",
|
||||
"$(_COCOS_LIB_IOS_END)",
|
||||
"-pagezero_size",
|
||||
10000,
|
||||
"-image_base",
|
||||
100000000,
|
||||
);
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../cocos2d-x/cocos/platform/ios $(_COCOS_HEADER_IOS_BEGIN) $(_COCOS_HEADER_IOS_END)";
|
||||
|
|
Binary file not shown.
|
@ -1,10 +1,16 @@
|
|||
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
|
||||
local isIOS64bit = cc.Application:getInstance():isIOS64bit()
|
||||
if cc.PLATFORM_OS_LINUX ~= targetPlatform and isIOS64bit ~= true then
|
||||
local is64BitIOSDevice = cc.Application:getInstance():is64BitIOSDevice()
|
||||
|
||||
if cc.PLATFORM_OS_LINUX ~= targetPlatform and is64BitIOSDevice ~= true then
|
||||
require("ByteCodeEncryptTest/ByteCodeTest")
|
||||
require("ByteCodeEncryptTest/ByteCodeAndEncryptTest")
|
||||
end
|
||||
|
||||
if (cc.PLATFORM_OS_IPHONE == targetPlatform or cc.PLATFORM_OS_IPAD == targetPlatform) and is64BitIOSDevice == true then
|
||||
require("ByteCodeEncryptTest/ByteCodeAndEncryptTest-arm64")
|
||||
require("ByteCodeEncryptTest/ByteCodeTest-arm64")
|
||||
end
|
||||
|
||||
local LINE_SPACE = 40
|
||||
local ItemTagBasic = 1000
|
||||
|
||||
|
@ -55,9 +61,13 @@ local function byteCodeEncryptMainLayer()
|
|||
item:registerScriptTapHandler(menuCallback)
|
||||
item:setPosition(size.width / 2, size.height - i * LINE_SPACE)
|
||||
menu:addChild(item, ItemTagBasic + i)
|
||||
if cc.PLATFORM_OS_LINUX == targetPlatform or isIOS64bit == true then
|
||||
if cc.PLATFORM_OS_LINUX == targetPlatform or is64BitIOSDevice == true then -- isIOS64bit
|
||||
item:setEnabled(false)
|
||||
end
|
||||
|
||||
if (cc.PLATFORM_OS_IPHONE == targetPlatform or cc.PLATFORM_OS_IPAD == targetPlatform) and is64BitIOSDevice == true then
|
||||
item:setEnabled(true)
|
||||
end
|
||||
end
|
||||
|
||||
layer:addChild(menu)
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue