-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
68 lines (59 loc) · 1.63 KB
/
CMakeLists.txt
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
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
cmake_minimum_required(VERSION 3.22.1)
project("app" CXX ASM)
set(CMAKE_CXX_STANDARD 17)
# Creating compile definitions
add_definitions(
-DANDROID_NDK
-DXR_USE_PLATFORM_ANDROID
-DXR_USE_GRAPHICS_API_VULKAN
)
# Find android libraries
find_library(android-log log REQUIRED)
find_library(android android REQUIRED)
find_library(vulkan vulkan REQUIRED)
find_library(aaudio aaudio REQUIRED)
# Add 3rd party libs
add_subdirectory(thirdparty)
# Creating variables containing source locations
file(
GLOB_RECURSE
LOCAL_SOURCE
CONFIGURE_DEPENDS
"core/*.cpp"
"examples/sample-projects/${EXAMPLE_NAME}/src/main/cpp/*.cpp"
)
file(
GLOB_RECURSE
LOCAL_ASSEMBLY
CONFIGURE_DEPENDS
"core/*.s"
)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library(game SHARED ${LOCAL_ASSEMBLY} ${LOCAL_SOURCE})
# Adding the include directory to game.
target_include_directories(
game
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
${CMAKE_CURRENT_SOURCE_DIR}/examples/sample-projects/${EXAMPLE_NAME}/include
${ANDROID_NDK}/sources/android/native_app_glue/
)
# Adding libraries to link to game.
target_link_libraries(
game
openxr_loader
ovraudio
glm
tinygltf
happly
ktx
${android-log}
${android}
${vulkan}
${aaudio}
)