我在我的 CMakeLists.txt 文件中使用带有 find_package(oboe REQUIRED CONFIG) 行的预制件在我的 android 项目中实现了双簧管
在 Android Studio 4.1.1 中,我可以无缝地使用双簧管。
但是,在我检查拉取请求并执行一系列测试的 Jenkins 实例中,我目前在其最新版本(版本 6858069)上使用独立的 cmdline-tools,而不是 android studio 提供的 sdk,它看起来像预制件不工作或不存在。我收到以下错误。
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':audioLib:externalNativeBuildCleanRelease'.
构建命令失败。使用参数 {-C /var/jenkins_home/workspace/PR-Checker/audioLib/.cxx/cmake/release/armeabi-v7a clean} ninja 执行进程 /opt/android_sdk/cmake/3.10.2.4988404/bin/ninja 时出错:进入目录`/var/jenkins_home/workspace/PR-Checker/audioLib/.cxx/cmake/release/armeabi-v7a' [0/1] Re-running CMake... -- 配置不完整,出现错误!另请参阅“/var/jenkins_home/workspace/PR-Checker/audioLib/.cxx/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log”。失败:build.ninja /opt/android_sdk/cmake/3.10.2.4988404/bin/cmake -H/var/jenkins_home/workspace/PR-Checker/audioLib -B/var/jenkins_home/workspace/PR-Checker/audioLib/.cxx /cmake/release/armeabi-v7a
CMake Error at CMakeLists.txt:192 (find_package):
Could not find a package configuration file provided by "oboe" with any of
the following names:
oboeConfig.cmake
oboe-config.cmake
Add the installation prefix of "oboe" to CMAKE_PREFIX_PATH or set
"oboe_DIR" to a directory containing one of the above files. If "oboe"
provides a separate development package or SDK, be sure it has been
installed.
ninja: error: rebuilding 'build.ninja': subcommand failed
我的 CMakeLists.txt 文件包含:
add_library( src/main/cpp/.../myoboe.cpp)
find_package (oboe REQUIRED CONFIG)
target_link_libraries(
audio-native
oboe::oboe
)
我怎样才能让它工作?
我试图避免将双簧管添加为本地子模块,因为我的项目有其他开发人员,我也想让他们变得简单。我可以选择在编译之前使用 Jenkins 中的脚本更改 CMakeLists.txt 文件,但这意味着每次在我的 gradle 文件中更改时,我都必须更新 Jenkins 中的双簧管版本,所以如果有办法避免这种情况那会很好。
更新: 我已经设法通过下载双簧管库并使用替换文本的脚本将其包含在 CMakeLists.txt 中来使其工作。但是,这种方法打算在以后每次更新库时进行双重维护。所以我仍然需要使用gradle实现方式来解决这个问题。