android11 kotlin 关于多个c++源路径CMakeLists.txt文件编写

复制代码
CMakeLists.txt文件如下,应该配合文件目录进行设置

cmake_minimum_required(VERSION 3.22.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -std=c++17 -fvisibility=hidden")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
link_directories(${CMAKE_CURRENT_LIST_DIR}/..)                                         #不同点   # 指定库文件搜索路径

# Increment this number when adding files to OboeTester => 104
# The change in this file will help Android Studio resync
# and generate new build files that reference the new code.
file(GLOB_RECURSE app_native_sources    src/main/cpp/*)
file(GLOB_RECURSE app_user_sources      src/main/cxc/*)
file(GLOB_RECURSE app_user_oboe_sources src/main/oboecpp/*)

### Name must match loadLibrary() call in MainActivity.java
add_library(oboetester
        SHARED
        ${app_native_sources}
        ${app_user_sources}
        ${app_user_oboe_sources}
        )

# Set the path to the Oboe library directory  /../..
set (OBOE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)

# Add the Oboe library as a subproject. Since Oboe is an out-of-tree source library we must also
# specify a binary directory
add_subdirectory(${OBOE_DIR} ./oboe-bin)

# Specify the path to the Oboe header files and the source.                              #不同点  是一个全局命令,这里只适用oboe目标,不是整个项目或其它c++
include_directories(
        ${OBOE_DIR}/src
        ${OBOE_DIR}/include
        ${OBOE_DIR}/debug-utils
)
### END OBOE INCLUDE SECTION ###

# link to oboe
target_link_libraries(oboetester log oboe atomic aaudio)

文件目录如下图所示

相关推荐
小七在进步2 分钟前
C++入门(1)
java·jvm·c++
晴天的雨.9924 分钟前
[C++算法]快乐数
数据结构·c++·算法
Wang's Blog9 分钟前
Java框架快速入门: Spring Security+OAuth2之定制登录页
java·开发语言·spring
imgsq9 分钟前
MapLibre GL JS v6 正式发布:v5 之后八个月的第一个大版本(编译)
开发语言·javascript·ecmascript
统计学小王子10 分钟前
数学建模国赛倒计时 2 天 ——《缺失值处理一(R语言)》
开发语言·数学建模·r语言
影视飓风TIM10 分钟前
C++11 核心新特性完整梳理
数据结构·c++·算法
艾莉丝努力练剑11 分钟前
【AI大模型接入SDK】Ollama本地大语言模型部署
c++·人工智能·语言模型·自然语言处理·面试
晴天的雨.99211 分钟前
[C++]算法双指针 复写0
数据结构·c++·算法
嘻哈baby19 分钟前
大量消息在 MQ 里长时间积压,该如何解决?
开发语言
qq_5703985731 分钟前
Three.js基础使用-案例
开发语言·javascript·ecmascript