cocos compile

前端之家收集整理的这篇文章主要介绍了cocos compile前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

转自 : http://blog.csdn.net/wanglang3081/article/details/39692459

cocos compile

Overview

Build an existed project.

Usage

usage: cocos compile [-h] [-s SRC_DIR] [-q] [-p PLATFORM] [-m MODE] [-j JOBS]
                     [--ap ANDROID_PLATFORM] [--ndk-mode NDK_MODE]
                     [--source-map] [--sign-identity SIGN_ID] [--no-res]
                     [--compile-script {0,1}] [--lua-encrypt]
                     [--lua-encrypt-key LUA_ENCRYPT_KEY]
                     [--lua-encrypt-sign LUA_ENCRYPT_SIGN]

Available Arguments

Common Arguments

arg available value sample description necessary
-h,--help@H_502_74@ -@H_502_74@ -@H_502_74@ Show the help message and exit@H_502_74@ no@H_502_74@
-s,--src@H_502_74@ project path@H_502_74@ ./projects/MyLuaGame@H_502_74@ Specify the project path. Default value is current directory.@H_502_74@ no@H_502_74@
-p,--platform@H_502_74@ the target platform@H_502_74@ android@H_502_74@ Specify the target platform.@H_502_74@ yes@H_502_74@
-m,--mode@H_502_74@ the compiling mode@H_502_74@ release@H_502_74@ Set the compile mode,should bedebugorrelease. Default is debug.@H_502_74@ no@H_502_74@
-j,--jobs@H_502_74@ number of jobs at once@H_502_74@ 4@H_502_74@ Use N jobs at once. It's only take effect with targetandroid&linux.@H_502_74@ no@H_502_74@
-o,--output-dir@H_502_74@ absolute/relative path@H_502_74@ ./release/android@H_502_74@ Specify the output directory.@H_502_74@ no@H_502_74@

Android Arguments

arg available value sample description necessary
--ap@H_502_74@ folder name inANDROID_SDK_ROOT/platforms@H_502_74@ android-16@H_502_74@ Specify the API-Level of android sdk. Console will auto select it if not specified.@H_502_74@ no@H_502_74@
--ndk-mode@H_502_74@ the compiling mode of ndk-build@H_502_74@ release@H_502_74@ Set the compile mode of ndk-build,should be one of {debug,release,none},native code will not be compiled when the value is none. Default is same value with-m@H_502_74@ no@H_502_74@

Web Arguments

arg available value sample description necessary
--source-map@H_502_74@ -@H_502_74@ -@H_502_74@ Enable source-map@H_502_74@ no@H_502_74@
--advanced@H_502_74@ -@H_502_74@ -@H_502_74@ Set thecompilationLevelvalue asadvancedfor js compiling.@H_502_74@ no@H_502_74@

iOS/Mac Arguments

arg available value sample description necessary
-t,--target@H_502_74@ Target Name in XCode project@H_502_74@ MyGame iOS@H_502_74@ Specify the target name to compile.@H_502_74@ no@H_502_74@

iOS Arguments

arg available value sample description necessary
--sign-identity@H_502_74@ the code sign identity@H_502_74@ "iPhone Distribution:xxxxxxxx"@H_502_74@ The code sign identity for iOS.@H_502_74@ It's required when the value of "-m,-mode" is release.@H_502_74@

lua/js project Arguments

arg available value sample description necessary
--compile-script@H_502_74@ {0,1}@H_502_74@ 1@H_502_74@ Disable/Enable the compiling of lua/js script files. If not specified,the value is1when-m,--modeisrelease. Otherwise,the value is0@H_502_74@ no@H_502_74@

lua project Arguments

arg available value sample description necessary
--lua-encrypt@H_502_74@ -@H_502_74@ -@H_502_74@ Enable the encrypting of lua scripts. It's only take effect when--compile-scriptvalue is1@H_502_74@ no@H_502_74@
--lua-encrypt-key@H_502_74@ any string@H_502_74@ MyLuaKey@H_502_74@ Specify the encrypt key for the encrypting of lua scripts. It's only take effect when--lua-encryptis enabled. Default value is2dxLua.@H_502_74@ no@H_502_74@
--lua-encrypt-sign@H_502_74@ any string@H_502_74@ MyLuaSign@H_502_74@ Specify the encrypt sign for the encrypting of lua scripts. It's only take effect when--lua-encryptis enabled. Default value isXXTEA.@H_502_74@ no@H_502_74@

Attentions

  • You can see the valid target platforms without specify-p,--platformfirst. The available platforms will be shown like this:
  • --compile-scriptwill not take effect when target islinuxorweb
  • If--lua-encryptis enabled,you should modify the C++ codeframeworks/runtime-src/Classes/AppDelegate.cpplike this:

    bool AppDelegate::applicationDidFinishLaunching()
    {
        ...
    
        auto engine = LuaEngine::getInstance();
        ScriptEngineManager::getInstance()->setScriptEngine(engine);
    
        // add these two lines 
        // "MyLuaKey" is the string specified by "--lua-encrypt-key"
        // "MyLuaSign" is the string specified by "--lua-encrypt-sign"
        LuaStack* stack = engine->getLuaStack();
        stack->setXXTEAKeyAndSign("MyLuaKey",strlen("MyLuaKey"),"MyLuaSign",strlen("MyLuaSign"));
    
        ...
    }
    

Samples

  • cocos compile -h. Show the help message.
  • cocos compile -s ./projects/MyLuaGame -p android --ndk-mode release --compile-script 1 --lua-encrypt
    BuildMyLuaGamefor android with ndk-build is release. And compile lua script files with encrypting.
  • cocos compile -s ./projects/MyLuaGame -p ios -m release --sign-identity "iPhone Distribution:xxxxxxxx"
    BuildMyLuaGamefor ios with release mode. Use the code sign identity"iPhone Distribution:xxxxxxxx".

猜你在找的Cocos2d-x相关文章