From be44a69100d40946c2ea9dd4cfeeaf5f28ba3a88 Mon Sep 17 00:00:00 2001 From: InkSoul Date: Sat, 25 Oct 2025 21:31:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mazzGame/.gitignore | 2 + mazzGame/CMakeLists.txt | 23 +++++++++ mazzGame/CMakePresets.json | 101 +++++++++++++++++++++++++++++++++++++ mazzGame/src/mazzGame.cpp | 12 +++++ mazzGame/src/mazzGame.h | 8 +++ 5 files changed, 146 insertions(+) create mode 100644 mazzGame/.gitignore create mode 100644 mazzGame/CMakeLists.txt create mode 100644 mazzGame/CMakePresets.json create mode 100644 mazzGame/src/mazzGame.cpp create mode 100644 mazzGame/src/mazzGame.h diff --git a/mazzGame/.gitignore b/mazzGame/.gitignore new file mode 100644 index 0000000..329817a --- /dev/null +++ b/mazzGame/.gitignore @@ -0,0 +1,2 @@ +out/ +.vs/ \ No newline at end of file diff --git a/mazzGame/CMakeLists.txt b/mazzGame/CMakeLists.txt new file mode 100644 index 0000000..a2b2c7e --- /dev/null +++ b/mazzGame/CMakeLists.txt @@ -0,0 +1,23 @@ +# CMakeList.txt: mazzGame 的 CMake 项目,在此处包括源代码并定义 +# 项目特定的逻辑。 +# +cmake_minimum_required (VERSION 3.8) + +# 如果支持,请为 MSVC 编译器启用热重载。 +if (POLICY CMP0141) + cmake_policy(SET CMP0141 NEW) + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$,$>,$<$:EditAndContinue>,$<$:ProgramDatabase>>") +endif() + +project ("mazzGame") + +aux_source_directory(${PROJECT_SOURCE_DIR}/src sourceCodeList) + +# 将源代码添加到此项目的可执行文件。 +add_executable (mazzGame ${sourceCodeList}) + +if (CMAKE_VERSION VERSION_GREATER 3.12) + set_property(TARGET mazzGame PROPERTY CXX_STANDARD 20) +endif() + +# TODO: 如有需要,请添加测试并安装目标。 diff --git a/mazzGame/CMakePresets.json b/mazzGame/CMakePresets.json new file mode 100644 index 0000000..f4bc98b --- /dev/null +++ b/mazzGame/CMakePresets.json @@ -0,0 +1,101 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "windows-base", + "hidden": true, + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/out/install/${presetName}", + "cacheVariables": { + "CMAKE_C_COMPILER": "cl.exe", + "CMAKE_CXX_COMPILER": "cl.exe" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "x64-debug", + "displayName": "x64 Debug", + "inherits": "windows-base", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "x64-release", + "displayName": "x64 Release", + "inherits": "x64-debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "x86-debug", + "displayName": "x86 Debug", + "inherits": "windows-base", + "architecture": { + "value": "x86", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "x86-release", + "displayName": "x86 Release", + "inherits": "x86-debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "linux-debug", + "displayName": "Linux Debug", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/out/install/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + }, + "vendor": { + "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { + "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" + } + } + }, + { + "name": "macos-debug", + "displayName": "macOS Debug", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/out/install/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + }, + "vendor": { + "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { + "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" + } + } + } + ] +} diff --git a/mazzGame/src/mazzGame.cpp b/mazzGame/src/mazzGame.cpp new file mode 100644 index 0000000..448e418 --- /dev/null +++ b/mazzGame/src/mazzGame.cpp @@ -0,0 +1,12 @@ +// mazzGame.cpp: 定义应用程序的入口点。 +// + +#include "mazzGame.h" + + + +int main() +{ + std::cout << "Hello CMake." << std::endl; + return 0; +} diff --git a/mazzGame/src/mazzGame.h b/mazzGame/src/mazzGame.h new file mode 100644 index 0000000..3de5084 --- /dev/null +++ b/mazzGame/src/mazzGame.h @@ -0,0 +1,8 @@ +// mazzGame.h: 标准系统包含文件的包含文件 +// 或项目特定的包含文件。 + +#pragma once + +#include + +// TODO: 在此处引用程序需要的其他标头。