Commit 24e30f6d authored by Ken Martin's avatar Ken Martin
Browse files

add support for building openvr

adds an option plus the supporting openvr lib
along with some required patches for their CMake
files.
parent 90e5bfe8
......@@ -108,6 +108,7 @@ function (superbuild_find_projects var)
if (WIN32)
list(APPEND projects
ftjam
openvr
pywin32)
endif ()
......
......@@ -101,6 +101,12 @@ if (PARAVIEW_DEFAULT_SYSTEM_GL AND mesa_enabled)
set(paraview_mesa_sb_available TRUE)
endif ()
if (WIN32)
list(APPEND paraviews_platform_dependencies
openvr
)
endif ()
superbuild_add_project(paraview
DEBUGGABLE
DEFAULT_ON
......@@ -120,6 +126,7 @@ superbuild_add_project(paraview
-DBUILD_TESTING:BOOL=OFF
-DPARAVIEW_BUILD_PLUGIN_CoProcessingScriptGenerator:BOOL=ON
-DPARAVIEW_BUILD_PLUGIN_EyeDomeLighting:BOOL=ON
-DPARAVIEW_BUILD_PLUGIN_OpenVR:BOOL=${openvr_enabled}
-DPARAVIEW_BUILD_QT_GUI:BOOL=${qt5_enabled}
-DPARAVIEW_ENABLE_QT_SUPPORT:BOOL=${qt5_enabled}
-DPARAVIEW_ENABLE_FFMPEG:BOOL=${ffmpeg_enabled}
......
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")
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}
)
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)
......@@ -104,6 +104,10 @@ superbuild_set_revision(ospray
URL "http://www.paraview.org/files/dependencies/ospray-1.3.0.tar.gz"
URL_MD5 d4d4505ec949d3e88242e9fc8243d50f)
superbuild_set_revision(openvr
URL "http://www.paraview.org/files/dependencies/openvr_1.0.10_win_thin.zip"
URL_MD5 062a029869423808aebc32f85edf38e2)
superbuild_set_revision(paraviewwebvisualizer
URL "http://www.paraview.org/files/dependencies/visualizer-2.3.0.tar.gz"
URL_MD5 2559036cfe4d3a6e3d262f9b3f8e2c8f)
......
Markdown is supported
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