Commit 3e2aee73 authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot
Browse files

Merge topic 'update_openvr_libs'

c4b90685

 Update openvr library to 1.14.15
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel's avatarBen Boeckel <ben.boeckel@kitware.com>
Merge-request: !836
parents fccd1c45 c4b90685
superbuild_add_project(openvr
CMAKE_ARGS
-DCMAKE_INSTALL_LIBDIR:STRING=lib
)
# apply some fixes to the CMakeList files for OpenVR
#
# apply MR https://github.com/ValveSoftware/openvr/pull/634
# apply MR https://github.com/ValveSoftware/openvr/pull/483
#
superbuild_apply_patch(openvr improve-install
"Improve OpenVR Install")
-DBUILD_SHARED:BOOL=TRUE
INSTALL_COMMAND
"${CMAKE_COMMAND}"
-Dsource_location:PATH=<SOURCE_DIR>
-Dinstall_location:PATH=<INSTALL_DIR>
-P ${CMAKE_CURRENT_LIST_DIR}/scripts/openvr.install.cmake
)
superbuild_add_extra_cmake_args(
-DOpenVR_INCLUDE_DIR:PATH=<INSTALL_DIR>/include
-DOpenVR_LIBRARY:FILEPATH=<INSTALL_DIR>/lib/${CMAKE_STATIC_LIBRARY_PREFIX}openvr_api64${CMAKE_STATIC_LIBRARY_SUFFIX}
-DOpenVR_INCLUDE_DIR:PATH=<INSTALL_DIR>/include/openvr
-DOpenVR_LIBRARY:FILEPATH=<INSTALL_DIR>/lib/${CMAKE_IMPORT_LIBRARY_PREFIX}openvr_api${CMAKE_IMPORT_LIBRARY_SUFFIX}
)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94de3ce..fdfc2d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,9 @@ endif()
# Get platform.
if(WIN32)
set(PLATFORM_NAME "win")
+ if(BUILD_SHARED)
+ add_definitions(-DVR_BUILD_SHARED)
+ endif()
elseif(UNIX AND NOT APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(PLATFORM_NAME "linux")
@@ -48,9 +51,9 @@ elseif(APPLE)
endif()
# Set output folder for static and shared libraries
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH})
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH})
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH})
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH})
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH})
# Enable some properties.
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
diff --git a/headers/openvr.h b/headers/openvr.h
index f945dbc..c8e4811 100644
--- a/headers/openvr.h
+++ b/headers/openvr.h
@@ -1191,11 +1191,15 @@ static const uint32_t k_unScreenshotHandleInvalid = 0;
// figure out how to import from the VR API dll
#if defined(_WIN32)
+#ifdef VR_BUILD_SHARED
#ifdef VR_API_EXPORT
#define VR_INTERFACE extern "C" __declspec( dllexport )
#else
#define VR_INTERFACE extern "C" __declspec( dllimport )
#endif
+#else
+#define VR_INTERFACE extern "C"
+#endif
#elif defined(__GNUC__) || defined(COMPILER_GCC) || defined(__APPLE__)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 58954d6..ad80a4b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,7 +22,7 @@ elseif(WIN32)
endif()
# Add include folders.
-include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/headers ${CMAKE_SOURCE_DIR}/src/vrcommon)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../headers ${CMAKE_CURRENT_SOURCE_DIR}/vrcommon)
if(USE_CUSTOM_LIBCXX)
link_directories(
@@ -94,3 +94,4 @@ endif()
target_link_libraries(${LIBNAME} ${EXTRA_LIBS})
install(TARGETS ${LIBNAME} DESTINATION lib)
+install (FILES ${CMAKE_SOURCE_DIR}/headers/openvr.h DESTINATION include)
# the openvr install rules put the dll into the lib directory
# as opposed to bin where it should be
file(
INSTALL "${source_location}/lib/win64/openvr_api.lib"
DESTINATION "${install_location}/lib")
file(
INSTALL "${source_location}/bin/win64/openvr_api.dll"
DESTINATION "${install_location}/bin")
file(
INSTALL "${source_location}/headers/openvr.h"
"${source_location}/headers/openvr_driver.h"
"${source_location}/headers/openvr_capi.h"
DESTINATION "${install_location}/include/openvr")
......@@ -118,8 +118,8 @@ superbuild_set_revision(rkcommon
URL_MD5 61f55e4d0d8efd48c8bc308bf5b4ee1f)
superbuild_set_revision(openvr
URL "https://www.paraview.org/files/dependencies/openvr_1.0.10_win_thin.zip"
URL_MD5 062a029869423808aebc32f85edf38e2)
URL "https://www.paraview.org/files/dependencies/openvr_1.14.15_win_thin.zip"
URL_MD5 7de59dee80edad6ce89df1913c6356e8)
superbuild_set_revision(paraviewwebvisualizer
URL "https://www.paraview.org/files/dependencies/pvw-visualizer-3.2.0.tgz"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment