Skip to content

Instantly share code, notes, and snippets.

@Dregu
Last active October 21, 2022 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dregu/c391351394baae4e65746199cc3ff260 to your computer and use it in GitHub Desktop.
Save Dregu/c391351394baae4e65746199cc3ff260 to your computer and use it in GitHub Desktop.
Overlunky/Playlunky build scripts
@echo off
:: build.bat [MSVC|Clang|Ninja] [Release|Debug|RelWithDebInfo] [custom options for cmake]
set A=Ninja
set B=Release
set C=-DIWYU=ON -DBUILD_INFO_DUMP=OFF -DBUILD_SPEL2_DLL=OFF
:: set C=-DPLAYLUNKY_CONAN_VERBOSE=ON
if /I [%1] == [MSVC] set A=MSVC
if /I [%1] == [Clang] set A=Clang
if /I [%1] == [Ninja] set A=Ninja
if /I [%2] == [Release] set B=Release
if /I [%2] == [Debug] set B=Debug
if /I [%2] == [RelWithDebInfo] set B=RelWithDebInfo
for /f "tokens=2,* delims= " %%a in ("%*") do set D=%%b
if [%D%] == [] (set C=%C%) else (set C=%D%)
echo Building %A% %B% with %C%
if ["%VSINSTALLDIR%"] == [""] call "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat"
goto %A%
:MSVC
mkdir build
pushd build
cmake .. -G"Visual Studio 17 2022" -A x64 %C%
cmake --build . --config %B%
goto end
:Clang
mkdir build-clang
pushd build-clang
cmake .. -G"Visual Studio 17 2022" -TClangCL -A x64 %C%
cmake --build . --config %B%
goto end
:Ninja
mkdir build-ninja
pushd build-ninja
cmake .. -G"Ninja Multi-Config" %C%
cmake --build . --config %B%
goto end
:end
set A=
set B=
set C=
set D=
popd
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Overlunky (MSVC Release)",
"program": "${workspaceRoot}/build/bin/Release/injector.exe",
"cwd": "${workspaceRoot}/build/bin/Release/",
"preLaunchTask": "Build MSVC Release",
},
{
"type": "lldb",
"request": "launch",
"name": "Overlunky (Clang Release)",
"program": "${workspaceRoot}/build-clang/bin/Release/injector.exe",
"cwd": "${workspaceRoot}/build-clang/bin/Release/",
"preLaunchTask": "Build Clang Release",
},
{
"type": "lldb",
"request": "launch",
"name": "Overlunky (Ninja Debug)",
"program": "${workspaceRoot}/build-ninja/bin/Debug/injector.exe",
"cwd": "${workspaceRoot}/build-ninja/bin/Debug/",
"preLaunchTask": "Build Ninja Debug",
},
{
"type": "lldb",
"request": "launch",
"name": "Overlunky (Ninja Release)",
"program": "${workspaceRoot}/build-ninja/bin/Release/injector.exe",
"cwd": "${workspaceRoot}/build-ninja/bin/Release/",
"preLaunchTask": "Build Ninja Release",
},
{
"type": "lldb",
"request": "launch",
"name": "Spelunky 2",
"program": "D:/Games/Spelunky 2/Spel2.exe",
"cwd": "D:/Games/Spelunky 2",
"env": {
"OL_DEBUG": "1"
},
},
{
"type": "lldb",
"request": "launch",
"name": "Spelunky 2 (Steam)",
"program": "D:/Steam/steamapps/common/Spelunky 2/Spel2.exe",
"cwd": "D:/Steam/steamapps/common/Spelunky 2/",
"env": {
"OL_DEBUG": "1"
},
},
{
"type": "lldb",
"request": "launch",
"name": "Info dump",
"program": "${workspaceRoot}/build-ninja/bin/Release/injector.exe",
"args": ["--info_dump"],
"cwd": "${workspaceRoot}/build-ninja/bin/Release/",
"preLaunchTask": "Build Ninja Release",
},
],
"compounds": [
{
"name": "Spelunky 2 (Steam) + Overlunky (Ninja Debug)",
"configurations": ["Spelunky 2 (Steam)", "Overlunky (Ninja Debug)"]
},
{
"name": "Spelunky 2 + Overlunky (Ninja Debug)",
"configurations": ["Spelunky 2", "Overlunky (Ninja Debug)"]
},
]
}
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Playlunky (MSVC Release)",
"program": "${workspaceRoot}/build/bin/Release/playlunky_launcher.exe",
"args": ["--console", "--exe_dir", "D:/Games/Spelunky 2/"],
"cwd": "${workspaceRoot}/build/bin/Release/",
"env": {
"OL_DEBUG": "1"
},
"preLaunchTask": "Build MSVC Release",
},
{
"type": "lldb",
"request": "launch",
"name": "Playlunky (Ninja Release)",
"program": "${workspaceRoot}/build-ninja/bin/Release/playlunky_launcher.exe",
"args": ["--console", "--exe_dir", "D:/Games/Spelunky 2/"],
"cwd": "${workspaceRoot}/build-ninja/bin/Release/",
"env": {
"OL_DEBUG": "1"
},
"preLaunchTask": "Build Ninja Release",
},
{
"type": "lldb",
"request": "launch",
"name": "Playlunky (Ninja Debug)",
"program": "${workspaceRoot}/build-ninja/bin/Debug/playlunky_launcher.exe",
"args": ["--console", "--exe_dir", "D:/Games/Spelunky 2/"],
"cwd": "${workspaceRoot}/build-ninja/bin/Debug/",
"env": {
"OL_DEBUG": "1"
},
"preLaunchTask": "Build Ninja Debug",
},
],
}
{
"version": "2.0.0",
"tasks": [
{
"label": "Build MSVC Release",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
},
"command": "(Measure-Command { cmd /c \"build.bat MSVC Release\" | Out-Host }).ToString('hh\\:mm\\:ss') | Tee-Object -FilePath build/build_times.txt -Append",
},
{
"label": "Build Clang Release",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
},
"command": "(Measure-Command { cmd /c \"build.bat Clang Release\" | Out-Host }).ToString('hh\\:mm\\:ss') | Tee-Object -FilePath build-clang/build_times.txt -Append",
},
{
"label": "Build Ninja Release",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
},
"command": "(Measure-Command { cmd /c \"build.bat Ninja Release\" | Out-Host }).ToString('hh\\:mm\\:ss') | Tee-Object -FilePath build-ninja/build_times.txt -Append",
},
{
"label": "Build Ninja Debug",
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
},
"command": "(Measure-Command { cmd /c \"build.bat Ninja Debug\" | Out-Host }).ToString('hh\\:mm\\:ss') | Tee-Object -FilePath build-ninja/build_times.txt -Append",
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment