From b5bd7fa1f5974f8a0c855765f9cfd370702aaf3b Mon Sep 17 00:00:00 2001 From: atdunbg Date: Wed, 26 Aug 2026 14:01:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +++++ .gitmodules | 6 ++++++ CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ Libraries/glfw | 1 + Libraries/glm | 1 + src/main.cpp | 9 +++++++++ 6 files changed, 53 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 160000 Libraries/glfw create mode 160000 Libraries/glm create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a5dec1c --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea/ +.vs/ +cmake-build*/ +out/ + diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bcff14d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "Libraries/glm"] + path = Libraries/glm + url = https://github.com/g-truc/glm +[submodule "Libraries/glfw"] + path = Libraries/glfw + url = https://github.com/glfw/glfw diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e697264 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 4.3) +project(VulkanTutorial) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +file(GLOB SOURCE_CODE ./src/*.cpp) +add_executable(${PROJECT_NAME} + ${SOURCE_CODE} +) + +# 1. 查找 Vulkan +find_package(Vulkan REQUIRED) +if(NOT Vulkan_FOUND) + message(FATAL_ERROR "Vulkan not found!") +endif() + +# 设置 GLFW 不构建示例和文档,加快编译 +set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) +set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) +set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) +add_subdirectory(Libraries/glfw) # GLFW + +add_subdirectory(Libraries/glm) # GLM + +# 链接依赖 +target_link_libraries(${PROJECT_NAME} + PRIVATE + glfw # glfw 的 target 名称(由 add_subdirectory 提供) + Vulkan::Vulkan # 来自 find_package(Vulkan) +) diff --git a/Libraries/glfw b/Libraries/glfw new file mode 160000 index 0000000..92dcf4c --- /dev/null +++ b/Libraries/glfw @@ -0,0 +1 @@ +Subproject commit 92dcf4ce74f2e2554a98fea09be7c705c17daa5a diff --git a/Libraries/glm b/Libraries/glm new file mode 160000 index 0000000..6f14f47 --- /dev/null +++ b/Libraries/glm @@ -0,0 +1 @@ +Subproject commit 6f14f4792a0cde5d0cf2c910506724d61cb95834 diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..7e6e478 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,9 @@ +// +// Created by atdunbg on 2026/8/25. +// + +#include + +int main(int argc, char** argv) { + std::cout << "Hello World!" << std::endl; +}