gpt4 book ai didi

android - CMake 脚本忽略 CMAKE_ANDROID_ARCH_ABI,始终构建 armeabi

转载 作者:行者123 更新时间:2023-11-29 01:06:34 26 4
gpt4 key购买 nike

我正在使用适用于 Android 的 CMake ExternalLibrary 选项构建外部库 taglib。我已将 CMAKE_ANDROID_ARCH_ABI 设置为 x86 但构建始终会生成 armeabi 共享库。为什么?

这是 fragment :

include(ExternalProject)

# taglib configuration
set(TAGLIB_VERSION 1.11.1)
set(TAGLIB_CHECKSUM "8624219ba50c77f17889af15e1ca5f7d")

ExternalProject_Add(
taglib
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/taglib-${TAGLIB_VERSION}.zip
URL_MD5 ${TAGLIB_CHECKSUM}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
${CMAKE_CURRENT_BINARY_DIR}/taglib/src/taglib
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_API=${ANDROID_NATIVE_API_LEVEL}
-DCMAKE_ANDROID_ARCH_ABI=${ANDROID_ABI}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-GUnix\ Makefiles
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-DBUILD_SHARED_LIBS=ON
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/build/taglib/${ANDROID_ABI}

PREFIX taglib
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
&&
${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/build/taglib/${ANDROID_ABI}/lib/libtag.so
${CMAKE_SUPERBUILD_OUT}/${ANDROID_ABI}/libtag.so
)

add_library(tag SHARED IMPORTED)
set_target_properties(tag PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/build/taglib/${ANDROID_ABI}/lib/libtag.so)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/build/taglib/${ANDROID_ABI}/include)

最佳答案

Android NDK 工具链文件不使用 MAKE_ANDROID_ARCH_ABI,还必须在 ExternalProject_Add 调用中指定 ANDROID_ABI 标志。然后它会构建适当的拱门。

关于android - CMake 脚本忽略 CMAKE_ANDROID_ARCH_ABI,始终构建 armeabi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46567127/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com