From fc4c626794ddb0ac2d47174580241e3b02dcb3c8 Mon Sep 17 00:00:00 2001 From: AliMehrabani Date: Tue, 19 Nov 2024 17:11:35 +0330 Subject: [PATCH] update on android part - linux and android part are separated in .pro file - It runs on linux, still! --- VkTest.pro | 25 ++++++++++++++++--------- VulkanTutorial1.0/Types.h | 9 --------- VulkanTutorial1.0/VulkanWindow.h | 4 ++-- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/VkTest.pro b/VkTest.pro index b56d1f2..96bde42 100644 --- a/VkTest.pro +++ b/VkTest.pro @@ -2,10 +2,7 @@ QT += core xml gui CONFIG += c++17 -QMAKE_SPEC_T = $$[QMAKE_SPEC] - INCLUDEPATH += \ -# /usr/include/vulkan \ $$PWD/third_party \ # $$PWD/third_party/vkbootstrap \ # $$PWD/third_party/vkbootstrap/build \ @@ -15,8 +12,6 @@ INCLUDEPATH += \ # $$PWD/third_party/fmt/build LIBS += \ - -lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi \ - -lvulkan \ # -L$$PWD/third_party/pugixml/build -lpugixml \ # -lSDL2main -lSDL2 -lvk-bootstrap \ # -L$$PWD/third_party/fmt/build -lfmt @@ -47,9 +42,17 @@ DISTFILES += \ shaders/VulkanTutorial1.0/HelloTriangle/vert.spv -contains(QMAKE_SPEC_T,.*android.*) { - QT += +android { + QT += \ + ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android + + INCLUDEPATH += \ + + LIBS += -landroid -llog + + DEFINES += VK_USE_PLATFORM_ANDROID_KHR + OTHER_FILES += android/src/Vulkan \ android/AndroidManifest.xml \ android/build.gradle \ @@ -59,8 +62,12 @@ contains(QMAKE_SPEC_T,.*android.*) { android/gradlew.bat \ android/res/values/libs.xml } -contains(QMAKE_SPEC_T,.*linux.*) { - QT += x11extras +linux64 { + QT += x11extrass + + LIBS += \ + -lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi \ + -lvulkan \ INCLUDEPATH += \ /usr/include/vulkan \ diff --git a/VulkanTutorial1.0/Types.h b/VulkanTutorial1.0/Types.h index 46db0ed..29d4a06 100644 --- a/VulkanTutorial1.0/Types.h +++ b/VulkanTutorial1.0/Types.h @@ -3,15 +3,6 @@ #pragma once -#if defined(Q_OS_ANDROID) -#define VK_USE_PLATFORM_ANDROID_KHR // Enable Vulkan support for Android -#elif defined(Q_OS_LINUX) -#define VK_USE_PLATFORM_XCB_KHR // Enable Vulkan support for Linux (XCB) -#include -#endif - - - #include #include diff --git a/VulkanTutorial1.0/VulkanWindow.h b/VulkanTutorial1.0/VulkanWindow.h index 6f12feb..1d45e8d 100644 --- a/VulkanTutorial1.0/VulkanWindow.h +++ b/VulkanTutorial1.0/VulkanWindow.h @@ -9,11 +9,11 @@ #if defined(Q_OS_ANDROID) #define VK_USE_PLATFORM_ANDROID_KHR // Enable Vulkan support for Android -#include +#include #elif defined(Q_OS_LINUX) #include #define VK_USE_PLATFORM_XCB_KHR // Enable Vulkan support for Linux (XCB) -#include +#include #include #endif