-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
103 lines (83 loc) · 2.04 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
#
# OpenVR OSVR driver
#
cmake_minimum_required(VERSION 3.1.0)
project(openvr_osvr)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(UseBackportedModules)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Be able to find openvr as a peer.
list(APPEND CMAKE_PREFIX_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/openvr"
"${CMAKE_CURRENT_SOURCE_DIR}/../openvr")
include(EnableExtraCompilerWarnings)
globally_enable_extra_compiler_warnings()
#
# Options
#
option(BUILD_TESTS "Build test programs and unit tests." OFF)
#
# Dependencies
#
find_package(OpenVR REQUIRED)
find_package(osvr REQUIRED)
find_package(osvrRenderManager REQUIRED)
find_package(JsonCpp REQUIRED)
find_package(Threads REQUIRED)
if(WIN32)
# RenderManager requires the d3dcompiler_47.dll file. This ships with
# Windows 8 and above by default, but we'll need to ship it for Windows 7
# users. To simplify our lives, we'll just ship it for everyone.
find_package(WindowsSDK REQUIRED COMPONENTS tools)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_DIR x64)
else()
set(ARCH_DIR x86)
endif()
find_file(DIRECT3D_COMPILER_REDISTRIBUTABLE d3dcompiler_47.dll
PATH_SUFFIXES Redist/D3D/${ARCH_DIR}
PATHS ${WINDOWSSDK_DIRS}
NO_DEFAULT_PATH)
endif()
# For our generated file
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#
# Third-party libraries
#
add_subdirectory(vendor)
#
# Default installation directories
#
include(GNUInstallDirs)
include(SteamVRPaths)
# Default settings file, 3D models, and other resources
install(DIRECTORY
resources
DESTINATION
"${CMAKE_INSTALL_FULL_LIBDIR}/openvr/osvr/"
)
# Driver manifest file destination
install(FILES
driver.vrdrivermanifest
DESTINATION
"${CMAKE_INSTALL_FULL_LIBDIR}/openvr/osvr/"
)
file(TO_CMAKE_PATH
"${CMAKE_INSTALL_FULL_LIBDIR}/openvr/osvr/bin/${STEAMVR_PLATFORM}"
DRIVER_INSTALL_DIR)
if(WIN32)
# Install d3dcompiler_47.dll
install(FILES ${DIRECT3D_COMPILER_REDISTRIBUTABLE}
DESTINATION ${DRIVER_INSTALL_DIR})
endif()
#
# OpenVR driver
#
add_subdirectory(src)
#
# Tests
#
if(BUILD_TESTS)
add_subdirectory(test)
endif()