the overkill patch
This commit is contained in:
1 parent
af1b471799
commit
2dc4784f4b
6 files changed
+430
-83
No files matched your search
@@ -1,2 +1,3 @@
|
||||
exe
|
||||
*.exe
|
||||
build/
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE"
|
||||
],
|
||||
"windowsSdkVersion": "10.0.26100.0",
|
||||
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe" ,
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++17",
|
||||
"intelliSenseMode": "windows-msvc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "C++: Debug with g++",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}\\build\\debug\\${fileBasenameNoExtension}.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "C:\\msys64\\ucrt64\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "C++: Smart Build (Auto-detect Compiler)",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
},
|
||||
{
|
||||
"name": "C++: Debug with MSVC",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}\\build\\debug\\${fileBasenameNoExtension}.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"console": "integratedTerminal",
|
||||
"preLaunchTask": "C++: Smart Build (Auto-detect Compiler)"
|
||||
},
|
||||
{
|
||||
"name": "C++: Run without debugging",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}\\build\\debug\\${fileBasenameNoExtension}.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
"preLaunchTask": "C++: Smart Build (Auto-detect Compiler)"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+64
-58
@@ -1,60 +1,66 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"ostream": "cpp",
|
||||
"atomic": "cpp",
|
||||
"bit": "cpp",
|
||||
"cctype": "cpp",
|
||||
"charconv": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"compare": "cpp",
|
||||
"concepts": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"cstdint": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"cstring": "cpp",
|
||||
"ctime": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"exception": "cpp",
|
||||
"format": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"ios": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"iostream": "cpp",
|
||||
"istream": "cpp",
|
||||
"iterator": "cpp",
|
||||
"limits": "cpp",
|
||||
"locale": "cpp",
|
||||
"memory": "cpp",
|
||||
"new": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"string": "cpp",
|
||||
"system_error": "cpp",
|
||||
"tuple": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"utility": "cpp",
|
||||
"xfacet": "cpp",
|
||||
"xiosbase": "cpp",
|
||||
"xlocale": "cpp",
|
||||
"xlocbuf": "cpp",
|
||||
"xlocinfo": "cpp",
|
||||
"xlocmes": "cpp",
|
||||
"xlocmon": "cpp",
|
||||
"xlocnum": "cpp",
|
||||
"xloctime": "cpp",
|
||||
"xmemory": "cpp",
|
||||
"xstring": "cpp",
|
||||
"xtr1common": "cpp",
|
||||
"xutility": "cpp",
|
||||
"vector": "cpp",
|
||||
"list": "cpp",
|
||||
"optional": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"deque": "cpp",
|
||||
"queue": "cpp",
|
||||
"stack": "cpp"
|
||||
}
|
||||
"files.associations": {
|
||||
"ostream": "cpp",
|
||||
"atomic": "cpp",
|
||||
"bit": "cpp",
|
||||
"cctype": "cpp",
|
||||
"charconv": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"compare": "cpp",
|
||||
"concepts": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"cstdint": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"cstring": "cpp",
|
||||
"ctime": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"exception": "cpp",
|
||||
"format": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"ios": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"iostream": "cpp",
|
||||
"istream": "cpp",
|
||||
"iterator": "cpp",
|
||||
"limits": "cpp",
|
||||
"locale": "cpp",
|
||||
"memory": "cpp",
|
||||
"new": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"string": "cpp",
|
||||
"system_error": "cpp",
|
||||
"tuple": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"utility": "cpp",
|
||||
"xfacet": "cpp",
|
||||
"xiosbase": "cpp",
|
||||
"xlocale": "cpp",
|
||||
"xlocbuf": "cpp",
|
||||
"xlocinfo": "cpp",
|
||||
"xlocmes": "cpp",
|
||||
"xlocmon": "cpp",
|
||||
"xlocnum": "cpp",
|
||||
"xloctime": "cpp",
|
||||
"xmemory": "cpp",
|
||||
"xstring": "cpp",
|
||||
"xtr1common": "cpp",
|
||||
"xutility": "cpp",
|
||||
"vector": "cpp",
|
||||
"list": "cpp",
|
||||
"optional": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"deque": "cpp",
|
||||
"queue": "cpp",
|
||||
"stack": "cpp"
|
||||
},
|
||||
"files.exclude": {
|
||||
"**/*.rpyc": true,
|
||||
"**/*.rpa": true,
|
||||
"**/*.rpymc": true,
|
||||
"**/cache/": true
|
||||
}
|
||||
}
|
||||
Vendored
+97
@@ -0,0 +1,97 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$SourceFile,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$WorkspaceFolder,
|
||||
|
||||
[Parameter(Mandatory = $false)]
|
||||
[string]$BuildType = "debug"
|
||||
)
|
||||
|
||||
# Extract filename without extension
|
||||
$FileBaseName = [System.IO.Path]::GetFileNameWithoutExtension($SourceFile)
|
||||
$OutputPath = Join-Path $WorkspaceFolder "build\$BuildType\$FileBaseName.exe"
|
||||
|
||||
# Ensure build directory exists
|
||||
$BuildDir = Join-Path $WorkspaceFolder "build\$BuildType"
|
||||
if (-not (Test-Path $BuildDir)) {
|
||||
New-Item -ItemType Directory -Path $BuildDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Building: $SourceFile"
|
||||
Write-Host "Output: $OutputPath"
|
||||
Write-Host ""
|
||||
|
||||
# Try g++ first
|
||||
if (Get-Command g++ -ErrorAction SilentlyContinue) {
|
||||
Write-Host "Using g++ compiler..." -ForegroundColor Green
|
||||
|
||||
if ($BuildType -eq "release") {
|
||||
$gppArgs = @(
|
||||
"-std=c++17"
|
||||
"-Wall"
|
||||
"-Wextra"
|
||||
"-O2"
|
||||
"-DNDEBUG"
|
||||
"`"$SourceFile`""
|
||||
"-o"
|
||||
"`"$OutputPath`""
|
||||
)
|
||||
}
|
||||
else {
|
||||
$gppArgs = @(
|
||||
"-std=c++17"
|
||||
"-Wall"
|
||||
"-Wextra"
|
||||
"-g"
|
||||
"-O0"
|
||||
"`"$SourceFile`""
|
||||
"-o"
|
||||
"`"$OutputPath`""
|
||||
)
|
||||
}
|
||||
|
||||
& g++ @gppArgs
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Build successful with g++!" -ForegroundColor Green
|
||||
exit 0
|
||||
}
|
||||
else {
|
||||
Write-Host "g++ build failed, trying MSVC..." -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# Try MSVC as fallback
|
||||
$VsDevCmd = "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
|
||||
if (Test-Path $VsDevCmd) {
|
||||
Write-Host "Using MSVC compiler..." -ForegroundColor Green
|
||||
|
||||
# Convert to absolute paths for MSVC
|
||||
$AbsoluteSourceFile = Resolve-Path $SourceFile
|
||||
$ObjFile = Join-Path $BuildDir "$FileBaseName.obj"
|
||||
$PdbFile = Join-Path $BuildDir "$FileBaseName.pdb"
|
||||
|
||||
if ($BuildType -eq "release") {
|
||||
$MSVCCommand = "`"$VsDevCmd`" && cl.exe /std:c++17 /W4 /O2 /DNDEBUG /EHsc /MD /Fe:`"$OutputPath`" /Fo:`"$ObjFile`" `"$AbsoluteSourceFile`""
|
||||
}
|
||||
else {
|
||||
$MSVCCommand = "`"$VsDevCmd`" && cl.exe /std:c++17 /W4 /Zi /EHsc /MDd /Fe:`"$OutputPath`" /Fo:`"$ObjFile`" /Fd:`"$PdbFile`" `"$AbsoluteSourceFile`""
|
||||
}
|
||||
|
||||
& cmd /c $MSVCCommand
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Build successful with MSVC!" -ForegroundColor Green
|
||||
exit 0
|
||||
}
|
||||
else {
|
||||
Write-Host "MSVC build failed!" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Error "No C++ compiler found! Please install g++ or Visual Studio."
|
||||
exit 1
|
||||
}
|
||||
Vendored
+195
-25
@@ -1,27 +1,197 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: g++.exe build active file",
|
||||
"command": "C:\\msys64\\ucrt64\\bin\\g++.exe",
|
||||
"args": [
|
||||
"-fdiagnostics-color=always",
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${workspaceFolder}\\exe\\${fileBasenameNoExtension}.exe"
|
||||
// hey check this line
|
||||
],
|
||||
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "Task generated by Debugger."
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "C++: Smart Build (Auto-detect Compiler)",
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-ExecutionPolicy",
|
||||
"Bypass",
|
||||
"-File",
|
||||
"${workspaceFolder}\\.vscode\\smartbuild.ps1",
|
||||
"-SourceFile",
|
||||
"${file}",
|
||||
"-WorkspaceFolder",
|
||||
"${workspaceFolder}",
|
||||
"-BuildType",
|
||||
"debug"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": ["$gcc", "$msCompile"],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "Automatically detects and uses available C++ compiler (g++ or MSVC)",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "C++: Smart Build (Release)",
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-ExecutionPolicy",
|
||||
"Bypass",
|
||||
"-File",
|
||||
"${workspaceFolder}\\.vscode\\smartbuild.ps1",
|
||||
"-SourceFile",
|
||||
"${file}",
|
||||
"-WorkspaceFolder",
|
||||
"${workspaceFolder}",
|
||||
"-BuildType",
|
||||
"release"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": ["$gcc", "$msCompile"],
|
||||
"group": "build",
|
||||
"detail": "Build optimized release version with auto-detected compiler"
|
||||
},
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C++: Build with g++ (Debug)",
|
||||
"command": "g++",
|
||||
"args": [
|
||||
"-std=c++17",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-g",
|
||||
"-O0",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${workspaceFolder}\\build\\debug\\${fileBasenameNoExtension}.exe"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": ["$gcc"],
|
||||
"group": "build",
|
||||
"detail": "Build current file with g++ in debug mode",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C++: Build with g++ (Release)",
|
||||
"command": "C:\\msys64\\ucrt64\\bin\\g++.exe",
|
||||
"args": [
|
||||
"-std=c++17",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-O2",
|
||||
"-DNDEBUG",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${workspaceFolder}\\build\\release\\${fileBasenameNoExtension}.exe"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": ["$gcc"],
|
||||
"group": "build",
|
||||
"detail": "Build current file with g++ in release mode"
|
||||
},
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C++: Build with g++ (MSYS2 Full Path)",
|
||||
"command": "C:\\msys64\\ucrt64\\bin\\g++.exe",
|
||||
"args": [
|
||||
"-std=c++17",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-g",
|
||||
"-O0",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${workspaceFolder}\\build\\debug\\${fileBasenameNoExtension}.exe"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": ["$gcc"],
|
||||
"group": "build",
|
||||
"detail": "Build current file with g++ using explicit MSYS2 path (backup option)"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "C++: Build with MSVC (Debug)",
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-Command",
|
||||
"& { $buildDir = '${workspaceFolder}\\build\\debug'; if (-not (Test-Path $buildDir)) { New-Item -ItemType Directory -Path $buildDir -Force }; & cmd /c '\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\VsDevCmd.bat\" && cd /d \"$buildDir\" && cl.exe /std:c++17 /W4 /Zi /EHsc /MDd /Fe:\"${workspaceFolder}\\build\\debug\\${fileBasenameNoExtension}.exe\" /Fo:\"$buildDir\\${fileBasenameNoExtension}.obj\" /Fd:\"$buildDir\\${fileBasenameNoExtension}.pdb\" \"${file}\"' }"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": ["$msCompile"],
|
||||
"group": "build",
|
||||
"detail": "Build current file with MSVC in debug mode (clean intermediate files)"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "C++: Run current file",
|
||||
"command": "\"${workspaceFolder}\\build\\debug\\${fileBasenameNoExtension}.exe\"",
|
||||
"args": [],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
},
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": true,
|
||||
"panel": "new"
|
||||
},
|
||||
"dependsOn": "C++: Smart Build (Auto-detect Compiler)",
|
||||
"detail": "Build and run the current C++ file"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "C++: Clean build directory",
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-Command",
|
||||
"if (Test-Path \"${workspaceFolder}\\build\") { Remove-Item -Recurse -Force \"${workspaceFolder}\\build\\*\" } else { New-Item -ItemType Directory -Path \"${workspaceFolder}\\build\\debug\", \"${workspaceFolder}\\build\\release\" -Force }"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"group": "build",
|
||||
"detail": "Clean all build artifacts and recreate build directories"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "C++: Setup build directories",
|
||||
"command": "powershell.exe",
|
||||
"args": [
|
||||
"-Command",
|
||||
"New-Item -ItemType Directory -Path \"${workspaceFolder}\\build\\debug\", \"${workspaceFolder}\\build\\release\" -Force"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"group": "build",
|
||||
"detail": "Create build directories if they don't exist"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user