Switch OpenVR back to non-imported library;
Building it from source results in a 7-8x smaller binary.
@@ -167,17 +167,21 @@ endif()
# OpenVR
if(LOVR_ENABLE_HEADSET AND LOVR_USE_OPENVR)
- add_library(openvr SHARED IMPORTED)
+ set(BUILD_SHARED ON CACHE BOOL "")
+ set(BUILD_UNIVERSAL OFF CACHE BOOL "")
include_directories(deps/openvr/headers)
- if(WIN32)
- set_target_properties(openvr PROPERTIES IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/deps/openvr/bin/win64/openvr_api.dll")
- set_target_properties(openvr PROPERTIES IMPORTED_IMPLIB "${CMAKE_SOURCE_DIR}/deps/openvr/lib/win64/openvr_api.lib")
- elseif(APPLE)
- set_target_properties(openvr PROPERTIES IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/deps/openvr/bin/osx32/libopenvr_api.dylib")
+ include_directories(deps/openvr/src)
+ include_directories(deps/openvr/src/vrcommon)
+ if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(LOVR_OPENVR openvr_api64)
else()
- set_target_properties(openvr PROPERTIES IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/deps/openvr/bin/linux64/libopenvr_api.so")
+ set(LOVR_OPENVR openvr_api)
endif()
- set(LOVR_OPENVR openvr)
+ add_subdirectory(deps/openvr)
+ set_target_properties(${LOVR_OPENVR} PROPERTIES
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/openvr_api"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/openvr_api"
+ )
endif()
# OpenXR
