Skip to content

Instantly share code, notes, and snippets.

@devrique
Created April 5, 2021 22:12
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 devrique/1e9fa5f4090936b351f569251639de98 to your computer and use it in GitHub Desktop.
Save devrique/1e9fa5f4090936b351f569251639de98 to your computer and use it in GitHub Desktop.
Godot Engine Easy Recompile Script for Windows 10
##
# - Author: devrique (Enrique AM).
# - Description:
# This script makes easier to recompile Godot Engine project for Windows OS.
# SCons has to be installed previously before launching the script, and also
# variables from line 10 to 15 have to be configured.
# After that, launching the script will prompt for debug or release target and
# for tool compilation. It will do a git pull from the repo on the current branch
# and execute the scons compilation.
# At the end, it will open the two configured folders on Explorer to move manually
# the needed files from origin to destination.
# - License: GPLv3.
##
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
# Stop if there's an error.
$ErrorActionPreference = "Stop"
$target = "debug" # "debug"/"release_debug"
$tools = "yes" # Set "no" for export executables.
# CONFIGURE THESE VARIABLES MANUALLY!
$repo_path = "PATH-TO-GODOT-REPO-ROOT"
$destination_path = "DESTINATION-PATH"
$bits = "64"
$threads = "6"
$platform = "windows"
# Begin process.
Write-Host "Godot recompile script executed, begin? (y/anything)"
$key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
if ($key.Character -eq 'y')
{
# Select target version.
Write-Host "Target: Debug or release version? (d/r)"
do {
$target_key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
} until ($target_key.Character -eq 'd' -or $target_key.Character -eq 'r')
if ($target_key.Character -eq 'd') {
$target = "debug"
} else {
$target = "release_debug"
}
Write-Host "Target selected: $target."
# Select to compile with or without tools.
Write-Host "Compile tools? (Select 'n' to compile for export executables) (y/n)"
do {
$tools_key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
} until ($tools_key.Character -eq 'y' -or $tools_key.Character -eq 'n')
if ($tools_key.Character -eq 'y') {
$tools = "yes"
} else {
$tools = "no"
}
Write-Host "Compile tools: $tools."
Write-Host "Accessing Godot repo folder..."
cd $repo_path
Write-Host "Downloading changes..."
git pull
Write-Host "Compiling Godot with SCons..."
scons --jobs $threads platform=$platform tools=$tools target=$target bits=$bits
# Open origin and destination paths on Explorer to manually move the needed files.
explorer .\bin\
explorer $destination_path
git log -1
}
Write-Host "Godot recompile script ending... Press Enter to close."
do
{
$end_key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}
until ($end_key.VirtualKeyCode -eq 13) # Enter.
Set-ExecutionPolicy -ExecutionPolicy Restricted -Scope Process
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment