From 4dd8f68120bc3d3be94e0556ccfef9ee4bf8311a Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 25 Oct 2022 22:20:54 +0300 Subject: Fix build with Vulkan disabled and no Vulkan headers installed. --- platform/android/vulkan/vulkan_context_android.cpp | 4 ++++ platform/android/vulkan/vulkan_context_android.h | 4 ++++ platform/ios/display_server_ios.h | 4 +++- platform/ios/display_server_ios.mm | 1 - platform/ios/vulkan_context_ios.h | 4 ++++ platform/ios/vulkan_context_ios.mm | 4 ++++ platform/linuxbsd/vulkan_context_x11.cpp | 4 ++++ platform/linuxbsd/vulkan_context_x11.h | 4 ++++ platform/macos/detect.py | 4 +++- platform/macos/vulkan_context_macos.h | 4 ++++ platform/macos/vulkan_context_macos.mm | 3 +++ platform/windows/detect.py | 12 +++++++----- platform/windows/vulkan_context_win.h | 4 ++++ 13 files changed, 48 insertions(+), 8 deletions(-) (limited to 'platform') diff --git a/platform/android/vulkan/vulkan_context_android.cpp b/platform/android/vulkan/vulkan_context_android.cpp index c802c9840b..948292c3af 100644 --- a/platform/android/vulkan/vulkan_context_android.cpp +++ b/platform/android/vulkan/vulkan_context_android.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#ifdef VULKAN_ENABLED + #include "vulkan_context_android.h" #ifdef USE_VOLK @@ -63,3 +65,5 @@ bool VulkanContextAndroid::_use_validation_layers() { // On Android, we use validation layers automatically if they were explicitly linked with the app. return count > 0; } + +#endif // VULKAN_ENABLED diff --git a/platform/android/vulkan/vulkan_context_android.h b/platform/android/vulkan/vulkan_context_android.h index ca8182e9cd..fe9a033e1c 100644 --- a/platform/android/vulkan/vulkan_context_android.h +++ b/platform/android/vulkan/vulkan_context_android.h @@ -31,6 +31,8 @@ #ifndef VULKAN_CONTEXT_ANDROID_H #define VULKAN_CONTEXT_ANDROID_H +#ifdef VULKAN_ENABLED + #include "drivers/vulkan/vulkan_context.h" struct ANativeWindow; @@ -48,4 +50,6 @@ protected: bool _use_validation_layers() override; }; +#endif // VULKAN_ENABLED + #endif // VULKAN_CONTEXT_ANDROID_H diff --git a/platform/ios/display_server_ios.h b/platform/ios/display_server_ios.h index f3624f24ab..af78ba3f05 100644 --- a/platform/ios/display_server_ios.h +++ b/platform/ios/display_server_ios.h @@ -40,7 +40,6 @@ #include "vulkan_context_ios.h" -#import #ifdef USE_VOLK #include #else @@ -48,6 +47,9 @@ #endif #endif +#import +#import + class DisplayServerIOS : public DisplayServer { GDCLASS(DisplayServerIOS, DisplayServer) diff --git a/platform/ios/display_server_ios.mm b/platform/ios/display_server_ios.mm index cf0fae4997..33d101ec8a 100644 --- a/platform/ios/display_server_ios.mm +++ b/platform/ios/display_server_ios.mm @@ -41,7 +41,6 @@ #include "tts_ios.h" #import "view_controller.h" -#import #import static const float kDisplayServerIOSAcceleration = 1.f; diff --git a/platform/ios/vulkan_context_ios.h b/platform/ios/vulkan_context_ios.h index e9c09e087a..3849c8ba8a 100644 --- a/platform/ios/vulkan_context_ios.h +++ b/platform/ios/vulkan_context_ios.h @@ -31,6 +31,8 @@ #ifndef VULKAN_CONTEXT_IOS_H #define VULKAN_CONTEXT_IOS_H +#ifdef VULKAN_ENABLED + #include "drivers/vulkan/vulkan_context.h" #import @@ -45,4 +47,6 @@ public: ~VulkanContextIOS(); }; +#endif // VULKAN_ENABLED + #endif // VULKAN_CONTEXT_IOS_H diff --git a/platform/ios/vulkan_context_ios.mm b/platform/ios/vulkan_context_ios.mm index 09cd369aa5..81b021e758 100644 --- a/platform/ios/vulkan_context_ios.mm +++ b/platform/ios/vulkan_context_ios.mm @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#ifdef VULKAN_ENABLED + #include "vulkan_context_ios.h" #ifdef USE_VOLK #include @@ -57,3 +59,5 @@ Error VulkanContextIOS::window_create(DisplayServer::WindowID p_window_id, Displ VulkanContextIOS::VulkanContextIOS() {} VulkanContextIOS::~VulkanContextIOS() {} + +#endif // VULKAN_ENABLED diff --git a/platform/linuxbsd/vulkan_context_x11.cpp b/platform/linuxbsd/vulkan_context_x11.cpp index b4f585726f..92aaf33b05 100644 --- a/platform/linuxbsd/vulkan_context_x11.cpp +++ b/platform/linuxbsd/vulkan_context_x11.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#ifdef VULKAN_ENABLED + #include "vulkan_context_x11.h" #ifdef USE_VOLK @@ -59,3 +61,5 @@ VulkanContextX11::VulkanContextX11() { VulkanContextX11::~VulkanContextX11() { } + +#endif // VULKAN_ENABLED diff --git a/platform/linuxbsd/vulkan_context_x11.h b/platform/linuxbsd/vulkan_context_x11.h index 0c4a6cd278..0adb50ef44 100644 --- a/platform/linuxbsd/vulkan_context_x11.h +++ b/platform/linuxbsd/vulkan_context_x11.h @@ -31,6 +31,8 @@ #ifndef VULKAN_CONTEXT_X11_H #define VULKAN_CONTEXT_X11_H +#ifdef VULKAN_ENABLED + #include "drivers/vulkan/vulkan_context.h" #include @@ -44,4 +46,6 @@ public: ~VulkanContextX11(); }; +#endif // VULKAN_ENABLED + #endif // VULKAN_CONTEXT_X11_H diff --git a/platform/macos/detect.py b/platform/macos/detect.py index 511286d52b..e73c5322ea 100644 --- a/platform/macos/detect.py +++ b/platform/macos/detect.py @@ -223,6 +223,8 @@ def configure(env: "Environment"): "AVFoundation", "-framework", "CoreMedia", + "-framework", + "QuartzCore", ] ) env.Append(LIBS=["pthread", "z"]) @@ -236,7 +238,7 @@ def configure(env: "Environment"): if env["vulkan"]: env.Append(CPPDEFINES=["VULKAN_ENABLED"]) - env.Append(LINKFLAGS=["-framework", "Metal", "-framework", "QuartzCore", "-framework", "IOSurface"]) + env.Append(LINKFLAGS=["-framework", "Metal", "-framework", "IOSurface"]) if not env["use_volk"]: env.Append(LINKFLAGS=["-lMoltenVK"]) mvk_found = False diff --git a/platform/macos/vulkan_context_macos.h b/platform/macos/vulkan_context_macos.h index 579c42b042..2a81336994 100644 --- a/platform/macos/vulkan_context_macos.h +++ b/platform/macos/vulkan_context_macos.h @@ -31,6 +31,8 @@ #ifndef VULKAN_CONTEXT_MACOS_H #define VULKAN_CONTEXT_MACOS_H +#ifdef VULKAN_ENABLED + #include "drivers/vulkan/vulkan_context.h" #import @@ -44,4 +46,6 @@ public: ~VulkanContextMacOS(); }; +#endif // VULKAN_ENABLED + #endif // VULKAN_CONTEXT_MACOS_H diff --git a/platform/macos/vulkan_context_macos.mm b/platform/macos/vulkan_context_macos.mm index cf317f3c68..1df6b3ed18 100644 --- a/platform/macos/vulkan_context_macos.mm +++ b/platform/macos/vulkan_context_macos.mm @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#ifdef VULKAN_ENABLED #include "vulkan_context_macos.h" #ifdef USE_VOLK #include @@ -57,3 +58,5 @@ VulkanContextMacOS::VulkanContextMacOS() { VulkanContextMacOS::~VulkanContextMacOS() { } + +#endif // VULKAN_ENABLED diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 74868fc6a2..705e83dace 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -582,12 +582,14 @@ def configure_mingw(env): ] ) - env.Append(CPPDEFINES=["VULKAN_ENABLED"]) - if not env["use_volk"]: - env.Append(LIBS=["vulkan"]) + if env["vulkan"]: + env.Append(CPPDEFINES=["VULKAN_ENABLED"]) + if not env["use_volk"]: + env.Append(LIBS=["vulkan"]) - env.Append(CPPDEFINES=["GLES3_ENABLED"]) - env.Append(LIBS=["opengl32"]) + if env["opengl3"]: + env.Append(CPPDEFINES=["GLES3_ENABLED"]) + env.Append(LIBS=["opengl32"]) env.Append(CPPDEFINES=["MINGW_ENABLED", ("MINGW_HAS_SECURE_API", 1)]) diff --git a/platform/windows/vulkan_context_win.h b/platform/windows/vulkan_context_win.h index 2ecdfc8f3f..9dedcabb2b 100644 --- a/platform/windows/vulkan_context_win.h +++ b/platform/windows/vulkan_context_win.h @@ -31,6 +31,8 @@ #ifndef VULKAN_CONTEXT_WIN_H #define VULKAN_CONTEXT_WIN_H +#ifdef VULKAN_ENABLED + #include "drivers/vulkan/vulkan_context.h" #define WIN32_LEAN_AND_MEAN @@ -46,4 +48,6 @@ public: ~VulkanContextWindows(); }; +#endif // VULKAN_ENABLED + #endif // VULKAN_CONTEXT_WIN_H -- cgit v1.2.3