-
Notifications
You must be signed in to change notification settings - Fork 215
/
CMakeLists.txt
155 lines (133 loc) · 5.42 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1)
# 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_subdirectory(src/main/cpp/vrb/src)
add_library( # Sets the name of the library.
native-lib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/BrowserWorld.cpp
src/main/cpp/Cylinder.cpp
src/main/cpp/Controller.cpp
src/main/cpp/ControllerContainer.cpp
src/main/cpp/DeviceUtils.cpp
src/main/cpp/ElbowModel.cpp
src/main/cpp/FadeAnimation.cpp
src/main/cpp/Quad.cpp
src/main/cpp/ExternalBlitter.cpp
src/main/cpp/ExternalVR.cpp
src/main/cpp/GeckoSurfaceTexture.cpp
src/main/cpp/GestureDelegate.cpp
src/main/cpp/LoadingAnimation.cpp
src/main/cpp/JNIUtil.cpp
src/main/cpp/Pointer.cpp
src/main/cpp/Skybox.cpp
src/main/cpp/SplashAnimation.cpp
src/main/cpp/VRBrowser.cpp
src/main/cpp/VRVideo.cpp
src/main/cpp/VRLayer.cpp
src/main/cpp/VRLayerNode.cpp
src/main/cpp/Widget.cpp
src/main/cpp/WidgetBorder.cpp
src/main/cpp/WidgetMover.cpp
src/main/cpp/WidgetPlacement.cpp
src/main/cpp/WidgetResizer.cpp
)
if(WAVEVR)
target_sources(
native-lib
PUBLIC
src/wavevr/cpp/native-lib.cpp
src/wavevr/cpp/DeviceDelegateWaveVR.cpp
)
elseif(PICOVR)
target_sources(
native-lib
PUBLIC
src/picovr/cpp/native-lib.cpp
src/picovr/cpp/DeviceDelegatePicoVR.cpp
src/picovr/cpp/VRBrowserPico.cpp
)
elseif(NOAPI)
target_sources(
native-lib
PUBLIC
src/noapi/cpp/native-lib.cpp
src/noapi/cpp/DeviceDelegateNoAPI.cpp
)
else()
target_sources(
native-lib
PUBLIC
src/main/cpp/native-lib.cpp
src/main/cpp/BrowserEGLContext.cpp
)
include(AndroidNdkModules)
android_ndk_import_module_native_app_glue()
target_link_libraries(native-lib native_app_glue)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
endif()
if(OCULUSVR)
target_sources(
native-lib
PUBLIC
src/oculusvr/cpp/DeviceDelegateOculusVR.cpp
src/oculusvr/cpp/OculusSwapChain.cpp
src/oculusvr/cpp/OculusVRLayers.cpp
)
add_custom_command(TARGET native-lib POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/../third_party/ovr_mobile/VrApi/Libs/Android/${ANDROID_ABI}/Release/libvrapi.so
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libvrapi.so
)
add_custom_command(TARGET native-lib POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/../third_party/OVRPlatformSDK/Android/libs/${ANDROID_ABI}/libovrplatformloader.so
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libovrplatformloader.so
)
endif()
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
log )
find_library( # Sets the name of the path variable.
android-lib
android )
add_library(oculusvr-lib SHARED IMPORTED)
set_target_properties(oculusvr-lib PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/../third_party/ovr_mobile/VrApi/Libs/Android/${ANDROID_ABI}/Release/libvrapi.so )
add_library(ovrplatform-lib SHARED IMPORTED)
set_target_properties(ovrplatform-lib PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/../third_party/OVRPlatformSDK/Android/libs/${ANDROID_ABI}/libovrplatformloader.so )
add_library(wavevr-lib SHARED IMPORTED)
set_target_properties(wavevr-lib PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/../third_party/wavesdk/build/wvr_client/jni/${ANDROID_ABI}/libwvr_api.so )
add_library(picovr-lib SHARED IMPORTED)
set_target_properties(picovr-lib PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/../third_party/picovr/${ANDROID_ABI}/libPvr_NativeSDK.so )
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
native-lib
vrb
# Link VR_SDK_LIB exported from gradle flavors
${VR_SDK_LIB}
${VR_SDK_EXTRA_LIB}
# Links the target library to the log library
# included in the NDK.
${log-lib}
${android-lib}
EGL
GLESv3
)