Skip to content

Instantly share code, notes, and snippets.

@shinyquagsire23
Last active April 2, 2024 09:19
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shinyquagsire23/3c68aecd872cc7ac21c28e950245dbd2 to your computer and use it in GitHub Desktop.
Save shinyquagsire23/3c68aecd872cc7ac21c28e950245dbd2 to your computer and use it in GitHub Desktop.
Monado macOS and Linux Quest Link Build Guide
#
# Installing dependencies (Tested on Ubuntu 22.04 LTS)
#
# Monado
sudo apt install cmake ninja-build
sudo apt install build-essential git wget unzip cmake ninja-build libeigen3-dev curl patch python3 pkg-config libx11-dev libx11-xcb-dev libxxf86vm-dev libxrandr-dev libxcb-randr0-dev libvulkan-dev glslang-tools libglvnd-dev libgl1-mesa-dev ca-certificates libusb-1.0-0-dev libudev-dev libhidapi-dev libwayland-dev libuvc-dev libavcodec-dev libopencv-dev libv4l-dev libcjson-dev libsdl2-dev libegl1-mesa-dev libbsd-dev
# XRSP (Quest Link USB)
sudo apt install capnproto libcapnp-dev libx264-dev nlohmann-json3-dev
# Test app
sudo apt install libglew-dev libglfw3-dev libopenxr-dev # Test app
#
# Install udev rules
#
#
sudo touch /etc/udev/rules.d/53-quest.rules
sudo nano /etc/udev/rules.d/53-quest.rules
# Paste the following rules:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2833", MODE="0666"
SUBSYSTEMS=="usb_device", ATTRS{idVendor}=="2833", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2d40", MODE="0666"
SUBSYSTEMS=="usb_device", ATTRS{idVendor}=="2d40", MODE="0666"
#
# Monado OpenXR runtime
#
git clone --branch macos_ql_merge https://github.com/shinyquagsire23/monado.git
cd monado && mkdir -p build && cd build
cmake .. -DXRT_ENABLE_GPL=1 -DXRT_HAVE_SYSTEM_CJSON=0 -DXRT_BUILD_DRIVER_QUEST_LINK=1
make
pwd # Note down the path outputted for below vvv
cd ../..
# Add the following to your .bashrc
# export XR_RUNTIME_JSON=REPLACE/THIS/PATH/TO/openxr_monado-dev.json
source ~/.bashrc
#
# Running monado_service
#
cd monado/build
# Intel
XRT_COMPOSITOR_COMPUTE=1 XRT_COMPOSITOR_FORCE_XCB=1 ./src/xrt/targets/service/monado-service
# NVIDIA (optimus)
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only XRT_COMPOSITOR_COMPUTE=1 XRT_COMPOSITOR_FORCE_XCB=1 QL_OVERRIDE_SCALE=0.75 QL_THREADS_PER_SLICE=8 ./src/xrt/targets/service/monado-service
#
# OpenXR example app
#
git clone -b linux https://github.com/shinyquagsire23/openxr-vulkan-example-macos.git
cd openxr-vulkan-example-macos
mkdir -p build && cd build
cmake .. && cd ..
./build.sh
#
# OpenVR (SteamVR)
# See also: https://gitlab.com/znixian/OpenOVR/-/blob/openxr/README.md
# Note: Beat Saber requires an older build, SteamVR home does not work.
#
git clone https://gitlab.com/znixian/OpenOVR.git
cd OpenOVR
mkdir build && cd build
cmake .. && make -j8
cd ../..
# Add the following to your .bashrc
# export VR_OVERRIDE=REPLACE/THIS/PATH/TO/OpenOVR/build
# export PRESSURE_VESSEL_FILESYSTEMS_RW=$XDG_RUNTIME_DIR/monado_comp_ipc
source ~/.bashrc
#
# Installing dependencies and MoltenVK (Tested on macOS 14.0 Sonoma)
#
# Monado
brew install eigen sdl2 libusb curl
# DEPRECATED MoltenVK install
#brew tap apenngrace/homebrew-vulkan
#brew install vulkan-sdk
#cp -r /usr/local/include/vulkan /opt/homebrew/include/vulkan
# Add the following (or similar, your version may be newer) to .zshrc:
# export VULKAN_SDK=/opt/homebrew/Caskroom/vulkan-sdk/1.2.162.1/macOS
# MoltenVK install
# Install using the installer at https://vulkan.lunarg.com/sdk/home.
#
# Add the following (or similar, your version may be newer) to .zshrc:
# export VULKAN_SDK=$HOME/VulkanSDK/1.3.250.1/macOS/
# export PATH="$VULKAN_SDK/bin:$PATH"
# HACK: For some reason the Vulkan loader is just straight up broken, even
# vulkaninfo doesn't work.
mv $VULKAN_SDK/lib/libvulkan.1.3.250.dylib $VULKAN_SDK/lib/libvulkan.1.3.250.dylib_
mv $VULKAN_SDK/lib/libvulkan.1.dylib $VULKAN_SDK/lib/libvulkan.1.dylib_
mv $VULKAN_SDK/lib/libvulkan.dylib $VULKAN_SDK/lib/libvulkan.dylib_
cp $VULKAN_SDK/lib/libMoltenVK.dylib $VULKAN_SDK/liblibvulkan.1.3.250.dylib
cp $VULKAN_SDK/lib/libMoltenVK.dylib $VULKAN_SDK/lib/libvulkan.1.dylib
cp $VULKAN_SDK/lib/libMoltenVK.dylib $VULKAN_SDK/lib/libvulkan.dylib
# Reload zshrc
source ~/.zshrc
# WiVRn and openxr-vulkan-example
brew install ffmpeg x264 nlohmann-json glfw glm glew
# XRSP (Quest Link USB)
brew install capnp
# Technically not needed
brew install libx11 libxrandr libxcb xquartz
#
# Monado OpenXR runtime
#
git clone --branch macos_ql_merge https://github.com/shinyquagsire23/monado.git
cd monado && mkdir -p build && cd build
cmake .. -DXRT_ENABLE_GPL=1 -DXRT_BUILD_DRIVER_EUROC=0 -DXRT_BUILD_DRIVER_NS=0 -DXRT_BUILD_DRIVER_PSVR=0 -DXRT_HAVE_OPENCV=0 -DXRT_HAVE_XCB=0 -DXRT_HAVE_XLIB=0 -DXRT_HAVE_XRANDR=0 -DXRT_HAVE_SDL2=0 -DXRT_HAVE_VT=0 -DXRT_FEATURE_WINDOW_PEEK=0 -DXRT_BUILD_DRIVER_QWERTY=0 -DXRT_BUILD_DRIVER_WMR=0 -DXRT_FEATURE_SERVICE=0 -DXRT_FEATURE_STEAMVR_PLUGIN=0 -DXRT_MODULE_IPC=0
make
pwd # Note down the path outputted for below vvv
cd ../..
# Add the following to your .zshrc
# export XR_RUNTIME_JSON=REPLACE/THIS/PATH/TO/openxr_monado-dev.json
source ~/.zshrc
#
# OpenXR SDK (for headers + pkgconfig + libopenxr_loader.dylib)
#
git clone https://github.com/KhronosGroup/OpenXR-SDK.git
cd OpenXR-SDK
curl -O https://gist.githubusercontent.com/shinyquagsire23/1e3d38940d7381181ff88f11a5550547/raw/de7bfe289e286492e8328855f1f1efbaa95e1a40/openxr-sdk-loader-macos.patch
git apply openxr-sdk-loader-macos.patch
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/opt/homebrew/ ..
make install
cd ../..
#
# OpenXR example app
#
git clone https://github.com/shinyquagsire23/openxr-vulkan-example-macos.git
cd openxr-vulkan-example-macos
mkdir -p build && cd build
cmake .. && cd ..
./build.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment