用NDK及scons编译Platinum

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

版本:Platinum-f4d639, android-ndk-r6

拿到Platinum和ndk的源码后,需要针对Config.scons,Build.scons, Boot.scons等文件做一些修改&补充工作,才能开展开发工作。

(1)配置环境变量(ndk路径)

     export ANDROID_NDK_ROOT=/home/bao/dlna/android-ndk-r6b

     ANDROID_NDK_ROOT这个环境变量在 Build/Target/arm-android-linux/Config.scons配置文件中会用到。

(2) 在ndk根目录下添加一个文件$ ANDROID_NDK_ROOT/out/config.mk,文件内容如下:

     HOST_TAG := linux-x86

    这个文件是为了对应Config.scons中的内容:

[html] view plain copy
  1. ### figure out the host config  
  2. try:  
  3.     host_config = open(ANRDOID_NDK_OUT+'/host/config.mk')  
  4.     HOST_CONFIG={}  
  5.     for line in host_config.readlines():  
  6.         pair = re.split('\s+:=\s+', line);  
  7.         if len(pair) == 2:  
  8.             HOST_CONFIG[pair[0]] = pair[1].rstrip()  
  9.               
  10.     host_config.close()  
  11. except:  
  12.     platform_map = {'linux2':'linux-x86', 'darwin':'darwin-x86', 'cygwin':'windows'}  
  13.     if sys.platform not in platform_map:  
  14.         raise Exception('Unrecognized host platform')  
  15.     HOST_CONFIG={'HOST_TAG':platform_map[sys.platform]} 

(3)apt-get install安装scons后,Build/Boot.scons 文件中修改target:

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']))
          然后到Platinum根目录下执行scons,即可开始编译工作。

(4)查看生成的库和文件

        根据上一步的配置编译之后,生成的库和文件在目录Build/Target/arm-android-linux/Release下。

          今后在开发工作中,项目目录的配置选项都在Build/Build.scons文件中进行。

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq_43668086/article/details/84070730