diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a18a539578a15be4df0bf4a479313c2976caabb..1c07d83dd1467f4fe7013b5878984f603ac2096b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,6 +168,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") pkg_check_modules(SURVIVE IMPORTED_TARGET survive) endif() +if(WIN32) + set(SURVIVE_INCLUDE_DIRS "" CACHE PATH "") + set(SURVIVE_LIBRARIES "" CACHE FILEPATH "") + + set(SURVIVE_FOUND ON) +endif() + # Find a external SLAM implementation set(EXTERNAL_SLAM_SYSTEMS kimera_vio basalt) foreach(slam_system IN LISTS EXTERNAL_SLAM_SYSTEMS) diff --git a/src/xrt/drivers/CMakeLists.txt b/src/xrt/drivers/CMakeLists.txt index 020588c64ec7bf37efc0d2b9cc92bcfa8c9671ca..f89a1d4e34f301952c5abbaaab74c31d5e1b321c 100644 --- a/src/xrt/drivers/CMakeLists.txt +++ b/src/xrt/drivers/CMakeLists.txt @@ -247,16 +247,30 @@ if(XRT_BUILD_DRIVER_SURVIVE) drv_survive STATIC survive/survive_driver.c survive/survive_driver.h survive/survive_interface.h survive/survive_prober.c ) - target_link_libraries( - drv_survive - PRIVATE - xrt-interfaces - aux_os - aux_util - aux_math - aux_vive - PkgConfig::SURVIVE - ) + if(WIN32) + target_link_libraries( + drv_survive + PRIVATE + xrt-interfaces + aux_os + aux_util + aux_math + aux_vive + ${SURVIVE_LIBRARIES} + ) + target_include_directories(drv_survive PRIVATE ${SURVIVE_INCLUDE_DIRS}) + else() + target_link_libraries( + drv_survive + PRIVATE + xrt-interfaces + aux_os + aux_util + aux_math + aux_vive + PkgConfig::SURVIVE + ) + endif() list(APPEND ENABLED_HEADSET_DRIVERS survive) if(XRT_BUILD_DRIVER_HANDTRACKING) diff --git a/src/xrt/drivers/survive/survive_driver.c b/src/xrt/drivers/survive/survive_driver.c index b7f2341be067e57f976d1972301cace5b00e332c..57f374bed6809477b0ccb6eb1d248e6a1c455746 100644 --- a/src/xrt/drivers/survive/survive_driver.c +++ b/src/xrt/drivers/survive/survive_driver.c @@ -231,9 +231,13 @@ survive_device_destroy(struct xrt_device *xdev) static double survive_timecode_now_s() { +#ifdef XRT_OS_WINDOWS + return (double)os_monotonic_get_ns() / 1000000000.; +#else struct timeval tv; gettimeofday(&tv, 0); return ((double)tv.tv_usec) / 1000000. + (tv.tv_sec); +#endif } static timepoint_ns @@ -1397,6 +1401,10 @@ survive_device_autoprobe(struct xrt_auto_prober *xap, return 0; } +#ifdef XRT_OS_WINDOWS + os_thread_helper_init(&ss->event_thread); +#endif + ret = os_thread_helper_start(&ss->event_thread, run_event_thread, ss); if (ret != 0) { U_LOG_IFL_E(ss->log_level, "Failed to start event thread!"); diff --git a/src/xrt/drivers/vive/vive_win32.h b/src/xrt/drivers/vive/vive_win32.h new file mode 100644 index 0000000000000000000000000000000000000000..ade3c7b1d7ef454daf2f503138ae8fbbfd335596 --- /dev/null +++ b/src/xrt/drivers/vive/vive_win32.h @@ -0,0 +1,13 @@ +// Copyright 2016-2019, Philipp Zabel +// Copyright 2019, Collabora, Ltd. +// SPDX-License-Identifier: BSL-1.0 +/*! + * @file + * @brief Common vive header + * @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com> + * @ingroup drv_vive + */ + +#pragma once + +#define VIVE_ATTRIBUTE_PACKED