<commit_before># This generates a header file, from the named json file, containing a string literal
# named com_osvr_VideoBasedHMDTracker_json (not null terminated)
# The file must be added as a source file to some target (as below) to be generated.
osvr_convert_json(com_osvr_VideoBasedHMDTracker_json
    com_osvr_VideoBasedHMDTracker.json
    "${CMAKE_CURRENT_BINARY_DIR}/com_osvr_VideoBasedHMDTracker_json.h")

# Be able to find our generated header file, have shared files find us, and have us find shared files.
include_directories("${CMAKE_CURRENT_BINARY_DIR}"
    "${CMAKE_CURRENT_SOURCE_DIR}"
    "${OSVR_VIDEOTRACKERSHARED_INCLUDE_DIR}")
if(WIN32)
    include_directories("${CMAKE_CURRENT_SOURCE_DIR}/DirectShowCameraLib")
endif()

if(WIN32)
    option(OSVR_FPE
        "Enable floating-point exceptions - only works with MSVC and should never be used for shipping code!"
        OFF)
    mark_as_advanced(OSVR_FPE)
endif()

# Make sure we can link these upcoming static libraries into a shared lib
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

###
# Build a separate static library with the core of the video-based tracker
###
add_library(vbtracker-core STATIC
    BeaconBasedPoseEstimator.cpp
    BeaconBasedPoseEstimator_Kalman.cpp
    BeaconBasedPoseEstimator.h
    HDKLedIdentifier.cpp
    HDKLedIdentifier.h
    HDKLedIdentifierFactory.cpp
    HDKLedIdentifierFactory.h
    ImagePointMeasurement.h
    LedIdentifier.cpp
    LedIdentifier.h
    LED.cpp
    LED.h
    Types.h
    VideoBasedTracker.cpp
    VideoBasedTracker.h
    ${OSVR_VIDEOTRACKERSHARED_SOURCES_CORE}
    ${OSVR_VIDEOTRACKERSHARED_SOURCES_HDKDATA})

target_link_libraries(vbtracker-core
    PUBLIC
    ${VIDEOTRACKER_EXTRA_LIBS}
    opencv_core
    osvrUtilCpp # for typedefs and boost headers
    osvrKalman
    vendored-vrpn # for quatlib
    eigen-headers)
target_compile_options(vbtracker-core
    PUBLIC
    ${OSVR_CXX11_FLAGS})

set_target_properties(vbtracker-core PROPERTIES
    FOLDER "OSVR Plugins/Video-Based Tracker")


if(WIN32)
    add_subdirectory(DirectShowCameraLib)
endif()

if(NOT WIN32)
    find_package(libuvc REQUIRED)
endif()

###
# Build the plugin
###
set(PLUGIN_SOURCES
    com_osvr_VideoBasedHMDTracker.cpp
    Oculus_DK2.cpp
    Oculus_DK2.h
    "${CMAKE_CURRENT_BINARY_DIR}/com_osvr_VideoBasedHMDTracker_json.h"
    CVImageSource.cpp
    DK2ImageSource.cpp
    ConfigurationParser.h
    ImageSource.cpp
    ImageSource.h
    ImageSourceFactories.h
    SetupSensors.h
    FakeImageSource.cpp
    ${OSVR_VIDEOTRACKERSHARED_SOURCES_IO})
if(WIN32)
    list(APPEND PLUGIN_SOURCES
        DirectShowHDKCameraFactory.h
        DirectShowImageSource.cpp
        DirectShowToCV.h)
else()
    list(APPEND PLUGIN_SOURCES
        UVCImageSource.cpp)
endif()

osvr_add_plugin(NAME com_osvr_VideoBasedHMDTracker
    CPP # indicates we'd like to use the C++ wrapper
    SOURCES
    ${PLUGIN_SOURCES}
)

target_link_libraries(com_osvr_VideoBasedHMDTracker
    vbtracker-core
    vendored-hidapi
    JsonCpp::JsonCpp
)
if(WIN32)
    target_link_libraries(com_osvr_VideoBasedHMDTracker directshow-camera)
    add_executable(ViewTrackingCamera
        DirectShowToCV.h
        ViewTrackingCamera.cpp)
    target_link_libraries(ViewTrackingCamera PRIVATE
        opencv_core
        opencv_highgui
        ${VIDEOTRACKER_EXTRA_LIBS}
        directshow-camera)
    set_target_properties(ViewTrackingCamera PROPERTIES
        FOLDER "OSVR Plugins/Video-Based Tracker")
else()
    target_link_libraries(com_osvr_VideoBasedHMDTracker ${libuvc_LIBRARIES})
    target_include_directories(com_osvr_VideoBasedHMDTracker PRIVATE ${libuvc_INCLUDE_DIRS})
endif()

set_target_properties(com_osvr_VideoBasedHMDTracker PROPERTIES
    FOLDER "OSVR Plugins/Video-Based Tracker")

