我有一个问题的ASSIMP的Android编译。
我使用Android NDK (和JNI)在JAVA活动中调用我的C++代码。
Gradle调用我的CMakelist来编译我的共享库。在这个CMakelist中,我的目标是我的.cpp文件和我的库子目录(assimp和glm)。assimp构建抛出一个错误:“error: cannot find -lpthread”
我的问题是:我如何编译ASSIMP,如何在我的Android NDK项目中包含assimp?
发布于 2018-04-09 03:38:32
对于我的样例项目,我使用了下面的Assimp-gradle buid文件,它对我来说工作得很好。一个重要的注意事项:禁用unittest内容(选项ASSIMP_BUILD_TESTS必须设置为off ),因为在assimp中有一个关于pthread对gtest的支持的bug。
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.app.kkulling_solutions.assimpviewer"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
externalNativeBuild {
cmake {
arguments '-DASSIMP_BUILD_ZLIB=ON -DASSIMP_BUILD_TESTS=OFF'
cppFlags '-fexceptions -frtti -std=c++11'
}
}
//-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path 'src/main/cpp/JNI/CMakeLists.txt'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
}如果你有任何其他问题,请告诉我!
https://stackoverflow.com/questions/49666372
复制相似问题