Commit 591503a4 authored by Alexis Girault's avatar Alexis Girault

Merge branch 'fix-libusb-windows' into 'master'

COMP: Fix COMP errors with LibNiFalcon

LibNifalcon should link against ftd2xx and not libusb1 on Windows. Add ftd2xx as an external project (binaries).

Works with the newest versions of VRPN and LibNiFalcon.

See merge request !91
parents 42b972d9 63299879
if(NOT WIN32)
message(WARNING "System not supported. Only Windows is supported for External_FTD2XX.cmake.")
message(WARNING "FTD2XX should not be needed on your system.")
return()
endif()
#-----------------------------------------------------------------------------
# Set project prefix path
#-----------------------------------------------------------------------------
set(FTD2XX_PREFIX ${CMAKE_BINARY_DIR}/External/FTD2XX)
set(FTD2XX_EXTRACT_DIR ${FTD2XX_PREFIX}/ftd2xx-2.12.18)
#-----------------------------------------------------------------------------
# Set install commands
#-----------------------------------------------------------------------------
set(ftd2xx_libdir "i386")
if(${CMAKE_GENERATOR} MATCHES "Win64")
set(ftd2xx_libdir "amd64")
endif()
set(copy_ftd2xx_shared_command
${CMAKE_COMMAND} -E copy_directory
${FTD2XX_EXTRACT_DIR}/${ftd2xx_libdir}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}
)
set(copy_ftd2xx_static_command
${CMAKE_COMMAND} -E copy
${FTD2XX_EXTRACT_DIR}/${ftd2xx_libdir}/ftd2xx.lib
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}
)
set(remove_ftd2xx_static_command
${CMAKE_COMMAND} -E remove
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/ftd2xx.lib
)
#-----------------------------------------------------------------------------
# Add External Project
#-----------------------------------------------------------------------------
include(imstkAddExternalProject)
imstk_add_external_project( FTD2XX
URL http://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.18%20WHQL%20Certified.zip
URL_MD5 e1a194765d7bcc58968d523484b74140
DOWNLOAD_DIR ${FTD2XX_PREFIX}
SOURCE_DIR ${FTD2XX_EXTRACT_DIR}
BINARY_DIR ${FTD2XX_EXTRACT_DIR}
UPDATE_COMMAND ${SKIP_STEP_COMMAND}
CONFIGURE_COMMAND ${SKIP_STEP_COMMAND}
BUILD_COMMAND ${SKIP_STEP_COMMAND}
INSTALL_COMMAND
${copy_ftd2xx_shared_command}
COMMAND ${copy_ftd2xx_static_command}
COMMAND ${remove_ftd2xx_static_command}
RELATIVE_INCLUDE_PATH "/"
#VERBOSE
)
......@@ -3,7 +3,7 @@
#-----------------------------------------------------------------------------
set(LIBNIFALCON_DEPENDENCIES "")
if(WIN32)
list(APPEND LIBNIFALCON_DEPENDENCIES "Libusb")
list(APPEND LIBNIFALCON_DEPENDENCIES "FTD2XX")
endif(WIN32)
include(imstkAddExternalProject)
......
......@@ -19,12 +19,18 @@ find_path(VRPN_INCLUDE_DIR
vrpn_Configure.h
)
mark_as_advanced(VRPN_INCLUDE_DIR)
list(APPEND VRPN_INCLUDE_DIRS
${VRPN_INCLUDE_DIR}
${VRPN_INCLUDE_DIR}/quat
${VRPN_INCLUDE_DIR}/atmellib
)
find_path(LIBNIFALCON_INCLUDE_DIR
NAMES
falcon/core/FalconDevice.h
)
mark_as_advanced(LIBNIFALCON_INCLUDE_DIR)
list(APPEND VRPN_INCLUDE_DIRS ${LIBNIFALCON_INCLUDE_DIR})
find_path(LIBUSB1_INCLUDE_DIR
NAMES
......@@ -32,17 +38,16 @@ find_path(LIBUSB1_INCLUDE_DIR
libusb-1.0/libusb.h
)
mark_as_advanced(LIBUSB1_INCLUDE_DIR)
list(APPEND VRPN_INCLUDE_DIRS ${LIBUSB1_INCLUDE_DIR})
#-----------------------------------------------------------------------------
# Set up include dirs
#-----------------------------------------------------------------------------
list(APPEND VRPN_INCLUDE_DIRS
${VRPN_INCLUDE_DIR}
${VRPN_INCLUDE_DIR}/quat
${VRPN_INCLUDE_DIR}/atmellib
${LIBNIFALCON_INCLUDE_DIR}
${LIBUSB1_INCLUDE_DIR}
)
if(WIN32)
find_path(LIBFTD2XX_INCLUDE_DIR
NAMES
ftd2xx.h
)
mark_as_advanced(LIBFTD2XX_INCLUDE_DIR)
list(APPEND VRPN_INCLUDE_DIRS ${LIBFTD2XX_INCLUDE_DIR})
endif()
#-----------------------------------------------------------------------------
# Find library
......@@ -53,6 +58,7 @@ find_library(VRPN_LIBRARY
vrpnserverd
)
mark_as_advanced(VRPN_LIBRARY)
list(APPEND VRPN_LIBRARIES ${VRPN_LIBRARY})
find_library(QUAT_LIBRARY
NAMES
......@@ -60,6 +66,7 @@ find_library(QUAT_LIBRARY
quatd
)
mark_as_advanced(QUAT_LIBRARY)
list(APPEND VRPN_LIBRARIES ${QUAT_LIBRARY})
find_library(LIBNIFALCON_LIBRARY
NAMES
......@@ -67,6 +74,7 @@ find_library(LIBNIFALCON_LIBRARY
nifalcon
)
mark_as_advanced(LIBNIFALCON_LIBRARY)
list(APPEND VRPN_LIBRARIES ${LIBNIFALCON_LIBRARY})
#works on windows, but sounds like it is needed only on linux, check vrpn/submodules/hidapi.cmake
find_library(LIBUSB1_LIBRARY
......@@ -75,6 +83,17 @@ find_library(LIBUSB1_LIBRARY
usb-1.0
)
mark_as_advanced(LIBUSB1_LIBRARY)
list(APPEND VRPN_LIBRARIES ${LIBUSB1_LIBRARY})
if(WIN32)
find_library(LIBFTD2XX_LIBRARY
NAMES
ftd2xx
libftd2xx
)
mark_as_advanced(LIBFTD2XX_LIBRARY)
list(APPEND VRPN_LIBRARIES ${LIBFTD2XX_LIBRARY})
endif()
#check vrpn/submodules/hidapi.cmake
if(WIN32)
......@@ -87,19 +106,9 @@ elseif(APPLE)
find_library(MACHID_IOKit_LIBRARY IOKit)
set(HIDAPI_LIBRARY ${MACHID_CoreFoundation_LIBRARY} ${MACHID_IOKit_LIBRARY})
endif()
list(APPEND VRPN_LIBRARIES ${HIDAPI_LIBRARY})
mark_as_advanced(HIDAPI_LIBRARY)
#-----------------------------------------------------------------------------
# Set up libraries
#-----------------------------------------------------------------------------
list(APPEND VRPN_LIBRARIES
${VRPN_LIBRARY}
${QUAT_LIBRARY}
${LIBNIFALCON_LIBRARY}
${LIBUSB1_LIBRARY}
${HIDAPI_LIBRARY}
)
#-----------------------------------------------------------------------------
# Phantom Omni support
#-----------------------------------------------------------------------------
......
......@@ -78,7 +78,8 @@ endif()
if(WIN32)
imstk_define_dependency(PThreads)
imstk_define_dependency(Libusb)
imstk_define_dependency(Libusb) #for VRPN
imstk_define_dependency(FTD2XX) #for LibNiFalcon
endif()
imstk_define_dependency(g3log)
......
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