当前位置: 移动技术网 > IT编程>移动开发>Android > Build Assimp library for Android

Build Assimp library for Android

2018年11月05日  | 移动技术网IT编程  | 我要评论

盘锦采购,兼职女QQ,白夜追凶全集

build assimp library for android

首先各路教程中有推荐使用 ndk 或者 standalone toolchain 编译的,根据我的理解,这两种方式都是可以的,如果能直接使用 ndk 编译成功的话,就没有必要使用 standalone toolchain 了。

ndk build assmip library

cmake

cmake -dcmake_toolchain_file=${cmake_toolchain} -dcmake_system_name=android -dcmake_android_ndk=${ndk_path} \
-dandroid_force_arm_build=true  -dandroid_stl=c++_shared -dandroid_toolchain=clang \
-dandroid_native_api_level=21 -dcmake_android_arch_abi=arm64-v8a \
-dcmake_install_prefix=/assimp -dcmake_build_type=release \
-dassimp_build_tests=off -gninja ..

其中:

ndk_path=${android_home}/ndk-bundle/

cmake_toolchain=${android_home}/ndk-bundle/build/cmake/android.toolchain.cmake

注意其中的 assimp_build_tests 一定要设置关闭,否则编译失败,报一个 pthread 的链接错误。

cmake 执行后会有一些 warnning 可以不用解决。

-- could not find rt (missing: rt_library) 
info rt-extension not found. gltf import/export will be built without open3dgc-compression.

make

然后执行 ninja, 此处遇到问题是 error: unknown type name 'z_crc_t' 直接找到对应的源文件,添加声明即可。

typedef unsigned long z_crc_t;

use lib

将动态库和头文件加入工程即可使用,记得将 cmake build 目录下的 include/assimp/config.h 拷贝到所用的工程的 include 目录下。

参考

cmake

windows环境下编译assimp库生成android可用的.so文件

android compilation on windows

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网