From 11434653e9a56fb37c85792ea94b2a27dcf8a4a2 Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Wed, 6 May 2026 09:51:17 +0200 Subject: [PATCH] Feature: Add debug configuration for Microsoft VS Code --- .vscode/build.ps1 | 43 ++++++++++++++ .vscode/c_cpp_properties.json | 61 +++++++++++++++++++ .vscode/extensions.json | 8 +++ .vscode/launch.json | 86 +++++++++++++++++++++++++++ .vscode/tasks.json | 109 ++++++++++++++++++++++++++++++++++ 5 files changed, 307 insertions(+) create mode 100644 .vscode/build.ps1 create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/build.ps1 b/.vscode/build.ps1 new file mode 100644 index 0000000..9bf42b5 --- /dev/null +++ b/.vscode/build.ps1 @@ -0,0 +1,43 @@ +param( + [Parameter(Mandatory = $true)] + [string]$Target, + + [ValidateSet("Debug", "Release")] + [string]$Configuration = "Debug", + + [ValidateSet("x64", "x86", "Win32")] + [string]$Platform = "x64" +) + +$ErrorActionPreference = "Stop" + +$vswhere = Join-Path ${env:ProgramFiles(x86)} "Microsoft Visual Studio\Installer\vswhere.exe" +if (-not (Test-Path $vswhere)) { + Write-Host "ERROR: vswhere.exe not found at $vswhere" -ForegroundColor Red + Write-Host "Install Visual Studio Installer (comes with VS 2017+)." -ForegroundColor Yellow + exit 1 +} + +$msbuild = & $vswhere -latest -prerelease -products * ` + -requires Microsoft.Component.MSBuild ` + -find 'MSBuild\**\Bin\MSBuild.exe' | Select-Object -First 1 + +if (-not $msbuild) { + Write-Host "ERROR: MSBuild not found via vswhere" -ForegroundColor Red + exit 1 +} + +$sln = Join-Path $PSScriptRoot "..\YAMA.sln" | Resolve-Path + +Write-Host "MSBuild : $msbuild" -ForegroundColor Cyan +Write-Host "Solution: $sln" -ForegroundColor Cyan +Write-Host "Target : $Target | $Configuration | $Platform" -ForegroundColor Cyan +Write-Host "" + +& $msbuild $sln.Path ` + "/t:$Target" ` + "/p:Configuration=$Configuration" ` + "/p:Platform=$Platform" ` + /m /v:minimal /nologo + +exit $LASTEXITCODE diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..f7f399b --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,61 @@ +{ + "version": 4, + "configurations": [ + { + "name": "Win32", + "intelliSenseMode": "windows-msvc-x64", + "compilerPath": "cl.exe", + "cStandard": "c11", + "cppStandard": "c++17", + "windowsSdkVersion": "10.0.19041.0", + "includePath": [ + "${workspaceFolder}", + "${workspaceFolder}/client", + "${workspaceFolder}/common", + "${workspaceFolder}/compress", + "${workspaceFolder}/compress/ffmpeg", + "${workspaceFolder}/server/2015Remote", + "${workspaceFolder}/server/2015Remote/proxy", + "${workspaceFolder}/client/d3d", + "${env:VLDPATH}/include" + ], + "defines": [ + "_WIN32", + "_WINDOWS", + "_DEBUG", + "_MBCS", + "ZLIB_WINAPI", + "_CRT_SECURE_NO_WARNINGS", + "_AFXDLL", + "_USRDLL" + ], + "browse": { + "path": [ + "${workspaceFolder}/client", + "${workspaceFolder}/common", + "${workspaceFolder}/compress", + "${workspaceFolder}/server" + ], + "limitSymbolsToIncludedHeaders": true + } + }, + { + "name": "Linux (WSL)", + "intelliSenseMode": "linux-gcc-x64", + "compilerPath": "/usr/bin/g++", + "cStandard": "c11", + "cppStandard": "c++11", + "includePath": [ + "${workspaceFolder}", + "${workspaceFolder}/client", + "${workspaceFolder}/common", + "${workspaceFolder}/compress", + "${workspaceFolder}/linux", + "${workspaceFolder}/linux/mterm" + ], + "defines": [ + "__linux__" + ] + } + ] +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..051dee2 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "ms-vscode.cpptools", + "ms-vscode-remote.remote-wsl", + "ms-vscode.powershell", + "twxs.cmake" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..7c07da2 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,86 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Yama (Debug x64)", + "type": "cppvsdbg", + "request": "launch", + "program": "${workspaceFolder}/Bin/Yama_x64d.exe", + "args": [ + "-agent" + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/Bin", + "environment": [], + "preLaunchTask": "Build Yama (Debug x64)", + "symbolSearchPath": "${workspaceFolder}/Bin;${workspaceFolder}/x64/Debug", + "sourceFileMap": { + "${workspaceFolder}": "${workspaceFolder}" + } + }, + { + "name": "Yama (Attach)", + "type": "cppvsdbg", + "request": "attach", + "processId": "${command:pickProcess}" + }, + { + "name": "ghost (Debug x64)", + "type": "cppvsdbg", + "request": "launch", + "program": "${workspaceFolder}/x64/Debug/ghost.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/x64/Debug", + "environment": [], + "console": "externalTerminal", + "preLaunchTask": "Build ghost (Debug x64)" + }, + { + "name": "TestRun (Debug x64)", + "type": "cppvsdbg", + "request": "launch", + "program": "${workspaceFolder}/x64/Debug/TestRun.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/x64/Debug", + "environment": [], + "console": "externalTerminal", + "preLaunchTask": "Build TestRun (Debug x64)" + }, + { + "name": "ghost (Linux WSL)", + "type": "cppdbg", + "request": "launch", + "program": "/mnt/c/github/YAMA/linux/ghost", + "args": [], + "stopAtEntry": false, + "cwd": "/mnt/c/github/YAMA/linux", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb", + "pipeTransport": { + "pipeCwd": "${workspaceFolder}", + "pipeProgram": "C:\\Windows\\System32\\wsl.exe", + "pipeArgs": [ + "-e", + "bash", + "-c" + ], + "debuggerPath": "/usr/bin/gdb" + }, + "sourceFileMap": { + "/mnt/c/github/YAMA": "${workspaceFolder}" + }, + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "Build ghost (Linux WSL)" + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..5caa96f --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,109 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build Yama (Debug x64)", + "type": "shell", + "command": "powershell", + "args": [ + "-NoProfile", + "-ExecutionPolicy", + "Bypass", + "-File", + "${workspaceFolder}\\.vscode\\build.ps1", + "-Target", + "Yama", + "-Configuration", + "Debug", + "-Platform", + "x64" + ], + "problemMatcher": [ + "$msCompile" + ], + "group": "build", + "presentation": { + "reveal": "silent", + "panel": "dedicated", + "clear": true + } + }, + { + "label": "Build ghost (Debug x64)", + "type": "shell", + "command": "powershell", + "args": [ + "-NoProfile", + "-ExecutionPolicy", + "Bypass", + "-File", + "${workspaceFolder}\\.vscode\\build.ps1", + "-Target", + "ghost", + "-Configuration", + "Debug", + "-Platform", + "x64" + ], + "problemMatcher": [ + "$msCompile" + ], + "group": "build", + "presentation": { + "reveal": "silent", + "panel": "dedicated", + "clear": true + } + }, + { + "label": "Build TestRun (Debug x64)", + "type": "shell", + "command": "powershell", + "args": [ + "-NoProfile", + "-ExecutionPolicy", + "Bypass", + "-File", + "${workspaceFolder}\\.vscode\\build.ps1", + "-Target", + "TestRun", + "-Configuration", + "Debug", + "-Platform", + "x64" + ], + "problemMatcher": [ + "$msCompile" + ], + "group": "build", + "presentation": { + "reveal": "silent", + "panel": "dedicated", + "clear": true + } + }, + { + "label": "Build ghost (Linux WSL)", + "type": "process", + "command": "wsl", + "args": [ + "-e", + "bash", + "-c", + "cmake -DCMAKE_BUILD_TYPE=Debug . && make -j$(nproc)" + ], + "options": { + "cwd": "${workspaceFolder}\\linux" + }, + "problemMatcher": [ + "$gcc" + ], + "group": "build", + "presentation": { + "reveal": "always", + "panel": "dedicated", + "clear": true + } + } + ] +}