###
# Calibration utility
###
if(WIN32)
    set(CALIB_SOURCES
        VideoTrackerCalibrationUtility.cpp
        ConfigurationParser.h<commit_msg>Fix for libusb build dependency<commit_after># This generates a header file, from the named json file, containing a string literal
# named com_osvr_VideoBasedHMDTracker_json (not null terminated)
# The file must be added as a source file to some target (as below) to be generated.
osvr_convert_json(com_osvr_VideoBasedHMDTracker_json
    com_osvr_VideoBasedHMDTracker.json
    "${CMAKE_CURRENT_BINARY_DIR}/com_osvr_VideoBasedHMDTracker_json.h")

# Be able to find our generated header file, have shared files find us, and have us find shared files.
include_directories("${CMAKE_CURRENT_BINARY_DIR}"
    "${CMAKE_CURRENT_SOURCE_DIR}"
    "${OSVR_VIDEOTRACKERSHARED_INCLUDE_DIR}")
if(WIN32)
    include_directories("${CMAKE_CURRENT_SOURCE_DIR}/DirectShowCameraLib")
endif()

if(WIN32)
    option(OSVR_FPE
        "Enable floating-point exceptions - only works with MSVC and should never be used for shipping code!"
        OFF)
    mark_as_advanced(OSVR_FPE)
endif()

# Make sure we can link these upcoming static libraries into a shared lib
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

###
# Build a separate static library with the core of the video-based tracker
###
add_library(vbtracker-core STATIC
    BeaconBasedPoseEstimator.cpp
    BeaconBasedPoseEstimator_Kalman.cpp
    BeaconBasedPoseEstimator.h
    HDKLedIdentifier.cpp
    HDKLedIdentifier.h
    HDKLedIdentifierFactory.cpp
    HDKLedIdentifierFactory.h
    ImagePointMeasurement.h
    LedIdentifier.cpp
    LedIdentifier.h
    LED.cpp
    LED.h
    Types.h
    VideoBasedTracker.cpp
    VideoBasedTracker.h
    ${OSVR_VIDEOTRACKERSHARED_SOURCES_CORE}
    ${OSVR_VIDEOTRACKERSHARED_SOURCES_HDKDATA})

target_link_libraries(vbtracker-core
    PUBLIC
    ${VIDEOTRACKER_EXTRA_LIBS}
    opencv_core
    osvrUtilCpp # for typedefs and boost headers
    osvrKalman
    vendored-vrpn # for quatlib
    eigen-headers)
target_compile_options(vbtracker-core
    PUBLIC
    ${OSVR_CXX11_FLAGS})

set_target_properties(vbtracker-core PROPERTIES
    FOLDER "OSVR Plugins/Video-Based Tracker")


if(WIN32)
    add_subdirectory(DirectShowCameraLib)
endif()

if(NOT WIN32)
    find_package(libuvc REQUIRED)
    find_package(PkgConfig)
    pkg_check_modules(LIBUSB libusb-1.0)
endif()

###
# Build the plugin
###
set(PLUGIN_SOURCES
    com_osvr_VideoBasedHMDTracker.cpp
    Oculus_DK2.cpp
    Oculus_DK2.h
    "${CMAKE_CURRENT_BINARY_DIR}/com_osvr_VideoBasedHMDTracker_json.h"
    CVImageSource.cpp
    DK2ImageSource.cpp
    ConfigurationParser.h
    ImageSource.cpp
    ImageSource.h
    ImageSourceFactories.h
    SetupSensors.h
    FakeImageSource.cpp
    ${OSVR_VIDEOTRACKERSHARED_SOURCES_IO})
if(WIN32)
    list(APPEND PLUGIN_SOURCES
        DirectShowHDKCameraFactory.h
        DirectShowImageSource.cpp
        DirectShowToCV.h)
else()
    list(APPEND PLUGIN_SOURCES
        UVCImageSource.cpp)
endif()

osvr_add_plugin(NAME com_osvr_VideoBasedHMDTracker
    CPP # indicates we'd like to use the C++ wrapper
    SOURCES
    ${PLUGIN_SOURCES}
)

target_link_libraries(com_osvr_VideoBasedHMDTracker
    vbtracker-core
    vendored-hidapi
    JsonCpp::JsonCpp
)
if(WIN32)
    target_link_libraries(com_osvr_VideoBasedHMDTracker directshow-camera)
    add_executable(ViewTrackingCamera
        DirectShowToCV.h
        ViewTrackingCamera.cpp)
    target_link_libraries(ViewTrackingCamera PRIVATE
        opencv_core
        opencv_highgui
        ${VIDEOTRACKER_EXTRA_LIBS}
        directshow-camera)
    set_target_properties(ViewTrackingCamera PROPERTIES
        FOLDER "OSVR Plugins/Video-Based Tracker")
else()
    target_link_libraries(com_osvr_VideoBasedHMDTracker ${libuvc_LIBRARIES} ${LIBUSB_LIBRARIES})
    target_include_directories(com_osvr_VideoBasedHMDTracker PRIVATE ${libuvc_INCLUDE_DIRS} ${LIBUSB_INCLUDE_DIRS})
endif()

set_target_properties(com_osvr_VideoBasedHMDTracker PROPERTIES
    FOLDER "OSVR Plugins/Video-Based Tracker")

###
# Calibration utility
###
if(WIN32)
    set(CALIB_SOURCES
        VideoTrackerCalibrationUtility.cpp
        ConfigurationParser.h
{'fraction_non_alphanumeric': 0.06484986121625032, 'fraction_numerical': 0.005046681806712087, 'mean_word_length': 4.444368131868132, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1998002', 'n_tokens_mistral': 2784, 'n_tokens_neox': 2703, 'n_words': 498}