NDK/C++ NativeActivity, arm64-v8a, Gradle 8.12 + AGP 8.7.3 + CMake 3.22.1. Implementacja (main.cpp): - EGL headless PBuffer context (wymagany przez OpenXR GLES binding) - xrCreateInstance z XR_FB_passthrough + XR_KHR_opengl_es_enable - xrCreateSession → XrGraphicsBindingOpenGLESAndroidKHR - XR_FB_passthrough: xrCreatePassthroughFB / xrCreatePassthroughLayerFB (dynamiczne PFN, graceful fallback gdy extension niedostępna) - Quad swapchain 512×256 — statyczny ciemnoniebieski panel 80×40 cm, 1 m przed użytkownikiem (przygotowany pod stb_truetype w fazie 5) - Pętla klatek: xrWaitFrame / xrBeginFrame / [passthrough + quad] / xrEndFrame - environmentBlendMode = OPAQUE (passthrough przez warstwę FB_passthrough) Brakujące pliki SDK (nie w git, lista w vr-poc/README.md): - libs/arm64-v8a/libopenxr_loader.so — z Meta OpenXR Mobile SDK - ovr_sdk/OpenXR/Include/openxr/*.h — nagłówki OpenXR Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
65 lines
2.4 KiB
CMake
65 lines
2.4 KiB
CMake
cmake_minimum_required(VERSION 3.22)
|
|
project(ipin_vr_poc VERSION 1 LANGUAGES C CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# ── Paths into ovr_sdk/ (one directory above app/) ───────────────────────────
|
|
set(OVR_SDK_ROOT "${CMAKE_SOURCE_DIR}/../ovr_sdk")
|
|
set(OPENXR_INCLUDE "${OVR_SDK_ROOT}/OpenXR/Include")
|
|
set(OPENXR_LIB_DIR "${CMAKE_SOURCE_DIR}/../libs/arm64-v8a")
|
|
|
|
if (NOT EXISTS "${OPENXR_INCLUDE}/openxr/openxr.h")
|
|
message(FATAL_ERROR
|
|
"openxr.h not found at ${OPENXR_INCLUDE}/openxr/openxr.h\n"
|
|
"See vr-poc/README.md §'Wymagane pliki SDK' for setup instructions.")
|
|
endif()
|
|
|
|
# ── android_native_app_glue (from NDK) ───────────────────────────────────────
|
|
add_library(native_app_glue STATIC
|
|
${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c
|
|
)
|
|
target_include_directories(native_app_glue PUBLIC
|
|
${ANDROID_NDK}/sources/android/native_app_glue
|
|
)
|
|
target_link_libraries(native_app_glue PUBLIC android log)
|
|
|
|
# ── OpenXR loader (prebuilt, from Meta OVR SDK → libs/arm64-v8a/) ─────────────
|
|
add_library(openxr_loader SHARED IMPORTED)
|
|
set_target_properties(openxr_loader PROPERTIES
|
|
IMPORTED_LOCATION "${OPENXR_LIB_DIR}/libopenxr_loader.so"
|
|
)
|
|
|
|
# ── NDK system libraries ──────────────────────────────────────────────────────
|
|
find_library(LIB_ANDROID android)
|
|
find_library(LIB_LOG log)
|
|
find_library(LIB_EGL EGL)
|
|
find_library(LIB_GLES3 GLESv3)
|
|
|
|
# ── Main native library ───────────────────────────────────────────────────────
|
|
add_library(ipin_vr_poc SHARED
|
|
src/main/cpp/main.cpp
|
|
)
|
|
|
|
target_include_directories(ipin_vr_poc PRIVATE
|
|
${OPENXR_INCLUDE}
|
|
${ANDROID_NDK}/sources/android/native_app_glue
|
|
)
|
|
|
|
target_compile_definitions(ipin_vr_poc PRIVATE
|
|
XR_USE_PLATFORM_ANDROID
|
|
XR_USE_GRAPHICS_API_OPENGL_ES
|
|
)
|
|
|
|
target_link_libraries(ipin_vr_poc PRIVATE
|
|
native_app_glue
|
|
openxr_loader
|
|
${LIB_ANDROID}
|
|
${LIB_LOG}
|
|
${LIB_EGL}
|
|
${LIB_GLES3}
|
|
)
|
|
|
|
# Force export of android_main (entry point for NativeActivity)
|
|
target_link_options(ipin_vr_poc PRIVATE "-Wl,--undefined=android_main")
|