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)

文件目录如下图所示

相关推荐
光子物联单片机9 分钟前
C语言基础开发入门系列(八)C语言指针的理解与实战
c语言·开发语言·stm32·单片机·mcu
是苏浙14 分钟前
零基础入门C语言之文件操作
c语言·开发语言
盈电智控16 分钟前
体力劳动反而更难被AI取代?物联网科技如何守护最后的劳动阵地
开发语言·人工智能·python
隔壁阿布都18 分钟前
Spring Boot中的Optional如何使用
开发语言·spring boot·python
小龙报20 分钟前
《C语言疑难点 --- C语内存函数专题》
c语言·开发语言·c++·创业创新·学习方法·业界资讯·visual studio
卡提西亚1 小时前
C++笔记-21-运算符重载
c++·笔记
国服第二切图仔1 小时前
Rust开发实战之简单游戏开发(piston游戏引擎)
开发语言·rust·游戏引擎
ii_best1 小时前
安卓/IOS工具开发基础教程:按键精灵一个简单的文字识别游戏验证
android·开发语言·游戏·ios·编辑器
草莓熊Lotso1 小时前
C++ 继承特殊场景解析:友元、静态成员与菱形继承的底层逻辑
服务器·开发语言·c++·人工智能·经验分享·笔记·1024程序员节
诗句藏于尽头1 小时前
电脑使用软件控制本机屏和外接屏失效问题及解决
开发语言