博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cocos2dx2.X 编译时,传递编译选项
阅读量:4214 次
发布时间:2019-05-26

本文共 2945 字,大约阅读时间需要 9 分钟。

1、
'ndk-build' OverviewI. Usage:The Android NDK r4 introduced a new tiny shell script, named 'ndk-build', to simplify building machine code.The script is located at the top-level directory of the NDK, and shall be invoked from the command-line when in your application project directory, or any of its sub-directories. For example:    cd $PROJECT    $NDK/ndk-buildWhere $NDK points to your NDK installation path. You can also create an alias or add $NDK to your PATH to avoid typing it every time.II. Options:All parameters to 'ndk-build' are passed directly to the underlying GNU Make command that runs the NDK build scripts. Notable uses include:    ndk-build                  --> rebuild required machine code.    ndk-build clean            --> clean all generated binaries.    ndk-build NDK_DEBUG=1      --> generate debuggable native code.    ndk-build V=1              --> launch build, displaying build commands.    ndk-build -B               --> force a complete rebuild.    ndk-build -B V=1           --> force a complete rebuild and display build                                  commands.    ndk-build NDK_LOG=1        --> display internal NDK log messages                                  (used for debugging the NDK itself).    ndk-build NDK_DEBUG=1      --> force a debuggable build (see below)    ndk-build NDK_DEBUG=0      --> force a release build (see below)    ndk-build NDK_HOST_32BIT=1 --> Always use toolchain in 32-bit (see below)    ndk-build NDK_APPLICATION_MK=
--> rebuild, using a specific Application.mk pointed to by the NDK_APPLICATION_MK command-line variable. ndk-build -C
--> build the native code for the project path located at
. Useful if you don't want to 'cd' to it in your terminal.

(摘自NDK说明文档NDK-BUILD.html)

2、

我们看到上面ndk-build有很多可选参数,那在cocos2dx中,这些参数使用的呢?

我们都知道在2.X版本中,我们都是通过build_native.sh脚本,编译cocos2dx项目,
那么我们怎么通过build_native.sh脚本使用上面的参数呢?
下面是从build_native.sh脚本中摘出来的:

if [[ "$buildexternalsfromsource" ]]; then    echo "Building external dependencies from source"    "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \        "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DXTALKINGDATA_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source"else    echo "Using prebuilt externals"    "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \        "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DXTALKINGDATA_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"fi
看下这部分:

"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \        "NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DXTALKINGDATA_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"

解释:
$NDK_ROOT -- NDK工具的根目录,在这里有ndk-build执行程序
-C "$APP_ANDROID_ROOT"  -- 编译的工程,参看第一部分
$*  -- shell脚本,传递给脚本或函数的所有参数。
总结:所以如果我们需要使用上面ndk-build命令的可选参数,直接在执行build_native.sh脚本时,添加在后面即可。
例子:
$ ./build_native.sh clean

转载地址:http://utsmi.baihongyu.com/

你可能感兴趣的文章
CSS之浮动(一)
查看>>
CSS之浮动(二)
查看>>
AtomicInteger源码解析
查看>>
CopyOnWriteArraySet源码学习
查看>>
Openfiler 配置 NFS 示例
查看>>
Oracle 11.2.0.1 RAC GRID 无法启动 : Oracle High Availability Services startup failed
查看>>
Oracle 18c 单实例安装手册 详细截图版
查看>>
Oracle Linux 6.1 + Oracle 11.2.0.1 RAC + RAW 安装文档
查看>>
Oracle 11g 新特性 -- Online Patching (Hot Patching 热补丁)说明
查看>>
Oracle 11g 新特性 -- ASM 增强 说明
查看>>
Oracle 11g 新特性 -- Database Replay (重演) 说明
查看>>
Oracle 11g 新特性 -- 自动诊断资料档案库(ADR) 说明
查看>>
Oracle 11g 新特性 -- RMAN Data Recovery Advisor(DRA) 说明
查看>>
CSDN博客之星 投票说明
查看>>
Oracle wallet 配置 说明
查看>>
Oracle smon_scn_time 表 说明
查看>>
VBox fdisk 不显示 添加的硬盘 解决方法
查看>>
Secure CRT 自动记录日志 配置 小记
查看>>
RMAN RAC 到 单实例 duplicate 自动分配通道 触发 ORA-19505 错误
查看>>
mysql 随机分页的优化
查看>>