From 60ee7f31f6d1e56f26516a4c5c71754ef71e0432 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 25 Sep 2023 11:28:56 +0800 Subject: [PATCH 1/3] Fix XR header include and don't build XRInterface.cpp if XR is disabled. --- native/CMakeLists.txt | 9 +++++++-- native/cocos/core/Root.cpp | 2 +- native/cocos/platform/android/AndroidPlatform.cpp | 3 +++ native/cocos/renderer/gfx-gles3/GLES3Device.cpp | 2 +- native/cocos/scene/Camera.h | 2 +- native/cocos/xr/XRRemotePreviewManager.cpp | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt index 07f6eae2f68..d26dfee13c2 100644 --- a/native/CMakeLists.txt +++ b/native/CMakeLists.txt @@ -726,9 +726,14 @@ elseif(ANDROID OR OHOS) cocos/platform/java/modules/SystemWindow.h cocos/platform/java/modules/SystemWindowManager.cpp cocos/platform/java/modules/SystemWindowManager.h - cocos/platform/java/modules/XRInterface.cpp - cocos/platform/java/modules/XRInterface.h ) + + if(USE_XR) + cocos_source_files( + cocos/platform/java/modules/XRInterface.cpp + cocos/platform/java/modules/XRInterface.h + ) + endif() endif() if(ANDROID) diff --git a/native/cocos/core/Root.cpp b/native/cocos/core/Root.cpp index a08d9d8fbca..6636e58865d 100644 --- a/native/cocos/core/Root.cpp +++ b/native/cocos/core/Root.cpp @@ -30,7 +30,7 @@ #include "platform/interfaces/modules/IScreen.h" #include "platform/interfaces/modules/ISystemWindow.h" #include "platform/interfaces/modules/ISystemWindowManager.h" -#include "platform/java/modules/XRInterface.h" +#include "platform/java/modules/IXRInterface.h" #if CC_USE_DEBUG_RENDERER #include "profiler/DebugRenderer.h" #endif diff --git a/native/cocos/platform/android/AndroidPlatform.cpp b/native/cocos/platform/android/AndroidPlatform.cpp index b14f3e2732f..b13b69bb60d 100644 --- a/native/cocos/platform/android/AndroidPlatform.cpp +++ b/native/cocos/platform/android/AndroidPlatform.cpp @@ -42,7 +42,10 @@ #include "platform/java/modules/SystemWindow.h" #include "platform/java/modules/SystemWindowManager.h" #include "platform/java/modules/Vibrator.h" + +#if CC_USE_XR #include "platform/java/modules/XRInterface.h" +#endif #include "base/StringUtil.h" #include "engine/EngineEvents.h" diff --git a/native/cocos/renderer/gfx-gles3/GLES3Device.cpp b/native/cocos/renderer/gfx-gles3/GLES3Device.cpp index 6f3043b9aec..fe5af3f831f 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Device.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Device.cpp @@ -44,7 +44,7 @@ #include "GLES3Swapchain.h" #include "GLES3Texture.h" #include "application/ApplicationManager.h" -#include "platform/java/modules/XRInterface.h" +#include "platform/java/modules/IXRInterface.h" #include "profiler/Profiler.h" #include "states/GLES3GeneralBarrier.h" #include "states/GLES3Sampler.h" diff --git a/native/cocos/scene/Camera.h b/native/cocos/scene/Camera.h index bb645d92955..7a1ca937e66 100644 --- a/native/cocos/scene/Camera.h +++ b/native/cocos/scene/Camera.h @@ -37,7 +37,7 @@ #include "math/Mat4.h" #include "math/Vec3.h" #include "math/Vec4.h" -#include "platform/java/modules/XRInterface.h" +#include "platform/java/modules/IXRInterface.h" #include "renderer/gfx-base/GFXDef-common.h" #include "renderer/pipeline/Define.h" diff --git a/native/cocos/xr/XRRemotePreviewManager.cpp b/native/cocos/xr/XRRemotePreviewManager.cpp index a7d94a2f596..f2ddb92876f 100644 --- a/native/cocos/xr/XRRemotePreviewManager.cpp +++ b/native/cocos/xr/XRRemotePreviewManager.cpp @@ -30,7 +30,7 @@ #include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" #include "math/Quaternion.h" -#include "platform/java/modules/XRInterface.h" +#include "platform/java/modules/IXRInterface.h" #if CC_USE_XR #include "Xr.h" From a340610c497eb3d5cc76d9219b36cac230d8bc95 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 25 Sep 2023 11:35:27 +0800 Subject: [PATCH 2/3] Fix include. --- native/cocos/core/Root.cpp | 2 +- native/cocos/renderer/gfx-gles3/GLES3Device.cpp | 2 +- native/cocos/scene/Camera.h | 2 +- native/cocos/xr/XRRemotePreviewManager.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/native/cocos/core/Root.cpp b/native/cocos/core/Root.cpp index 6636e58865d..be2030e6983 100644 --- a/native/cocos/core/Root.cpp +++ b/native/cocos/core/Root.cpp @@ -30,7 +30,7 @@ #include "platform/interfaces/modules/IScreen.h" #include "platform/interfaces/modules/ISystemWindow.h" #include "platform/interfaces/modules/ISystemWindowManager.h" -#include "platform/java/modules/IXRInterface.h" +#include "platform/interfaces/modules/IXRInterface.h" #if CC_USE_DEBUG_RENDERER #include "profiler/DebugRenderer.h" #endif diff --git a/native/cocos/renderer/gfx-gles3/GLES3Device.cpp b/native/cocos/renderer/gfx-gles3/GLES3Device.cpp index fe5af3f831f..e081883bece 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Device.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Device.cpp @@ -44,7 +44,7 @@ #include "GLES3Swapchain.h" #include "GLES3Texture.h" #include "application/ApplicationManager.h" -#include "platform/java/modules/IXRInterface.h" +#include "platform/interfaces/modules/IXRInterface.h" #include "profiler/Profiler.h" #include "states/GLES3GeneralBarrier.h" #include "states/GLES3Sampler.h" diff --git a/native/cocos/scene/Camera.h b/native/cocos/scene/Camera.h index 7a1ca937e66..2e2ebfbe627 100644 --- a/native/cocos/scene/Camera.h +++ b/native/cocos/scene/Camera.h @@ -37,7 +37,7 @@ #include "math/Mat4.h" #include "math/Vec3.h" #include "math/Vec4.h" -#include "platform/java/modules/IXRInterface.h" +#include "platform/interfaces/modules/IXRInterface.h" #include "renderer/gfx-base/GFXDef-common.h" #include "renderer/pipeline/Define.h" diff --git a/native/cocos/xr/XRRemotePreviewManager.cpp b/native/cocos/xr/XRRemotePreviewManager.cpp index f2ddb92876f..a2f598872cf 100644 --- a/native/cocos/xr/XRRemotePreviewManager.cpp +++ b/native/cocos/xr/XRRemotePreviewManager.cpp @@ -30,7 +30,7 @@ #include "base/std/container/unordered_map.h" #include "base/std/container/vector.h" #include "math/Quaternion.h" -#include "platform/java/modules/IXRInterface.h" +#include "platform/interfaces/modules/IXRInterface.h" #if CC_USE_XR #include "Xr.h" From 3c68d91598203988e1735e5ed3fc32329dad0119 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 25 Sep 2023 11:44:01 +0800 Subject: [PATCH 3/3] Fix include in AndroidPlatform.cpp --- native/cocos/platform/android/AndroidPlatform.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/native/cocos/platform/android/AndroidPlatform.cpp b/native/cocos/platform/android/AndroidPlatform.cpp index b13b69bb60d..8c2733eb949 100644 --- a/native/cocos/platform/android/AndroidPlatform.cpp +++ b/native/cocos/platform/android/AndroidPlatform.cpp @@ -43,6 +43,7 @@ #include "platform/java/modules/SystemWindowManager.h" #include "platform/java/modules/Vibrator.h" +#include "platform/interfaces/modules/IXRInterface.h" #if CC_USE_XR #include "platform/java/modules/XRInterface.h" #endif