From 826fe4cf31d2a3ea267248808419a0ddee02c5f7 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 2 Apr 2015 10:07:31 +0800 Subject: [PATCH 1/4] Update the Xcode project setting for luajit --- build/cocos2d_tests.xcodeproj/project.pbxproj | 12 ++++++++++++ .../project.pbxproj | 16 ++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 19cd2ecf4e..7a6a1c0663 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -5617,6 +5617,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"; @@ -5638,6 +5644,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"; diff --git a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj index 959abc3bc2..d552c61e9d 100644 --- a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj +++ b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj @@ -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"; From a64e90d469866ae963187f6d784bec3e796c4716 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Mon, 6 Apr 2015 22:41:34 +0800 Subject: [PATCH 2/4] Update the related project setting for Luajit and related test cases --- build/cocos2d_tests.xcodeproj/project.pbxproj | 12 +++++ .../manual/cocos2d/lua_cocos2dx_manual.cpp | 51 ++++++++++++++++++ .../HelloLua.xcodeproj/project.pbxproj | 16 ++++++ .../ByteCodeAndEncryptTest_arm64.luac | Bin 0 -> 1169 bytes .../ByteCodeEncryptTest.lua | 16 ++++-- .../ByteCodeTest_arm64.luac | Bin 0 -> 1120 bytes 6 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeAndEncryptTest_arm64.luac create mode 100644 tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeTest_arm64.luac diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index 7a6a1c0663..064d0a1bae 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -5535,6 +5535,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"; @@ -5556,6 +5562,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"; diff --git a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp index 14327c67c9..93a5c0c8a1 100644 --- a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp @@ -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); } diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj index 054ed3ee3b..318dcdeb93 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj +++ b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj @@ -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)"; diff --git a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeAndEncryptTest_arm64.luac b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeAndEncryptTest_arm64.luac new file mode 100644 index 0000000000000000000000000000000000000000..c3acf48a2028a52d5bd37c50c8fbeb830d91d396 GIT binary patch literal 1169 zcmZuxO>fjp47O)7lg(_>Zo@|@Ez*ihwG~`iDJXhR8=&H&po&(&4W-G@%=>PWRWcRt zA`Z)yU&TKI&z5$JROR5Y{n(G~jA!%U6;s~;1br(B0Azqnk^G3kJVAsM8OGd6ju|p` zarQ9w2urrtfUwr;=_D`oQK4%+IMw!L-Pyb@bo9)$y0A^_7sXaKv-)XM>gRRQ&ZhQQ zclJ$g>hC_n03L`R=;%{Q7c(armBLtpbS9ch+GPo1QBLBpOtRQxBz?9mdXUHfM*bFL zOt4sxohz0|!pXke=>hBnRJ!Ca=7<;m@XDX|BHZX_`@rI8W3-QL8?}8L!nyY zDBdGpipxBXd)^u(f@~rdu`ft6kqMg9qQ6@*?n&zNw%iWxxE}Fu`&~H-?%iN#gkN`d z76%mXhccmBQ`J{Vcn{*05YliX%tFS}@P4=+@-T_Wz8XOqZA4i__GmM@8+lQts6U_j zTjbf2vGQEcq*JZ_s)&`mribE^XA}aABAU-tyqg>Ktptqviefz61(+Yuy?D^-Q`1@9 z9u=*ji6=lQ?Jsz*dm z`gNqfxa7Kw^0ItdnMv8Nw5v>gF{P~>?P1dyYnob4Z;>{xi>hf48&lgs_bGR^9p<*$ zbX!x<){N`&+Tz4Tt8=SA7+W15@2i9SL{C;}@jjT^^>*V9_Ag=xJkxF=aXz2_;@)Ao z`xZc=2mPBCFm@LmIXrgz?jej3(ftJYx$Nvu;>G$?;(s{#Ify;l=RJBto*)DF@7z=I TusyFYAA)5|`!rPd9#Ft<4Jp$6 literal 0 HcmV?d00001 diff --git a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua index db3c1f1ecb..79a34ba35b 100644 --- a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua +++ b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua @@ -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) diff --git a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeTest_arm64.luac b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeTest_arm64.luac new file mode 100644 index 0000000000000000000000000000000000000000..28674b2d02f388b81ef9de6668545931df5a6072 GIT binary patch literal 1120 zcmZux-%r#)5T4oXZm)YS97XvdnA{sV5+8)5rjHaQqCkic@y(RpN>`8e(k{U>KHRf^ zm4Ao-jLsecnvi>#-I;IZo0;3MYX@(b`VJuIH|Q%G`F<(Er?k=iNi9yRFC~kQMA;2J_{oLidz0urCz@V!r$HOgv=>ffqr;WZat<}v* z(HMG2`S^8S4M)0>6Zy5*n2XY8wYBwS@4acw`AEN`HyC7j@uk;lyH{8C#C+3gr!o2H z)^n6!>V-pHUF}Hc-z_KW&*Oy^<$eA2h2?vJkW&&EdiaJXBV z(Xd-;N3O2T(3Y<9aorkg>Pn6m>9$i9W!)Utrn0^EWA5mWb6YMrVH6|`r--;{bZ+&T zvE}LMo;t|S^=O_Hb!IBp^n>E+-sBK?qMg!kI-UOJ-tlnj2tc9--G`JFyBCZco;e|V z2s?=AwhKS+=lNTBrfVwvoKu{G*e0QF)3@OTGH`#2`v$BuSJkb;_h?6M7=rx)gf_s> literal 0 HcmV?d00001 From fd554c07da7d6954d06651343fde2654b759f42c Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Tue, 7 Apr 2015 09:31:04 +0800 Subject: [PATCH 3/4] Rename the file names --- ...arm64.luac => ByteCodeAndEncryptTest-arm64.luac} | Bin .../src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua | 4 ++-- ...eCodeTest_arm64.luac => ByteCodeTest-arm64.luac} | Bin 3 files changed, 2 insertions(+), 2 deletions(-) rename tests/lua-tests/src/ByteCodeEncryptTest/{ByteCodeAndEncryptTest_arm64.luac => ByteCodeAndEncryptTest-arm64.luac} (100%) rename tests/lua-tests/src/ByteCodeEncryptTest/{ByteCodeTest_arm64.luac => ByteCodeTest-arm64.luac} (100%) diff --git a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeAndEncryptTest_arm64.luac b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeAndEncryptTest-arm64.luac similarity index 100% rename from tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeAndEncryptTest_arm64.luac rename to tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeAndEncryptTest-arm64.luac diff --git a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua index 79a34ba35b..11ef1db1a7 100644 --- a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua +++ b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeEncryptTest.lua @@ -7,8 +7,8 @@ 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") +require("ByteCodeEncryptTest/ByteCodeAndEncryptTest-arm64") +require("ByteCodeEncryptTest/ByteCodeTest-arm64") end local LINE_SPACE = 40 diff --git a/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeTest_arm64.luac b/tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeTest-arm64.luac similarity index 100% rename from tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeTest_arm64.luac rename to tests/lua-tests/src/ByteCodeEncryptTest/ByteCodeTest-arm64.luac From af46ec5b575fa68486fd01276abaa982693aae10 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Tue, 7 Apr 2015 10:00:37 +0800 Subject: [PATCH 4/4] Update config.son for the version of external dependence --- external/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/config.json b/external/config.json index a3658712fb..333ad3e1cc 100644 --- a/external/config.json +++ b/external/config.json @@ -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/",