用 NDK 编译 Platinum

版本:Platinum-a4ab7c

(1)NDK用 android-ndk-r6(用r7 build失败!根据scons脚本中的一些路径推断,至少应该是r5)

(2)指定 target

(2.1)指定命令行选项执行 scons target=arm-android-linux build_config=Release

(2.2)修改 Platinum/Build/Boot.scons 文件中 options.AddVariables(...) 直接写入上述2个选项为默认值,则执行 scons 命令时不必指定选项

options = Variables()
options.AddVariables(
EnumVariable('target', 'build target', 'arm-android-linux', allowed_values=['arm-android-linux']),
BoolVariable('stop_on_warning', 'Stop the build on warnings', False),
ListVariable('build_config', 'build configurations', 'Release', names=['Debug', 'Release'])
)

(3)修改 Platinum/Build/Targets/arm-android-linux/Config.scons

(3.1)写死 NDK 路径

ANDROID_NDK_ROOT='/home/toor/android-ndk-r6'
##ANDROID_NDK_ROOT=os.getenv('ANDROID_NDK_ROOT')
##if not ANDROID_NDK_ROOT:
## raise Exception('ANDROID_NDK_ROOT environment variable not set')

(3.2)写死 Android API

##if env.has_key('target_variant') and env['target_variant']:
## ANDROID_PLATFORM=env['target_variant']
##else:
## ANDROID_PLATFORM='android-9'
ANDROID_PLATFORM='android-5'

(4)编译所得库和示例程序在 Platinum/Build/Targets/arm-android-linux/Release

 

其他:

(1)scons -c 相当于 make clean

(2)scons 需要 python 2.4 或以上

动态链接到c++运行时库:

/home/toor/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-objdump -x /home/toor/Platinum-a4ab7c-android/Platinum/Build/Targets/arm-android-linux/Release/libPlatinumJNI.so | grep NEEDED
NEEDED libc.so
NEEDED libstdc++.so
NEEDED libm.so
NEEDED libdl.so
NEEDED liblog.so

原文链接: https://www.cnblogs.com/bpasser/archive/2011/12/07/2278926.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    用 NDK 编译 Platinum

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/38043

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月8日 下午2:41
下一篇 2023年2月8日 下午2:42

相关推荐