cocos2dx 用命令行进行编译的指令

cocos compile -p android -m release -s F:\cocosproj\antest --ap android-20

上面那条就是我常用的指令,这指令修改一下就成了你的指令了。

我本来是想用android-studio出个包的,但是这个编译指令只是编译eslicps的工程,不过没关系,编译出so文件后就可以手动搬到android-studio那里去出包了。

 

下面是 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

argavailable valuesampledescriptionnecessary
-h, --help--Show the help message and exitno
-s, --srcproject path./projects/MyLuaGameSpecify the project path. Default value is current directory.no
-p, --platformthe target platformandroidSpecify the target platform.yes
-m, --modethe compiling modereleaseSet the compile mode, should be debug or release. Default is debug.no
-j, --jobsnumber of jobs at once4Use N jobs at once. It's only take effect with target android & linux.no
-o, --output-dirabsolute/relative path./release/androidSpecify the output directory.no

Android Arguments

argavailable valuesampledescriptionnecessary
--apfolder name in ANDROID_SDK_ROOT/platformsandroid-16Specify the API-Level of android sdk. Console will auto select it if not specified.no
--ndk-modethe compiling mode of ndk-buildreleaseSet 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 -mno

Web Arguments

argavailable valuesampledescriptionnecessary
--source-map--Enable source-mapno
--advanced--Set the compilationLevel value as advanced for js compiling.no

iOS/Mac Arguments

argavailable valuesampledescriptionnecessary
-t, --targetTarget Name in XCode projectMyGame iOSSpecify the target name to compile.no

iOS Arguments

argavailable valuesampledescriptionnecessary
--sign-identitythe code sign identity"iPhone Distribution:xxxxxxxx"The code sign identity for iOS.It's required when the value of "-m, -mode" is release.

lua/js project Arguments

argavailable valuesampledescriptionnecessary
--compile-script{0,1}1Disable/Enable the compiling of lua/js script files. If not specified, the value is 1 when -m, --mode is release. Otherwise, the value is 0no

lua project Arguments

argavailable valuesampledescriptionnecessary
--lua-encrypt--Enable the encrypting of lua scripts. It's only take effect when --compile-script value is 1no
--lua-encrypt-keyany stringMyLuaKeySpecify the encrypt key for the encrypting of lua scripts. It's only take effect when --lua-encrypt is enabled. Default value is 2dxLua.no
--lua-encrypt-signany stringMyLuaSignSpecify the encrypt sign for the encrypting of lua scripts. It's only take effect when --lua-encrypt is enabled. Default value is XXTEA.no

Attentions

  • You can see the valid target platforms without specify -p, --platform first. The available platforms will be shown like this:available platforms
  • --compile-script will not take effect when target is linux or web
  • If --lua-encrypt is enabled, you should modify the C++ code frameworks/runtime-src/Classes/AppDelegate.cpp like 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
      Build MyLuaGame for 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"
      Build MyLuaGame for ios with release mode. Use the code sign identity "iPhone Distribution:xxxxxxxx".

 

转载于:https://www.cnblogs.com/jsfx/p/6544037.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值