Commit 48b4758d authored by Aaron Bray's avatar Aaron Bray

REFAC: Update OpenHaptics build support

parent 19a2a5eb
......@@ -21,7 +21,7 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${iMSTK_NUM_BUILD_PROCESSES}" CACHE STRING INTERNAL FORCE)
endif()
endif()
message(STATUS "CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}" )
mark_as_superbuild(
VARS
CMAKE_BUILD_TYPE
......@@ -85,7 +85,7 @@ ExternalProject_Add( ${PROJECT_NAME}
-DBUILD_EXAMPLES:BOOL=${BUILD_EXAMPLES}
-DBUILD_TESTING:BOOL=${BUILD_TESTING}
-D${PROJECT_NAME}_SUPERBUILD:BOOL=OFF
-D${PROJECT_NAME}_USE_OMNI:BOOL=${${PROJECT_NAME}_USE_OMNI}
-D${PROJECT_NAME}_USE_OpenHaptics:BOOL=${${PROJECT_NAME}_USE_OpenHaptics}
-D${PROJECT_NAME}_USE_Vulkan:BOOL=${${PROJECT_NAME}_USE_Vulkan}
-D${PROJECT_NAME}_ENABLE_AUDIO:BOOL=${${PROJECT_NAME}_ENABLE_AUDIO}
-D${PROJECT_NAME}_ENABLE_VR:BOOL=${${PROJECT_NAME}_ENABLE_VR}
......
......@@ -14,7 +14,7 @@ set(FTD2XX_EXTRACT_DIR ${FTD2XX_PREFIX}/ftd2xx-2.12.18)
# Set install commands
#-----------------------------------------------------------------------------
set(ftd2xx_libdir "i386")
if(${CMAKE_GENERATOR} MATCHES "Win64")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(ftd2xx_libdir "amd64")
endif()
......@@ -28,6 +28,11 @@ set(copy_ftd2xx_lib_command
${FTD2XX_EXTRACT_DIR}/${ftd2xx_libdir}/ftd2xx.lib
${CMAKE_INSTALL_PREFIX}/lib/ftd2xx.lib
)
set(copy_ftd2xx_dll_command
${CMAKE_COMMAND} -E copy
${FTD2XX_EXTRACT_DIR}/${ftd2xx_libdir}/ftd2xx64.dll
${CMAKE_INSTALL_PREFIX}/bin/ftd2xx64.dll
)
#-----------------------------------------------------------------------------
# Add External Project
......@@ -45,6 +50,7 @@ imstk_add_external_project( FTD2XX
INSTALL_COMMAND
COMMAND ${copy_ftd2xx_headers_command}
COMMAND ${copy_ftd2xx_lib_command}
COMMAND ${copy_ftd2xx_dll_command}
RELATIVE_INCLUDE_PATH "/"
#VERBOSE
)
......@@ -14,7 +14,7 @@ set(Libusb_EXTRACT_DIR ${Libusb_PREFIX}/libusb-1.0.20)
# Set install commands
#-----------------------------------------------------------------------------
set(libusb_libdir "MS32")
if(${CMAKE_GENERATOR} MATCHES "Win64")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(libusb_libdir "MS64")
endif()
......@@ -25,9 +25,14 @@ set(copy_libusb_headers_command
)
set(copy_libusb_lib_command
${CMAKE_COMMAND} -E copy
${Libusb_EXTRACT_DIR}/${libusb_libdir}/static/libusb-1.0.lib
${Libusb_EXTRACT_DIR}/${libusb_libdir}/dll/libusb-1.0.lib
${CMAKE_INSTALL_PREFIX}/lib/libusb-1.0.lib
)
set(copy_libusb_dll_command
${CMAKE_COMMAND} -E copy
${Libusb_EXTRACT_DIR}/${libusb_libdir}/dll/libusb-1.0.dll
${CMAKE_INSTALL_PREFIX}/bin/
)
#-----------------------------------------------------------------------------
# Add External Project
......@@ -45,6 +50,7 @@ imstk_add_external_project( Libusb
INSTALL_COMMAND
COMMAND ${copy_libusb_headers_command}
COMMAND ${copy_libusb_lib_command}
COMMAND ${copy_libusb_dll_command}
RELATIVE_INCLUDE_PATH "include/libusb-1.0"
#VERBOSE
)
if(NOT WIN32)
message(WARNING "System not supported. Currently, only Windows is supported for External_OpenHaptics.cmake.")
return()
endif()
#-----------------------------------------------------------------------------
# Set install commands
#-----------------------------------------------------------------------------
if(WIN32)
set(open_haptics_libdir "Win32")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(open_haptics_libdir "x64")
endif()
set(lib_ext "lib")
set(bin_ext "dll")
endif()
# Header Directories
set(open_haptics_headers_dest ${CMAKE_INSTALL_PREFIX}/include/OpenHaptics)
set(open_haptics_headers_dir ${OPENHAPTICS_ROOT_DIR}/include/)
set(open_haptics_util_headers_dir ${OPENHAPTICS_ROOT_DIR}/utilities/include/)
# Library Directories
set(open_haptics_libs_dest ${CMAKE_INSTALL_PREFIX}/lib/)
set(open_haptics_libs_dir ${OPENHAPTICS_ROOT_DIR}/lib/${open_haptics_libdir}/Release)
set(open_haptics_util_libs_dir ${OPENHAPTICS_ROOT_DIR}/utilities/lib/${open_haptics_libdir}/Release)
# Binary Directory
set(open_haptics_bin_dest ${CMAKE_INSTALL_PREFIX}/bin/)
#-----------------------------------------------------------------------------
# Add External Project
#-----------------------------------------------------------------------------
include(imstkAddExternalProject)
imstk_add_external_project( OpenHaptics
SOURCE_DIR ${OPENHAPTICS_ROOT_DIR}
UPDATE_COMMAND ${SKIP_STEP_COMMAND}
CONFIGURE_COMMAND ${SKIP_STEP_COMMAND}
BUILD_COMMAND ${SKIP_STEP_COMMAND}
INSTALL_COMMAND
COMMAND ${CMAKE_COMMAND} -E copy_directory ${open_haptics_headers_dir} ${open_haptics_headers_dest}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${open_haptics_util_headers_dir} ${open_haptics_headers_dest}
COMMAND ${CMAKE_COMMAND} -E copy ${open_haptics_libs_dir}/hd.${lib_ext} ${open_haptics_libs_dest}
COMMAND ${CMAKE_COMMAND} -E copy ${open_haptics_libs_dir}/hd.${bin_ext} ${open_haptics_bin_dest}
COMMAND ${CMAKE_COMMAND} -E copy ${open_haptics_libs_dir}/hl.${lib_ext} ${open_haptics_libs_dest}
COMMAND ${CMAKE_COMMAND} -E copy ${open_haptics_libs_dir}/hl.${bin_ext} ${open_haptics_bin_dest}
COMMAND ${CMAKE_COMMAND} -E copy ${open_haptics_util_libs_dir}/hdu.${lib_ext} ${open_haptics_libs_dest}
COMMAND ${CMAKE_COMMAND} -E copy ${open_haptics_util_libs_dir}/hlu.${lib_ext} ${open_haptics_libs_dest}
RELATIVE_INCLUDE_PATH "/"
#VERBOSE
)
......@@ -10,8 +10,8 @@ endif(WIN32)
#-----------------------------------------------------------------------------
# Phantom Omni
#-----------------------------------------------------------------------------
option(${PROJECT_NAME}_USE_OMNI "Build OpenHaptics to support the Phantom Omni in VRPN." OFF)
if(${${PROJECT_NAME}_USE_OMNI})
option(${PROJECT_NAME}_USE_OpenHaptics "Build OpenHaptics to support the Phantom Omni in VRPN." OFF)
if(${${PROJECT_NAME}_USE_OpenHaptics})
message(STATUS "Superbuild - VRPN => ENABLING Phantom Omni support")
if(NOT DEFINED OPENHAPTICS_ROOT_DIR OR NOT EXISTS ${OPENHAPTICS_ROOT_DIR})
set(OPENHAPTICS_ROOT_DIR "$ENV{OH_SDK_BASE}" CACHE PATH "Path to OpenHaptics install directory." FORCE)
......@@ -32,7 +32,7 @@ endif()
include(imstkAddExternalProject)
imstk_add_external_project( VRPN
GIT_REPOSITORY https://gitlab.kitware.com/iMSTK/vrpn.git
GIT_TAG d7b36581721e0b13a9699eac6f0ea698f0a1c830
GIT_TAG 3c5426a28a70c8fcaf595f9e810ad548fbfc6650
# This is the improve-openhaptics-rebase branch
CMAKE_CACHE_ARGS
-DBUILD_TESTING:BOOL=OFF
......@@ -46,9 +46,9 @@ imstk_add_external_project( VRPN
-DVRPN_USE_LIBUSB_1_0:BOOL=ON
-DVRPN_USE_HID:BOOL=ON
-DVRPN_USE_LIBNIFALCON:BOOL=ON
-DVRPN_BUILD_SERVERS:BOOL=${${PROJECT_NAME}_USE_OMNI}
-DVRPN_USE_PHANTOM_SERVER:BOOL=${${PROJECT_NAME}_USE_OMNI}
-DVRPN_USE_HDAPI:BOOL=${${PROJECT_NAME}_USE_OMNI}
-DVRPN_BUILD_SERVERS:BOOL=${${PROJECT_NAME}_USE_OpenHaptics}
-DVRPN_USE_PHANTOM_SERVER:BOOL=${${PROJECT_NAME}_USE_OpenHaptics}
-DVRPN_USE_HDAPI:BOOL=${${PROJECT_NAME}_USE_OpenHaptics}
-DOPENHAPTICS_ROOT_DIR:PATH=${OPENHAPTICS_ROOT_DIR}
DEPENDENCIES ${VRPN_DEPENDENCIES}
RELATIVE_INCLUDE_PATH ""
......
include(imstkFind)
#-----------------------------------------------------------------------------
# Find All Headers and Libraries for OpenHaptics SDK
#-----------------------------------------------------------------------------
imstk_find_header(OpenHapticsSDK HD/hd.h OpenHaptics)
imstk_find_libary(OpenHapticsSDK hd " ")#Use same library for debug
imstk_find_libary(OpenHapticsSDK hl " ")#Use same library for debug
imstk_find_libary(OpenHapticsSDK hdu " ")#Use same library for debug
imstk_find_libary(OpenHapticsSDK hlu " ")#Use same library for debug
imstk_find_package(OpenHapticsSDK)
message(STATUS "OpenHapticsSDK include : ${OPENHAPTICSSDK_INCLUDE_DIRS}")
message(STATUS "OpenHapticsSDK libraries : ${OPENHAPTICSSDK_LIBRARIES}")
......@@ -16,22 +16,21 @@ macro(imstk_find_header package header)
unset(_SEARCH_DIR)
if(${package}_ROOT_DIR)
set(_SEARCH_DIR ${${package}_ROOT_DIR})
set(_SEARCH_DIR ${${package}_ROOT_DIR}/${sub_dir})
else()
set(_SEARCH_DIR ${CMAKE_INSTALL_PREFIX})
set(_SEARCH_DIR ${CMAKE_INSTALL_PREFIX}/include/${sub_dir})
endif()
#message(STATUS "Using search dir : ${_SEARCH_DIR}/include/${sub_dir}")
#message(STATUS "Searching for : ${_SEARCH_DIR}/${header}")
find_path(${package}_INCLUDE_DIR
NAMES
${header}
PATHS
${_SEARCH_DIR}/include/${sub_dir}
${_SEARCH_DIR}
NO_DEFAULT_PATH
)
#message(STATUS "${package}_INCLUDE_DIR : ${${package}_INCLUDE_DIR}")
#message(STATUS "Found it : ${${package}_INCLUDE_DIR}/${header}")
unset(${PACKAGE}_INCLUDE_DIRS)
if (EXISTS ${${package}_INCLUDE_DIR}/${header})
string(TOUPPER ${package} PACKAGE)
list(APPEND ${PACKAGE}_INCLUDE_DIRS ${${package}_INCLUDE_DIR})
......@@ -39,7 +38,7 @@ macro(imstk_find_header package header)
else()
message(FATAL_ERROR "Could not find ${${package}_INCLUDE_DIR}/${header}")
endif()
#message(STATUS "${package}_INCLUDE_DIRS : ${${package}_INCLUDE_DIRS}")
unset(${package}_INCLUDE_DIR CACHE)
endmacro()
......@@ -62,9 +61,12 @@ macro(imstk_find_libary package library)
unset(_SEARCH_DIR)
if(${package}_ROOT_DIR)
set(_SEARCH_DIR ${${package}_ROOT_DIR})
if(${package}_LIB_DIR)
set(_SEARCH_DIR ${${package}_ROOT_DIR}/${${package}_LIB_DIR})
endif()
#message(STATUS "Looking for ${package} libs in ${_SEARCH_DIR}")
else()
set(_SEARCH_DIR ${CMAKE_INSTALL_PREFIX})
set(_SEARCH_DIR ${CMAKE_INSTALL_PREFIX}/lib)
endif()
......@@ -73,7 +75,9 @@ macro(imstk_find_libary package library)
NAMES
${library}
lib${library}
PATHS ${_SEARCH_DIR}/lib
PATHS
${_SEARCH_DIR}
${_SEARCH_DIR}/Release
NO_DEFAULT_PATH
)
if (EXISTS ${${PACKAGE}_LIBRARY_${library}-RELEASE})
......@@ -88,7 +92,9 @@ macro(imstk_find_libary package library)
NAMES
${library}${debug_postfix}
lib${library}${debug_postfix}
PATHS ${_SEARCH_DIR}/lib
PATHS
${_SEARCH_DIR}
${_SEARCH_DIR}/Debug
NO_DEFAULT_PATH
)
if (EXISTS ${${PACKAGE}_LIBRARY_${library}-DEBUG})
......
......@@ -107,6 +107,9 @@ if(${PROJECT_NAME}_SUPERBUILD)
imstk_define_dependency(tbb)
imstk_define_dependency(VegaFEM)
imstk_define_dependency(VTK)
if(${PROJECT_NAME}_USE_OpenHaptics)
imstk_define_dependency(OpenHaptics)
endif()
imstk_define_dependency(VRPN)
if(WIN32)
......@@ -219,13 +222,11 @@ find_package( VegaFEM REQUIRED CONFIG )
# VRPN
find_package( VRPN REQUIRED )
if(${PROJECT_NAME}_USE_OMNI)
find_package( OMNI REQUIRED )
if(${PROJECT_NAME}_USE_OpenHaptics)
find_package( OpenHapticsSDK REQUIRED )
add_definitions( -DiMSTK_USE_OPENHAPTICS )
add_definitions( -DVRPN_USE_PHANTOM_SERVER )
else()
remove_definitions( -DiMSTK_USE_OPENHAPTICS )
remove_definitions( -DVRPN_USE_PHANTOM_SERVER )
endif()
# VTK
......
......@@ -102,7 +102,7 @@ device, follow the steps below:
2. Reboot your system.
3. Configure your CMake project with the variable :code:`iMSTK_USE_OMNI` set to ON.
3. Configure your CMake project with the variable :code:`iMSTK_USE_OpenHaptics` set to ON.
4. After configuration, the CMake variable OPENHAPTICS_ROOT_DIR should
be set to the OpenHaptics path on your system.
......
......@@ -16,7 +16,7 @@
#
###########################################################################
if(iMSTK_USE_OMNI)
if(iMSTK_USE_OpenHaptics)
project(Example-BoneDrilling)
......@@ -36,12 +36,14 @@ if(iMSTK_USE_OMNI)
if(UNIX)
target_link_libraries(${PROJECT_NAME}
SimulationManager
apiUtilities)
apiUtilities
OpenHapticsSDK)
else()
target_link_libraries(${PROJECT_NAME}
SimulationManager
apiUtilities
SFML)
SFML
OpenHapticsSDK)
endif()
......
......@@ -15,7 +15,7 @@
# limitations under the License.
#
###########################################################################
if(iMSTK_USE_OMNI)
if(iMSTK_USE_OpenHaptics)
project(Example-CameraController)
......
......@@ -15,7 +15,7 @@
# limitations under the License.
#
###########################################################################
if(iMSTK_USE_OMNI)
if(iMSTK_USE_OpenHaptics)
project(Example-ObjectController)
......
......@@ -15,7 +15,7 @@
# limitations under the License.
#
###########################################################################
if(iMSTK_USE_OMNI)
if(iMSTK_USE_OpenHaptics)
project(Example-VirtualCoupling)
......
......@@ -91,7 +91,7 @@ To support the [Geomagic Touch (formerly Sensable Phantom Omni)](http://www.geom
- for [Windows](https://3dsystems.teamplatform.com/pages/102774?t=r4nk8zvqwa91)
- for [Linux](https://3dsystems.teamplatform.com/pages/102863?t=fptvcy2zbkcc)
2. Reboot your system.
3. Configure your CMake project with the variable `iMSTK_USE_OMNI` set to `ON`.
3. Configure your CMake project with the variable `iMSTK_USE_OpenHaptics` set to `ON`.
4. After configuration, the CMake variable `OPENHAPTICS_ROOT_DIR` should be set to the OpenHaptics path on your system.
* ##### Vulkan Renderer
......
......@@ -6,6 +6,7 @@ imstk_add_library( Devices
DEPENDS
Core
VRPN
OpenHapticsSDK
)
#-----------------------------------------------------------------------------
......
......@@ -87,4 +87,4 @@ private:
}
#endif // ifndef imstkHDAPIDeviceClient_h
#endif // ifdef iMSTK_USE_OMNI
#endif // ifdef iMSTK_USE_OpenHaptics
......@@ -65,4 +65,4 @@ HDAPIDeviceServer::cleanUpModule()
}
} // imstk
#endif // ifdef iMSTK_USE_OMNI
#endif // ifdef iMSTK_USE_OpenHaptics
......@@ -82,4 +82,4 @@ private:
} // imstk
#endif // ifndef imstkHDAPIDeviceServer_h
#endif // ifdef iMSTK_USE_OMNI
#endif // ifdef iMSTK_USE_OpenHaptics
......@@ -25,6 +25,9 @@
#include "vrpn_Tracker_NovintFalcon.h"
#include "vrpn_Tracker_OSVRHackerDevKit.h"
#include "vrpn_Streaming_Arduino.h"
#ifdef VRPN_USE_PHANTOM_SERVER
#include "vrpn_Phantom.h"
#endif
#include "g3log/g3log.hpp"
......
......@@ -9,7 +9,7 @@ set(iMSTK_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
list(INSERT CMAKE_MODULE_PATH 0 "${iMSTK_SOURCE_DIR}/CMake")
# iMSTK settings
set(iMSTK_USE_OMNI @iMSTK_USE_OMNI@)
set(iMSTK_USE_OpenHaptics @iMSTK_USE_OpenHaptics@)
set(iMSTK_USE_Vulkan @iMSTK_USE_Vulkan@)
set(VegaFEM_DIR @VegaFEM_DIR@)
set(VTK_DIR @VTK_DIR@)
......@@ -55,7 +55,7 @@ include( ${VTK_USE_FILE} )
find_package( VRPN REQUIRED )
include_directories( ${VRPN_INCLUDE_DIRS} )
add_definitions( -DVRPN_USE_LIBNIFALCON )
if(iMSTK_USE_OMNI)
if(iMSTK_USE_OpenHaptics)
add_definitions( -DiMSTK_USE_OPENHAPTICS )
add_definitions( -DVRPN_USE_PHANTOM_SERVER )
else()
......
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