这可能很简单。
我有一个使用 NDK 的 Android 项目。我想将opus源代码包含在本机代码中。我尝试使用 CMake 的ExternalProject_Add 属性,但我的本机代码仍然无法从 Opus 库导入标头并且无法构建。
以下是我的ExternalProject_Add 定义:
ExternalProject_Add(project_opus
URL https://archive.mozilla.org/pub/opus/opus-1.2.1.tar.gz
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
BUILD_COMMAND make
INSTALL_COMMAND make install
)
ExternalProject_Get_Property(project_opus install_dir)
include_directories(${install_dir}/include)
add_library(opus SHARED IMPORTED)
add_dependencies(opus project_opus)
target_link_libraries( # Specifies the target library.
native-lib
# Links the target library to the log library
# included in the NDK.
${log-lib} opus oboe OpenSLES)
Run Code Online (Sandbox Code Playgroud)