forked from google/oboe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
78 lines (56 loc) · 2.5 KB
/
CMakeLists.txt
File metadata and controls
78 lines (56 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
cmake_minimum_required(VERSION 3.4.1)
include_directories(third_party)
include_directories(src/main/cpp/)
add_library( native-lib
SHARED
# main game files
src/main/cpp/native-lib.cpp
src/main/cpp/Game.cpp
# audio engine
src/main/cpp/audio/AAssetDataSource.cpp
src/main/cpp/audio/Player.cpp
# UI engine
src/main/cpp/ui/OpenGLFunctions.cpp
# utility functions
src/main/cpp/utils/logging.h
src/main/cpp/utils/UtilityFunctions.cpp
)
set (TARGET_LIBS log android oboe GLESv2)
if(${USE_FFMPEG})
MESSAGE(STATUS "Using FFmpeg extractor")
add_definitions(-DUSE_FFMPEG=1)
target_sources( native-lib PRIVATE src/main/cpp/audio/FFMpegExtractor.cpp )
# Add the local path to FFmpeg, you can use the ${ANDROID_ABI} variable to specify the ABI name
# e.g. /Users/donturner/Code/ffmpeg/build/${ANDROID_ABI}
set(FFMPEG_DIR "/path/to/ffmpeg")
include_directories(native-lib ${FFMPEG_DIR}/include)
add_library( avformat SHARED IMPORTED)
set_target_properties(avformat PROPERTIES IMPORTED_LOCATION
${FFMPEG_DIR}/lib/libavformat.so)
add_library( avutil SHARED IMPORTED)
set_target_properties(avutil PROPERTIES IMPORTED_LOCATION
${FFMPEG_DIR}/lib/libavutil.so)
add_library( avcodec SHARED IMPORTED)
set_target_properties(avcodec PROPERTIES IMPORTED_LOCATION
${FFMPEG_DIR}/lib/libavcodec.so)
add_library( swresample SHARED IMPORTED)
set_target_properties(swresample PROPERTIES IMPORTED_LOCATION
${FFMPEG_DIR}/lib/libswresample.so)
set (TARGET_LIBS ${TARGET_LIBS} avformat avutil avcodec swresample)
else()
MESSAGE(STATUS "Using NDK media extractor")
add_definitions(-DUSE_FFMPEG=0)
target_sources( native-lib PRIVATE src/main/cpp/audio/NDKExtractor.cpp )
set (TARGET_LIBS ${TARGET_LIBS} mediandk)
endif()
target_link_libraries( native-lib ${TARGET_LIBS} )
# Set the path to the Oboe directory.
set (OBOE_DIR ../..)
# Add the Oboe library as a subdirectory in your project.
add_subdirectory (${OBOE_DIR} ./oboe-bin)
# Specify the path to the Oboe header files.
include_directories (${OBOE_DIR}/include ${OBOE_DIR}/samples)
# Enable optimization flags: if having problems with source level debugging,
# disable -Ofast ( and debug ), re-enable after done debugging.
target_compile_options(native-lib
PRIVATE -std=c++17 -Wall -Werror "$<$<CONFIG:RELEASE>:-Ofast>")