@PACKAGE_INIT@

set(export_config_name "@export_config_name@")

set_and_check(${export_config_name}Targets "${CMAKE_CURRENT_LIST_DIR}/${export_config_name}Targets.cmake")

include(${${export_config_name}Targets})
include(CMakeFindDependencyMacro)

# iMSTK settings
set(iMSTK_ROOT ${PACKAGE_PREFIX_DIR})
set(iMSTK_DATA_DIR ${PACKAGE_PREFIX_DIR}/data)
set(iMSTK_USE_Vulkan @iMSTK_USE_Vulkan@)
set(iMSTK_USE_OpenHaptics @iMSTK_USE_OpenHaptics@)
set(iMSTK_BUILD_TESTING @iMSTK_BUILD_TESTING@)

# Use the iMSTK modules to find all required packages
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/modules")
include(${CMAKE_CURRENT_LIST_DIR}/modules/imstkFind.cmake)
include(CMakeFindDependencyMacro)
set(CMAKE_DEBUG_POSTFIX @CMAKE_DEBUG_POSTFIX@)

# Assimp
find_package( Assimp REQUIRED )

# Eigen3
set(Eigen3_DIR @Eigen3_DIR@)
find_dependency( Eigen3 REQUIRED )

# FTD2XX
if(WIN32)
  find_package( FTD2XX REQUIRED )
endif()

# g3log
find_package( g3log REQUIRED )

# glm
set(glm_DIR @glm_DIR@)
find_dependency( glm REQUIRED )

# GTest
if(iMSTK_BUILD_TESTING)
  set(GTest_DIR @GTest_DIR@)
  find_dependency( GTest REQUIRED NO_DEFAULT_PATH )
endif()

# imgui
find_package( imgui REQUIRED )

# LibNiFalcon
find_package( LibNiFalcon REQUIRED)

# Libusb
find_package( Libusb REQUIRED)

# OpenVR
find_package( openvr REQUIRED )

# PhysX
find_package(PhysX REQUIRED)

#SCCD
find_package( SCCD REQUIRED )

# SFML
if(WIN32)
  find_package( SFML REQUIRED )
  add_definitions( -DiMSTK_AUDIO_ENABLED )
endif()

# tbb
find_package(tbb REQUIRED)
if (MSVC)
  add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE=1)
endif()

# VegaFEM
set(VegaFEM_DIR "@VegaFEM_DIR@")
find_dependency( VegaFEM REQUIRED CONFIG )

# VRPN
if (iMSTK_USE_VRPN)
  find_package( VRPN REQUIRED )
endif()

# OpenHaptics
if(iMSTK_USE_OpenHaptics)
  find_package( OpenHapticsSDK REQUIRED )
  add_definitions( -DiMSTK_USE_OPENHAPTICS )
endif()

# VTK
list(GET OPENVR_INCLUDE_DIRS 0 OpenVR_INCLUDE_DIR)
list(GET OPENVR_LIBRARIES 1 OpenVR_LIBRARY)
set(OpenVR_INCLUDE_DIR ${OpenVR_INCLUDE_DIR} CACHE INTERNAL "")
set(OpenVR_LIBRARY ${OpenVR_LIBRARY} CACHE INTERNAL "")
set(VTK_DIR @VTK_DIR@)
find_dependency(VTK CONFIG)
# modules are linked via `VTK::CommonCore`
# vtk_module_autoinit is needed
find_dependency(VTK COMPONENTS
  ChartsCore
  CommonCore
  CommonDataModel
  FiltersCore
  FiltersExtraction
  FiltersGeneral
  FiltersModeling
  FiltersSources
  IOExport
  IOImport
  IOPLY
  IOParallel
  IOParallelXML
  ImagingCore
  ImagingGeneral
  ImagingStencil
  InteractionStyle
  RenderingAnnotation
  RenderingContext2D
  RenderingContextOpenGL2
  RenderingCore
  RenderingOpenGL2
  RenderingOpenVR
  RenderingVolume
  RenderingVolumeOpenGL2
  ViewsContext2D)
find_dependency(VTK COMPONENTS ${VTK_DEPENDENCIES})

# glfw, gli
if(iMSTK_USE_Vulkan)
  find_package( glfw REQUIRED )
  find_package( gli REQUIRED )
  find_package( VulkanSDK REQUIRED)
  add_definitions( -DiMSTK_USE_Vulkan )
endif()
