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)

文件目录如下图所示

相关推荐
weixin_446260851 小时前
快速构建网站的利器——Symfony PHP框架
开发语言·php·symfony
王夏奇1 小时前
C语言中#pragma的用法
c语言·开发语言
charlie1145141911 小时前
理解C++20的革命特性——协程支持2:编写简单的协程调度器
c++·学习·算法·设计模式·c++20·协程·调度器
李宥小哥1 小时前
C#基础10-结构体和枚举
java·开发语言·c#
带娃的IT创业者1 小时前
第4集:配置管理的艺术:环境变量、多环境配置与安全实践
开发语言·python·安全·项目配置·开发基础
省四收割者2 小时前
Go语言入门(20)-nil
开发语言·vscode·golang
19岁开始学习2 小时前
Go语言中的Zap日志库
开发语言·golang·xcode
数据知道2 小时前
Go基础:用Go语言操作MongoDB详解
服务器·开发语言·数据库·后端·mongodb·golang·go语言
爱喝白开水a2 小时前
2025时序数据库选型,从架构基因到AI赋能来解析
开发语言·数据库·人工智能·架构·langchain·transformer·时序数据库
朝新_2 小时前
【EE初阶 - 网络原理】网络通信
java·开发语言·网络·php·javaee