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)

文件目录如下图所示

相关推荐
清心歌几秒前
CopyOnWriteArrayList 实现原理
java·开发语言
智者知已应修善业11 分钟前
【51单片机单按键切换广告屏】2023-5-17
c++·经验分享·笔记·算法·51单片机
良木生香24 分钟前
【C++初阶】C++入门相关知识(2):输入输出 & 缺省参数 & 函数重载
开发语言·c++
小此方24 分钟前
Re:从零开始的 C++ 进阶篇(三)彻底搞懂 C++ 多态:虚函数、虚表与动态绑定的底层原理
c++
忘梓.25 分钟前
墨色规则与血色节点:C++红黑树设计与实现探秘
java·开发语言·c++
hhh3u3u3u26 分钟前
Visual C++ 6.0中文版安装包下载教程及win11安装教程
java·c语言·开发语言·c++·python·c#·vc-1
凤年徐28 分钟前
C++手撕红黑树:从0到200行,拿下STL map底层核心
c++·后端·算法
星河耀银海28 分钟前
C++ 模板进阶:特化、萃取与可变参数模板
java·开发语言·c++
cccccc语言我来了32 分钟前
【C++---unordered_set/map底层封装】个不拘一格的集合。它不似有序集合那般循规蹈矩,而是以一种洒脱不羁的方式,将元素们随意地散落其中。每一个元素都是独一无二的。
开发语言·c++·哈希算法
Zfox_33 分钟前
C++ IO流全解析:标准库中的数据处理与文件读写艺术
开发语言·c++