Код: Выделить всё
cmake_minimum_required(VERSION 3.6)
project(Template)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Assimp
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "If the test suite for Assimp is built in addition to the library." FORCE)
set(ASSIMP_INSTALL OFF CACHE BOOL "Disable this if you want to use assimp as a submodule." FORCE)
# OpenAL
set(LIBTYPE STATIC CACHE STRING "Build OpenAL as a static library" FORCE)
set(ALSOFT_TESTS OFF CACHE BOOL "Build test programs")
set(ALSOFT_EXAMPLES OFF CACHE BOOL "Build example program")
# OpenXR
set(BUILD_TESTS OFF CACHE INTERNAL "Build tests")
set(BUILD_API_LAYERS ON CACHE INTERNAL "Use OpenXR layers")
# third party submodules
add_subdirectory(${CMAKE_SOURCE_DIR}/ThirdParty/OpenXR-SDK-Source openxr_build)
add_subdirectory(${CMAKE_SOURCE_DIR}/ThirdParty/openal-soft openal_build)
add_subdirectory(${CMAKE_SOURCE_DIR}/ThirdParty/assimp assimp_build)
# Collect all .cpp files in the cpp directory
file(GLOB_RECURSE SRC_FILES ${CMAKE_SOURCE_DIR}/main/cpp/*.cpp)
add_library(${PROJECT_NAME} SHARED
${SRC_FILES}
)
set(CMAKE_SHARED_LINKER_FLAGS
"${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate"
)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/main/cpp
)
# export ANativeActivity_onCreate for java to call.
set_property(
TARGET ${PROJECT_NAME}
APPEND_STRING
PROPERTY LINK_FLAGS " -u ANativeActivity_onCreate"
)
# native_app_glue
include(AndroidNdkModules)
android_ndk_import_module_native_app_glue()
# Link libraries to your native library
target_link_libraries(${PROJECT_NAME} PRIVATE
android
EGL
GLESv3
log
native_app_glue
jnigraphics
openxr_loader
OpenAL
assimp
)
Код: Выделить всё
ziparchive com.example.Template W Unable to open '/apex/com.meta.xr/priv-app/VrDriver/VrDriver.apk': No such file or directory
vulkan com.example.Template E failed to open apk '/apex/com.meta.xr/priv-app/VrDriver/VrDriver.apk': -11
vulkan com.example.Template D searching for layers in '/system/priv-app/VrDriver/VrDriver.apk!/lib/arm64-v8a'
DriverLoader com.example.Template I Calling into SetLegacyVrApiEntryPointOverride
VrApi_DriverLoader com.example.Template I SetLegacyVrApiEntryPointOverride: calling sprintf
VrApi_DriverLoader com.example.Template I SetLegacyVrApiEntryPointOverride: env buffer is '0x7634a60478'
VrApi_DriverLoader com.example.Template I SetLegacyVrApiEntryPointOverride: calling setenv
DriverLoader com.example.Template I Creating Temp JNIEnv
DriverLoader com.example.Template I Calling FindClass
DriverLoader com.example.Template I Calling RegisterNativeVrApiLoaderMethods
VrApi_DriverLoader com.example.Template I RegisterNativeVrApiLoaderMethods: calling RegisterNatives
DriverLoader com.example.Template I Calling RegisterNativeXrLoaderMethods
OpenXR_DriverLoader com.example.Template I RegisterNativeVrApiLoaderMethods: calling RegisterNatives
DriverLoader com.example.Template I Exiting JNI_OnLoad
OpenXR_ClientState com.example.Template I OpenXRClientState::create - from xrInitializeLoaderKHR
XrRuntimeS...lientState com.example.Template I SharedClientState::create called from 'OpenXRClientState::init'
Но если я удалю OpenAL из cmake (и все ссылки в cpp), удалите папки .cxx и build, чтобы принудительно выполнить чистую сборку, проект собирается, но происходит сбой, и это отображается в журнале.
Код: Выделить всё
---------------------------- PROCESS STARTED (30599) for package com.example.Template ----------------------------
com.example.Template W Entry not found
com.example.Template W Entry not found
com.example.Template W Warning: unable to resolve "/apex/com.meta.xr/priv-app/VrDriver/VrDriver.apk": No such file or directory (ignoring)
com.example.Template W JIT profile information will not be recorded: profile file does not exist.
com.example.Template W JIT profile information will not be recorded: profile file does not exist.
com.example.Template V ANGLE Developer option for 'com.example.Template' set to: 'default'
com.example.Template V ANGLE GameManagerService for com.example.Template: false
com.example.Template V Neither updatable production driver nor prerelease driver is supported.
com.example.Template D Compat change id reported: 175409949; UID 10152; state: DISABLED
com.example.Template D Compat change id reported: 175409951; UID 10152; state: ENABLED
com.example.Template D Compat change id reported: 175409956; UID 10152; state: DISABLED
com.example.Template D Compat change id reported: 175409950; UID 10152; state: DISABLED
com.example.Template D No Network Security Config specified, using platform default
com.example.Template D Compat change id reported: 175409952; UID 10152; state: DISABLED
com.example.Template D No Network Security Config specified, using platform default
---------------------------- PROCESS ENDED (30599) for package com.example.Template ----------------------------
com.example.Template E Unable to open zip file: /apex/com.meta.xr/priv-app/VrDriver/VrDriver.apk
com.example.Template E java.io.FileNotFoundException: /apex/com.meta.xr/priv-app/VrDriver/VrDriver.apk (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:265)
at java.util.zip.ZipFile.(ZipFile.java:187)
at java.util.jar.JarFile.(JarFile.java:169)
at java.util.jar.JarFile.(JarFile.java:106)
at libcore.io.ClassPathURLStreamHandler.(ClassPathURLStreamHandler.java:46)
at dalvik.system.DexPathList$NativeLibraryElement.maybeInit(DexPathList.java:858)
at dalvik.system.DexPathList$NativeLibraryElement.findNativeLibrary(DexPathList.java:879)
at dalvik.system.DexPathList.findLibrary(DexPathList.java:594)
at dalvik.system.BaseDexClassLoader.findLibrary(BaseDexClassLoader.java:301)
at android.app.NativeActivity.onCreate(NativeActivity.java:160)
at android.app.Activity.performCreate(Activity.java:8068)
at android.app.Activity.performCreate(Activity.java:8048)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3705)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3881)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2270)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:214)
at android.os.Looper.loop(Looper.java:304)
at android.app.ActivityThread.main(ActivityThread.java:7918)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1010)
com.example.Template D Shutting down VM
У меня есть несколько временных обходных путей, например сборка с помощью OpenAL, затем удаление ее из cmake и сборка снова, не удаляя .cxx и папки сборки, но Я хотел бы исправить эту проблему.
Я был бы признателен за любые советы о том, как мне можно отладить эту проблему или какие изменения я могу внести в свой проект, чтобы это исправить. Я могу включить файлы AndroidManifest и gradle, если это поможет решить эту проблему.
Подробнее здесь: https://stackoverflow.com/questions/793 ... ta-xr-priv