ESP32 Environment Setup
The ESP32 line follows the official ESP-IDF workflow directly.
Official entry:
For ESP32-C3 / S3 / C6 and other chips, see the getting-started page of that chip.
Project Integration
LibXR still integrates on ESP32 through cmake/esp32.cmake, but the precondition is explicit: it must run inside an ESP-IDF component project.
For a standard ESP-IDF Hello World style project, finish idf_component_register(...) in main/CMakeLists.txt first, then append:
include(path_to_libxr/cmake/esp32.cmake)
path_to_libxr is the path of LibXR; the line goes after idf_component_register(...).
What esp32.cmake Does
The script does the following:
- sets
LIBXR_SYSTEM=freertosandLIBXR_DRIVER=esp, and turns onLIBXR_STATIC_BUILD - when
LIBXR_SINGLE_COREis not defined, sets it fromCONFIG_SOC_CPU_CORES_NUMandCONFIG_FREERTOS_UNICORE:OFFon a multi-core chip withoutCONFIG_FREERTOS_UNICORE,ONotherwise - adds LibXR with
add_subdirectorywhen targetxrdoes not exist yet - links
xrto the IDF components that exist:idf::freertos,idf::driver,idf::hal,idf::usb,idf::esp_hw_support,idf::esp_timer,idf::esp_event,idf::esp_netif,idf::esp_wifi,idf::esp_adc,idf::nvs_flash, and the splitidf::esp_driver_gpioandidf::esp_driver_ledcof newer IDF versions - finally links
xrto the current component (target_link_libraries(${COMPONENT_LIB} PUBLIC xr)), which is why theincludeline goes afteridf_component_register(...)
The script checks that idf::freertos exists and fails otherwise, so it works only in a component built by idf.py.
Current Environment Note
The docker-image-esp32 image ships ESP-IDF v5.4.1. Newer stable 5.x releases use the same integration; the component split and directory layout follow the installed IDF.