Files
WiVRn/docs/building.md
T

4.4 KiB

Building

Server (PC)

Compile

From your checkout directory

cmake -B build-server . -GNinja -DWIVRN_BUILD_CLIENT=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build-server

By default, all encoders are enabled. It is possible to disable them at build time with the following options:

-DWIVRN_USE_NVENC=OFF
-DWIVRN_USE_VAAPI=OFF
-DWIVRN_USE_VULKAN_ENCODE=OFF
-DWIVRN_USE_X264=OFF

wivrnctl is an optional tool enabled by default and the only part that requires libsystemd/libelogind. It can be disabled with

-DWIVRN_USE_WIVRNCTL=OFF

Lighthouse driver support for use with lighthouse-tracked devices

-DWIVRN_FEATURE_STEAMVR_LIGHTHOUSE=ON

For a few dependencies it is possible to select system or embedded versions, check WIVRN_USE_SYSTEM_xxx in case you are missing dependencies.

For more advanced options, check CMakeLists.txt.

For the Flatpak, see flatpak.

Profiling / tracing build

To build the server with Perfetto tracing for local profiling, use the server-tracing preset (it is the server preset plus WIVRN_USE_PERFETTO=ON):

cmake --preset server-tracing
cmake --build build-server-tracing

This requires the Perfetto amalgamated SDK installed where CMake looks for it (/usr/share/perfetto/sdk/perfetto.{h,cc}, override with -DPERFETTO_SDK_DIR=<dir>). Tracing is gated at runtime by the WIVRN_TRACING env var, so a tracing-enabled build has no cost until you set it.

To also instrument Monado under the same switch, use the server-tracing-monado preset (adds WIVRN_TRACE_MONADO=ON); this requires percetto to be discoverable at configure time.

See profiling for how to run the server with tracing and capture/analyse traces.

Dashboard

The WiVRn dashboard requires Qt6, Kirigami, and the WiVRn server.

Compile

From your checkout directory, compile both the server and the dashboard:

cmake -B build-dashboard . -GNinja -DWIVRN_BUILD_CLIENT=OFF -DWIVRN_BUILD_SERVER=ON -DWIVRN_BUILD_DASHBOARD=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build-dashboard

See Server for the server compile options.

Client (headset)

Build dependencies

As Arch package names: git pkgconf glslang cmake jdk17-openjdk librsvg cli11 ktx-software-bin (AUR)

OpenSSL build dependencies are also needed, as described here, in particular perl 5.

CMake 4.5 is required.

Android environment

Download sdkmanager commandline tool and extract it to any directory. Create your ANDROID_HOME directory, for instance ~/Android.

Review and accept the licenses with

sdkmanager --sdk_root="${HOME}/Android" --licenses

Apk signing

Your device may refuse to install an unsigned apk, so you must create signing keys before building the client

# Create key, then enter the password and other information that the tool asks for
keytool -genkey -v -keystore ks.keystore -alias default_key -keyalg RSA -keysize 2048 -validity 10000

Once you have generated the keys, the apk will be automatically signed at build time

Client build

From the main directory.


# Substitute your password that you entered in the keytool command above instead of YOUR_PASSWORD

cmake --preset android-Release -DCPACK_APK_KEYSTORE=ks.keystore -DCPACK_APK_KEYSTORE_PASSWORD="YOUR_PASSWORD" -DCPACK_APK_KEY_ALIAS=default_key -DCPACK_APK_KEY_PASSWORD="YOUR_PASSWORD"

cd build-android-Release
ninja
cpack

Outputs will be in build-android-Release/WiVRn.apk

Install apk with adb

Before using adb you must enable usb debugging on your device:

Also add your device in udev rules: https://wiki.archlinux.org/title/Android_Debug_Bridge#Adding_udev_rules

Then connect the device via usb to your computer and execute the following commands

# Start adb server
adb start-server

# Check if the device is connected
adb devices

# Install apk
adb install build-android-Release/WiVRn.apk

# When you're done, you can stop the adb server
adb kill-server