-
Notifications
You must be signed in to change notification settings - Fork 33
/
CMakeLists.txt
60 lines (49 loc) · 1.92 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
cmake_minimum_required(VERSION 3.1)
project (driver_openhmd)
set (CMAKE_CXX_STANDARD 11)
# meta data that the steamvr plugin needs in the base directory of the steamvr plugin
file(COPY driver.vrdrivermanifest DESTINATION ${CMAKE_BINARY_DIR})
file(COPY resources DESTINATION ${CMAKE_BINARY_DIR})
include_directories("${CMAKE_SOURCE_DIR}/subprojects/openhmd/include")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/subprojects/openhmd/cmake/")
add_subdirectory(./subprojects/openhmd)
include_directories("${CMAKE_SOURCE_DIR}/subprojects/openvr/")
add_library(driver_openhmd SHARED
driverlog.cpp
driverlog.h
driver_openhmd.cpp
)
if(MSVC)
target_compile_options(driver_openhmd PRIVATE /W4 /WX)
else(MSVC)
target_compile_options(driver_openhmd PRIVATE -Wall) #-Wextra -Wno-unused-parameter) #-pedantic)
endif(MSVC)
target_link_libraries(driver_openhmd
${CMAKE_DL_LIBS}
openhmd
)
#determine the output directory for the steamvr plugin
if (WIN32)
# FIXME need to account for different architectures
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(PLUGINDIR ${CMAKE_BINARY_DIR}/bin/win64 CACHE TYPE INTERNAL)
else()
set(PLUGINDIR ${CMAKE_BINARY_DIR}/bin/win32 CACHE TYPE INTERNAL)
endif()
elseif(APPLE)
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(PLUGINDIR ${CMAKE_BINARY_DIR}/bin/osx64 CACHE STRING INTERNAL)
else()
set(PLUGINDIR ${CMAKE_BINARY_DIR}/bin/osx32 CACHE STRING INTERNAL)
endif()
elseif(NOT ANDROID)
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(PLUGINDIR ${CMAKE_BINARY_DIR}/bin/linux64 CACHE STRING INTERNAL)
else()
set(PLUGINDIR ${CMAKE_BINARY_DIR}/bin/linux32 CACHE STRING INTERNAL)
endif()
endif()
MESSAGE("SteamVR plugin path: ${PLUGINDIR}")
set_target_properties(driver_openhmd PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PLUGINDIR}")
SET_TARGET_PROPERTIES(driver_openhmd PROPERTIES PREFIX "") # don't add lib prefix to driver_openhmd.so
add_dependencies(driver_openhmd openhmd)