-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
350 lines (315 loc) · 12.1 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# Set the Windows kit if using MSVC
# CMake will look for the newest kit that isn't newer than this
# Required to find modern D3D12 header
if(MSVC)
set(CMAKE_SYSTEM_VERSION 10.0.17134.0)
endif()
cmake_minimum_required(VERSION 3.12)
project(OpenComposite)
include(scripts/pch.cmake)
# === Runtime Switcher ===
include_external_msproject(
RuntimeSwitcher ${CMAKE_SOURCE_DIR}/RuntimeSwitcher/RuntimeSwitcher.csproj
TYPE FAE04EC0-301F-11D3-BF4B-00C04F79EFBC
PLATFORM "AnyCPU"
)
# === OpenVR Headers ===
add_library(OpenVR INTERFACE)
target_include_directories(OpenVR INTERFACE SplitOpenVRHeaders) # TODO make this private and put the public headers elsewhere
# === Vulkan ===
add_library(Vulkan INTERFACE)
target_include_directories(Vulkan INTERFACE libs/vulkan/Include) # TODO make this private and put the public headers elsewhere
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
target_link_libraries(Vulkan INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libs/vulkan/Lib/vulkan-1.lib)
else()
target_link_libraries(Vulkan INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libs/vulkan/Lib32/vulkan-1.lib)
endif()
# === LibOVR ===
if(WIN32)
set(OVRDIR libs/libovr/OculusSDK/LibOVR)
add_library(ovr STATIC
${OVRDIR}/Shim/OVR_CAPI_Prototypes.h
${OVRDIR}/Shim/OVR_CAPI_Util.cpp
${OVRDIR}/Shim/OVR_CAPIShim.c
${OVRDIR}/Shim/OVR_StereoProjection.cpp
)
target_include_directories(ovr PUBLIC ${OVRDIR}/Include)
# Resource Processor
set(OVR_SHADER_DIR "${CMAKE_CURRENT_BINARY_DIR}/gen_shaders")
function(build_fx path profile src_tgt)
get_filename_component(abspath ${path} ABSOLUTE)
get_filename_component(name ${path} NAME_WE)
set(fx_header ${OVR_SHADER_DIR}/Shaders/${name}.h)
add_custom_command(
OUTPUT ${fx_header} # ${fx_obj}
COMMAND fxc ARGS
/nologo
/T ${profile}
/Fh ${fx_header}
/Vn ${name}
${abspath}
MAIN_DEPENDENCY ${abspath}
)
set_property(SOURCE ${src_tgt} APPEND PROPERTY OBJECT_DEPENDS ${fx_header})
endfunction()
file(MAKE_DIRECTORY ${OVR_SHADER_DIR}/Shaders)
# === LibOVRKernel ===
set(OVRKDIR libs/libovr/OculusSDK/LibOVRKernel)
set(OVRKSDIR ${OVRKDIR}/Src/Util/Shaders)
add_library(ovrkernel STATIC
${OVRKDIR}/../Logging/src/internal/Logging_Tools.cpp
${OVRKDIR}/../Logging/src/Logging_Library.cpp
${OVRKDIR}/../Logging/src/Logging_OutputPlugins.cpp
${OVRKDIR}/Src/GL/CAPI_GLE.cpp
${OVRKDIR}/Src/Kernel/OVR_Alg.cpp
${OVRKDIR}/Src/Kernel/OVR_Allocator.cpp
${OVRKDIR}/Src/Kernel/OVR_Atomic.cpp
${OVRKDIR}/Src/Kernel/OVR_Callbacks.cpp
${OVRKDIR}/Src/Kernel/OVR_CRC32.cpp
${OVRKDIR}/Src/Kernel/OVR_DebugHelp.cpp
${OVRKDIR}/Src/Kernel/OVR_Error.cpp
${OVRKDIR}/Src/Kernel/OVR_File.cpp
${OVRKDIR}/Src/Kernel/OVR_FileFILE.cpp
${OVRKDIR}/Src/Kernel/OVR_JSON.cpp
${OVRKDIR}/Src/Kernel/OVR_Log.cpp
${OVRKDIR}/Src/Kernel/OVR_mach_exc_OSX.c
${OVRKDIR}/Src/Kernel/OVR_Rand.cpp
${OVRKDIR}/Src/Kernel/OVR_RefCount.cpp
${OVRKDIR}/Src/Kernel/OVR_SharedMemory.cpp
${OVRKDIR}/Src/Kernel/OVR_Std.cpp
${OVRKDIR}/Src/Kernel/OVR_String.cpp
${OVRKDIR}/Src/Kernel/OVR_String_FormatUtil.cpp
${OVRKDIR}/Src/Kernel/OVR_String_PathUtil.cpp
${OVRKDIR}/Src/Kernel/OVR_SysFile.cpp
${OVRKDIR}/Src/Kernel/OVR_System.cpp
${OVRKDIR}/Src/Kernel/OVR_ThreadsPthread.cpp
${OVRKDIR}/Src/Kernel/OVR_ThreadsWinAPI.cpp
${OVRKDIR}/Src/Kernel/OVR_Timer.cpp
${OVRKDIR}/Src/Kernel/OVR_UTF8Util.cpp
${OVRKDIR}/Src/Util/Util_D3D11_Blitter.cpp
${OVRKDIR}/Src/Util/Util_Direct3D.cpp
${OVRKDIR}/Src/Util/Util_GL_Blitter.cpp
${OVRKDIR}/Src/Util/Util_ImageWindow.cpp
${OVRKDIR}/Src/Util/Util_LongPollThread.cpp
${OVRKDIR}/Src/Util/Util_SystemGUI.cpp
${OVRKDIR}/Src/Util/Util_SystemInfo.cpp
${OVRKDIR}/Src/Util/Util_Watchdog.cpp
)
target_include_directories(ovrkernel PUBLIC ${OVRKDIR}/Src)
target_include_directories(ovrkernel PRIVATE ${OVRKDIR}/../Logging/include)
target_link_libraries(ovrkernel ovr)
# Shader configuration
target_include_directories(ovrkernel PRIVATE ${OVR_SHADER_DIR})
set(OVRK_BLITTER ${OVRKDIR}/Src/Util/Util_D3D11_Blitter.cpp)
build_fx(${OVRKSDIR}/Blt_ps.hlsl ps_4_0 ${OVRK_BLITTER})
build_fx(${OVRKSDIR}/Blt_ps_ms2.hlsl ps_5_0 ${OVRK_BLITTER})
build_fx(${OVRKSDIR}/Blt_vs.hlsl vs_5_0 ${OVRK_BLITTER})
# === DrvOculus ===
add_library(DrvOculus STATIC
DrvOculus/DrvOculus.cpp
DrvOculus/DrvOculusCommon.h
DrvOculus/OculusBackend.cpp
DrvOculus/OculusBackend.h
DrvOculus/OculusBackendSubmit.cpp
DrvOculus/OculusBackendMirror.cpp
DrvOculus/OculusBackendGuardian.cpp
DrvOculus/pub/DrvOculus.h
# Devices
DrvOculus/OculusDevice.cpp
DrvOculus/OculusDevice.h
DrvOculus/OculusHMD.cpp
DrvOculus/OculusHMD.h
)
target_include_directories(DrvOculus PUBLIC DrvOculus/pub)
target_include_directories(DrvOculus PRIVATE DrvOculus)
target_link_libraries(DrvOculus OpenVR ovr ovrkernel)
source_group(Public REGULAR_EXPRESSION DrvOculus/pub/*)
endif (WIN32)
# === OCCore ===
# TODO: precompiled headers
set(OVR_RESOURCES
OpenOVR/resources.rc
)
set(OVR_PCH_EXCLUDED
OpenOVR/Misc/ini.c
OpenOVR/Misc/jsoncpp.cpp
OpenOVR/Misc/lodepng.cpp
)
add_library(OCCore STATIC
# Use when doing PCH
# Place it above everything else, so it gets built first
OpenOVR/stdafx.cpp
OpenOVR/API/OCBaseSystem.cpp
OpenOVR/Compositor/compositor.cpp
OpenOVR/Compositor/dx11compositor.cpp
OpenOVR/Compositor/dx10compositor.cpp
OpenOVR/Compositor/dx12compositor.cpp
OpenOVR/Compositor/glcompositor.cpp
OpenOVR/Compositor/vkcompositor.cpp
OpenOVR/convert.cpp
OpenOVR/libovr_wrapper.cpp
OpenOVR/logging.cpp
OpenOVR/Misc/audio_override.cpp
OpenOVR/Misc/Config.cpp
OpenOVR/Misc/debug_helper.cpp
OpenOVR/Misc/Haptics.cpp
OpenOVR/Misc/Keyboard/KeyboardLayout.cpp
OpenOVR/Misc/Keyboard/SudoFontMeta.cpp
OpenOVR/Misc/Keyboard/VRKeyboard.cpp
OpenOVR/OpenOVR.cpp
OpenOVR/Reimpl/BaseApplications.cpp
OpenOVR/Reimpl/BaseChaperone.cpp
OpenOVR/Reimpl/BaseChaperoneSetup.cpp
OpenOVR/Reimpl/BaseClientCore.cpp
OpenOVR/Reimpl/BaseCompositor.cpp
OpenOVR/Reimpl/BaseExtendedDisplay.cpp
OpenOVR/Reimpl/BaseInput.cpp
OpenOVR/Reimpl/BaseOverlay.cpp
OpenOVR/Reimpl/BaseRenderModels.cpp
OpenOVR/Reimpl/BaseScreenshots.cpp
OpenOVR/Reimpl/BaseSettings.cpp
OpenOVR/Reimpl/BaseSystem.cpp
OpenOVR/Reimpl/CVRApplications.cpp
OpenOVR/Reimpl/CVRChaperone.cpp
OpenOVR/Reimpl/CVRChaperoneSetup.cpp
OpenOVR/Reimpl/CVRClientCore.cpp
OpenOVR/Reimpl/CVRCompositor.cpp
OpenOVR/Reimpl/CVRExtendedDisplay.cpp
OpenOVR/Reimpl/CVRInput.cpp
OpenOVR/Reimpl/CVROCSystem.cpp
OpenOVR/Reimpl/CVROverlay.cpp
OpenOVR/Reimpl/CVRRenderModels.cpp
OpenOVR/Reimpl/CVRScreenshots.cpp
OpenOVR/Reimpl/CVRSettings.cpp
OpenOVR/Reimpl/CVRSystem.cpp
OpenOVR/Reimpl/stubs.gen.cpp
# Base classes
OpenOVR/Reimpl/BaseServerDriverHost.cpp OpenOVR/Reimpl/BaseServerDriverHost.h
# Definitions
OpenOVR/Reimpl/CVRServerDriverHost.cpp
# Exclude from the PCH requirement
${OVR_PCH_EXCLUDED}
# Resources
${OVR_RESOURCES}
# Headers
OpenOVR/API/ISystem_001.h
OpenOVR/API/OCBaseSystem.h
OpenOVR/BaseCommon.h
OpenOVR/Compositor/compositor.h
OpenOVR/convert.h
OpenOVR/custom_types.h
OpenOVR/libovr_wrapper.h
OpenOVR/logging.h
OpenOVR/Misc/audio_override.h
OpenOVR/Misc/Config.h
OpenOVR/Misc/debug_helper.h
OpenOVR/Misc/Haptics.h
OpenOVR/Misc/ini.h
OpenOVR/Misc/json/json-forwards.h
OpenOVR/Misc/json/json.h
OpenOVR/Misc/Keyboard/KeyboardLayout.h
OpenOVR/Misc/Keyboard/SudoFontMeta.h
OpenOVR/Misc/Keyboard/VRKeyboard.h
OpenOVR/Misc/lodepng.h
OpenOVR/Misc/ScopeGuard.h
OpenOVR/Reimpl/BaseApplications.h
OpenOVR/Reimpl/BaseChaperone.h
OpenOVR/Reimpl/BaseChaperoneSetup.h
OpenOVR/Reimpl/BaseClientCore.h
OpenOVR/Reimpl/BaseCompositor.h
OpenOVR/Reimpl/BaseExtendedDisplay.h
OpenOVR/Reimpl/BaseInput.h
OpenOVR/Reimpl/BaseOverlay.h
OpenOVR/Reimpl/BaseRenderModels.h
OpenOVR/Reimpl/BaseScreenshots.h
OpenOVR/Reimpl/BaseSettings.h
OpenOVR/Reimpl/BaseSystem.h
OpenOVR/Reimpl/Interfaces.h
OpenOVR/Reimpl/static_bases.gen.h
OpenOVR/resources.h
OpenOVR/stdafx.h
OpenOVR/steamvr_abi.h
OpenOVR/targetver.h
# Newly-added classes
OpenOVR/Drivers/DriverManager.cpp
OpenOVR/Drivers/DriverManager.h
OpenOVR/Drivers/Backend.cpp
OpenOVR/Drivers/Backend.h
# While not actually part of OCCore, list all the OpenVR interfaces here so they are easily accessable in IDE
SplitOpenVRHeaders/OpenVR/custom_interfaces/IVRClientCore_002.h
SplitOpenVRHeaders/OpenVR/custom_interfaces/IVRClientCore_003.h
SplitOpenVRHeaders/OpenVR/custom_interfaces/IVRCompositor_017.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRApplications_004.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRApplications_005.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRApplications_006.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRChaperoneSetup_005.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRChaperone_003.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRCompositor_012.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRCompositor_013.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRCompositor_014.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRCompositor_015.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRCompositor_016.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRCompositor_018.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRCompositor_019.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRCompositor_020.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRCompositor_021.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRCompositor_022.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRDriverManager_001.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRExtendedDisplay_001.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRInput_004.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRIOBuffer_001.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRNotifications_002.h
SplitOpenVRHeaders/OpenVR/interfaces/IVROverlay_010.h
SplitOpenVRHeaders/OpenVR/interfaces/IVROverlay_011.h
SplitOpenVRHeaders/OpenVR/interfaces/IVROverlay_012.h
SplitOpenVRHeaders/OpenVR/interfaces/IVROverlay_013.h
SplitOpenVRHeaders/OpenVR/interfaces/IVROverlay_014.h
SplitOpenVRHeaders/OpenVR/interfaces/IVROverlay_016.h
SplitOpenVRHeaders/OpenVR/interfaces/IVROverlay_017.h
SplitOpenVRHeaders/OpenVR/interfaces/IVROverlay_018.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRRenderModels_004.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRRenderModels_005.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRRenderModels_006.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRResources_001.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRScreenshots_001.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRSettings_001.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRSettings_002.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRSpatialAnchors_001.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRSystem_011.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRSystem_012.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRSystem_014.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRSystem_015.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRSystem_016.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRSystem_017.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRSystem_019.h
SplitOpenVRHeaders/OpenVR/interfaces/IVRTrackedCamera_003.h
SplitOpenVRHeaders/OpenVR/interfaces/openvr.h
SplitOpenVRHeaders/OpenVR/interfaces/vrannotation.h
SplitOpenVRHeaders/OpenVR/interfaces/vrtypes.h
# OpenVR Driver headers
SplitOpenVRHeaders/OpenVR/interfaces/driver_itrackeddevicedriverprovider.h
SplitOpenVRHeaders/OpenVR/interfaces/driver_IVRServerDriverHost_005.h
SplitOpenVRHeaders/OpenVR/interfaces/driver_ITrackedDeviceServerDriver_005.h
)
target_include_directories(OCCore PUBLIC OpenOVR) # TODO make this private and put the public headers elsewhere
target_include_directories(OCCore PRIVATE BundledLibs)
target_compile_definitions(OCCore PRIVATE -DSUPPORT_DX -DSUPPORT_GL -DSUPPORT_VK)
target_link_libraries(OCCore OpenVR ovr ovrkernel Vulkan)
# Set up precompiled headers for OCCore
if (WIN32)
add_precompiled_header(OCCore ${CMAKE_SOURCE_DIR}/OpenOVR/stdafx.h EXCLUDE
${OVR_PCH_EXCLUDED}
)
endif ()
source_group(OpenVR REGULAR_EXPRESSION SplitOpenVRHeaders/OpenVR/interfaces/*)
source_group(OpenVR\\Drivers REGULAR_EXPRESSION SplitOpenVRHeaders/OpenVR/interfaces/driver_*)
source_group(OpenVR\\Custom REGULAR_EXPRESSION SplitOpenVRHeaders/OpenVR/custom_interfaces/*)
source_group(Interfaces REGULAR_EXPRESSION OpenOVR/Reimpl/Base*)
source_group(Interfaces\\Declarations REGULAR_EXPRESSION OpenOVR/Reimpl/CVR*)
# === OCOVR ===
add_library(OCOVR SHARED
OCOVR/dllmain.cpp
# Resources don't get nicely included in a library file
${OVR_RESOURCES}
)
target_link_libraries(OCOVR OCCore DrvOculus)