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)

文件目录如下图所示

相关推荐
稻草人想看远方34 分钟前
GC垃圾回收
java·开发语言·jvm
胡萝卜的兔1 小时前
go 日志的分装和使用 Zap + lumberjack
开发语言·后端·golang
浪扼飞舟1 小时前
c#基础(一)
开发语言·c#
HAH-HAH1 小时前
【蓝桥杯 2024 国 Java A】粉刷匠小蓝
c++·学习·数学·算法·职场和发展·蓝桥杯·组合数学
百锦再1 小时前
在 CentOS 系统上实现定时执行 Python 邮件发送任务
java·linux·开发语言·人工智能·python·centos·pygame
何似在人间5752 小时前
Go语言快速入门教程(JAVA转go)——1 概述
java·开发语言·golang
小吴同学·2 小时前
OPC Client第10讲:实现主界面;获取初始界面传来的所有配置信息config【C++读写Excel:xlnx;ODBC;缓冲区】
c++·wxwidgets
边疆.2 小时前
【C++】继承详解
开发语言·c++·继承
hweiyu002 小时前
C++设计模式,高级开发,算法原理实战,系统设计与实战(视频教程)
c++·算法·设计模式
lxh01133 小时前
LRU 缓存
开发语言·前端·javascript