在 Android 中与 Conan.io 一起使用共享库
Using shared library with Conan.io within Android
我有一个预构建的共享库(架构 ARM),我将其导出为柯南包:
conan export-pkg .. ext/stable --force -pr android_19_arm_clang
接下来我想在我的 Android 项目中使用这个库。我有这样的 Conan 和 CMake 设置。
conanfile.txt:
[requires]
LibraryName/0.1@ext/stable
CMakeLists.txt
...
conan_basic_setup(NO_OUTPUT_DIRS)
...
target_link_libraries( # Specifies the target library.
myOwnAndroidLib-lib
android
${CONAN_LIBS}
)
...
由于预建库是一个“.so”库,我必须将它放入我的 Android 项目的 jniLibs 文件夹中。 conan/Android 文档中缺少此部分。我如何检测 conan 以将 *.so 文件放入 jniLibs 文件夹中?
谢谢
如果要在构建时将 pre-built 包复制到特定文件夹,您应该使用功能 imports
:
https://docs.conan.io/en/latest/using_packages/conanfile_txt.html#imports
https://docs.conan.io/en/latest/reference/conanfile_txt.html#imports
我有一个预构建的共享库(架构 ARM),我将其导出为柯南包:
conan export-pkg .. ext/stable --force -pr android_19_arm_clang
接下来我想在我的 Android 项目中使用这个库。我有这样的 Conan 和 CMake 设置。
conanfile.txt:
[requires]
LibraryName/0.1@ext/stable
CMakeLists.txt
...
conan_basic_setup(NO_OUTPUT_DIRS)
...
target_link_libraries( # Specifies the target library.
myOwnAndroidLib-lib
android
${CONAN_LIBS}
)
...
由于预建库是一个“.so”库,我必须将它放入我的 Android 项目的 jniLibs 文件夹中。 conan/Android 文档中缺少此部分。我如何检测 conan 以将 *.so 文件放入 jniLibs 文件夹中?
谢谢
如果要在构建时将 pre-built 包复制到特定文件夹,您应该使用功能 imports
:
https://docs.conan.io/en/latest/using_packages/conanfile_txt.html#imports
https://docs.conan.io/en/latest/reference/conanfile_txt.html#imports