This repository was archived by the owner on Sep 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
75 lines (65 loc) · 2.52 KB
/
CMakeLists.txt
File metadata and controls
75 lines (65 loc) · 2.52 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
#
# Copyright 2016 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include_directories(include)
include_directories(../../types/include)
include_directories(../../vcc/include)
include_directories(${VULKAN_CPP_LIBRARY_BINARY_DIR}/vcc/include)
include_directories(../../vcc-image/include)
include_directories(${GLM_SRC_DIR})
include_directories(${OPENVR_SOURCE_DIR}/headers)
if(NOT VULKAN_SDK_DIR STREQUAL "")
include_directories(${VULKAN_SDK_DIR}/include)
link_directories(${VULKAN_SDK_DIR}/bin)
endif()
set(SAMPLE_OPENVR_INCLUDES
"include/async_cache.h"
"include/thread_pool.h"
"include/vr.h"
)
set(SAMPLE_OPENVR_SRCS
"src/openvr.cpp"
"src/vr.cpp"
)
set(SAMPLE_OPENVR_SHADER_SRCS
"src/openvr-frag.frag"
"src/openvr-vert.vert"
)
if(UNIX)
set(OPENVR_LIB_DIR ${OPENVR_SOURCE_DIR}/lib/linux64)
set(OPENVR_LIBRARY_FILE ${OPENVR_SOURCE_DIR}/bin/linux64/libopenvr_api.so)
elseif(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OPENVR_LIB_DIR ${OPENVR_SOURCE_DIR}/lib/win64)
set(OPENVR_LIBRARY_FILE ${OPENVR_SOURCE_DIR}/bin/win64/openvr_api.dll)
else()
set(OPENVR_LIB_DIR ${OPENVR_SOURCE_DIR}/lib/win32)
set(OPENVR_LIBRARY_FILE ${OPENVR_SOURCE_DIR}/bin/win32/openvr_api.dll)
endif()
endif()
link_directories(${OPENVR_LIB_DIR})
add_executable(openvr ${SAMPLE_OPENVR_INCLUDES} ${SAMPLE_OPENVR_SRCS})
target_link_libraries(openvr vcc vcc-image openvr_api)
foreach(FILE ${SAMPLE_OPENVR_SHADER_SRCS})
get_filename_component(FILEWE ${FILE} NAME_WE)
set(FILE_OUTPUT ${FILEWE}.spv)
add_custom_command(TARGET openvr POST_BUILD DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
COMMAND glslangValidator
ARGS -V -o ${CMAKE_CURRENT_BINARY_DIR}/${FILE_OUTPUT} ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}
WORKING_DIRECTORY .)
endforeach()
add_custom_command(TARGET openvr POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/textures $<TARGET_FILE_DIR:openvr>/textures)
add_custom_command(TARGET openvr POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${OPENVR_LIBRARY_FILE} $<TARGET_FILE_DIR:openvr>/)