-
Notifications
You must be signed in to change notification settings - Fork 214
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
175 lines (157 loc) · 6.84 KB
/
Copy pathCMakeLists.txt
File metadata and controls
175 lines (157 loc) · 6.84 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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.19)
set(PROJECT_NAME "Shell")
if(WIN32)
add_definitions("-DNOMINMAX")
add_definitions("-D_USE_MATH_DEFINES=1")
endif()
file(GLOB SHELL_SHARED_SRC_FILES LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
shared/fileLoader/*.cpp
shared/imageLoader/*.cpp
shared/extension/*.cpp
shared/input/*.cpp
shared/platform/*.cpp
shared/renderSession/*.cpp
shared/netservice/*.cpp)
if(APPLE)
file(GLOB SHELL_FILELOADER_PLATFORM_SRC LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
shared/fileLoader/apple/*.cpp)
elseif(ANDROID)
file(GLOB SHELL_FILELOADER_PLATFORM_SRC LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
shared/fileLoader/android/*.cpp)
elseif(UNIX AND NOT APPLE)
file(GLOB SHELL_FILELOADER_PLATFORM_SRC LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
shared/fileLoader/linux/*.cpp)
elseif(WIN32)
file(GLOB SHELL_FILELOADER_PLATFORM_SRC LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
shared/fileLoader/win/*.cpp)
else()
set(SHELL_FILELOADER_PLATFORM_SRC)
endif()
list(APPEND SHELL_SHARED_SRC_FILES ${SHELL_FILELOADER_PLATFORM_SRC})
file(GLOB SHELL_SHARED_HEADER_FILES LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
shared/fileLoader/*.h shared/imageLoader/*.h shared/extension/*.h shared/input/*.h shared/platform/*.h shared/renderSession/*.h shared/netservice/*.h)
add_library(IGLShellShared ${SHELL_SHARED_SRC_FILES} ${SHELL_SHARED_HEADER_FILES})
target_include_directories(IGLShellShared PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include_renderSessions")
target_include_directories(IGLShellShared PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include_shared")
target_link_libraries(IGLShellShared PUBLIC fmt)
target_link_libraries(IGLShellShared PUBLIC IGLLibrary)
target_link_libraries(IGLShellShared PUBLIC IGLUimgui)
target_link_libraries(IGLShellShared PUBLIC IGLUmanagedUniformBuffer)
target_link_libraries(IGLShellShared PUBLIC IGLUsimdtypes)
target_link_libraries(IGLShellShared PUBLIC IGLUsimple_renderer)
target_link_libraries(IGLShellShared PUBLIC IGLUshaderCross)
target_link_libraries(IGLShellShared PUBLIC IGLUtexture_accessor)
target_link_libraries(IGLShellShared PUBLIC IGLUtexture_loader)
target_link_libraries(IGLShellShared PUBLIC IGLUuniform)
target_link_libraries(IGLShellShared PUBLIC IGLstb)
igl_set_folder(IGLShellShared "IGL")
igl_set_cxxstd(IGLShellShared 20)
if(WIN32 OR UNIX AND NOT APPLE AND NOT ANDROID)
add_subdirectory(windows)
endif()
if(APPLE)
if(IOS)
add_subdirectory(ios)
else()
add_subdirectory(mac)
endif()
endif()
if(ANDROID)
set(android_jni)
add_subdirectory(android)
endif()
if(IGL_WITH_OPENXR)
add_subdirectory(openxr)
endif()
macro(ADD_SHELL_SESSION target libs)
set(shell_srcs apps/SessionApp.cpp renderSessions/${target}.cpp renderSessions/${target}.h)
add_shell_session_with_srcs(${target} "${shell_srcs}" "${libs}")
endmacro()
macro(ADD_SHELL_SESSION_OPENXR_SIM target libs)
set(shell_srcs apps/SessionApp.cpp renderSessions/${target}.cpp renderSessions/${target}.h)
if(WIN32)
if(IGL_WITH_VULKAN)
set(compile_defs "USE_VULKAN_BACKEND" "XR_USE_PLATFORM_WIN32" "XR_USE_GRAPHICS_API_VULKAN")
add_shell_session_backend_openxr_sim(${target} vulkan "${shell_srcs}" "${libs}" "${compile_defs}")
endif()
if(IGL_WITH_OPENGL)
set(compile_defs "USE_OPENGL_BACKEND" "XR_USE_PLATFORM_WIN32" "XR_USE_GRAPHICS_API_OPENGL")
add_shell_session_backend_openxr_sim(${target} opengl "${shell_srcs}" "${libs}" "${compile_defs}")
endif()
if(IGL_WITH_OPENGLES)
message(FATAL_ERROR "OpenGL ES for Windows OpenXR is not supported")
endif()
endif()
endmacro()
if(IGL_WITH_SAMPLES)
add_shell_session(BasicFramebufferSession "")
add_shell_session(BindGroupSession "")
add_shell_session(BindlessBufferSession "")
add_shell_session(BufferMappingSession "")
add_shell_session(CheckerboardMipmapSession "")
add_shell_session(ColorSession "")
add_shell_session(CopyOperationsSession "")
add_shell_session(DepthBiasSession "")
add_shell_session(DrawInstancedSession "")
add_shell_session(EmptySession "")
add_shell_session(FireworksSession "")
add_shell_session(GPUStressSession "")
add_shell_session(GPUTimerSession "")
add_shell_session(HelloWorldSession "")
add_shell_session(ImguiSession "")
add_shell_session(MeshShaderTriangleSession "")
add_shell_session(MRTSession "")
add_shell_session(MultiDrawIndexedIndirectSession "")
add_shell_session(ScissorTestSession "")
add_shell_session(SpecConstantsSession "")
add_shell_session(StencilOutlineSession "")
add_shell_session(Textured3DCubeSession "")
add_shell_session(TextureViewSession "")
add_shell_session(TinyMeshBindGroupSession "")
add_shell_session(TinyMeshSession "")
add_shell_session(TQMultiRenderPassSession "")
add_shell_session(TQSession "")
add_shell_session(WireframeSession "")
add_shell_session(YUVColorSession "")
if(IGL_WITH_OPENXR)
if(ANDROID)
add_shell_session(HelloOpenXRSession "")
add_shell_session(HandsOpenXRSession "")
endif()
if(WIN32)
add_shell_session_openxr_sim(HelloOpenXRSession "")
endif()
endif()
endif()
if(IGL_WITH_OPENXR AND ANDROID)
set(IGL_OPENXR_RENDER_SESSION CACHE STRING "Textured3DCubeSession")
if(DEFINED ENV{ANDROID_NDK})
cmake_path(SET NDK_PATH $ENV{ANDROID_NDK})
elseif(DEFINED ENV{NDK_ROOT})
cmake_path(SET NDK_PATH $ENV{NDK_ROOT})
else()
message(FATAL_ERROR "Android NDK not found, check environment variables ANDROID_NDK and NDK_ROOT")
endif()
if(IGL_WITH_VULKAN)
add_library(openxr-vulkan-Jni SHARED
openxr/mobile/XrApp.cpp
openxr/mobile/AndroidMain.cpp
"${NDK_PATH}/sources/android/native_app_glue/android_native_app_glue.c")
target_include_directories(openxr-vulkan-Jni PRIVATE "${NDK_PATH}/sources/android/native_app_glue")
target_link_libraries(openxr-vulkan-Jni PRIVATE IGLShellShared IGLShellOpenXR_AndroidVulkan ${IGL_OPENXR_RENDER_SESSION})
target_compile_definitions(openxr-vulkan-Jni PRIVATE "USE_VULKAN_BACKEND" "XR_USE_PLATFORM_ANDROID" "XR_USE_GRAPHICS_API_VULKAN")
endif()
if(IGL_WITH_OPENGLES)
add_library(openxr-gles-Jni SHARED
openxr/mobile/XrApp.cpp
openxr/mobile/AndroidMain.cpp
"${NDK_PATH}/sources/android/native_app_glue/android_native_app_glue.c")
target_include_directories(openxr-gles-Jni PRIVATE "${NDK_PATH}/sources/android/native_app_glue")
target_link_libraries(openxr-gles-Jni PRIVATE IGLShellShared IGLShellOpenXR_AndroidOpenGLES ${IGL_OPENXR_RENDER_SESSION})
target_compile_definitions(openxr-gles-Jni PRIVATE "USE_OPENGL_BACKEND" "XR_USE_PLATFORM_ANDROID" "XR_USE_GRAPHICS_API_OPENGL_ES")
endif()
endif()