# Runtime data for SteamVR. Staged into <build>/share/<project>/ (mirroring the install
# layout) so the binary can be run and registered straight from the build tree.

set(_share ${CMAKE_BINARY_DIR}/${VRDASH_SHARE_SUBDIR})

# Paths inside the manifest are relative to the manifest file itself. SteamVR reads the
# program path from a per-platform key and silently skips entries without one for its
# platform: binary_path_linux on x86-64, binary_path_linux_arm on aarch64 (Steam Frame).
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|ARM64)$")
    set(VRDASH_MANIFEST_BINARY_KEY binary_path_linux_arm)
else()
    set(VRDASH_MANIFEST_BINARY_KEY binary_path_linux)
endif()
configure_file(manifest.vrmanifest.in ${_share}/manifest.vrmanifest @ONLY)

set(_input_files input/actions.json input/bindings_frame_controller.json)
foreach(_file ${_input_files})
    configure_file(${_file} ${_share}/${_file} COPYONLY)
endforeach()

install(FILES ${_share}/manifest.vrmanifest DESTINATION ${VRDASH_SHARE_SUBDIR})
install(FILES ${_input_files} DESTINATION ${VRDASH_SHARE_SUBDIR}/input)

# Example settings file (copy to ~/.config/frameassistant/config.json and edit).
configure_file(config.example.json ${_share}/config.example.json COPYONLY)
install(FILES config.example.json DESTINATION ${VRDASH_SHARE_SUBDIR})
