@echo off :: SimpleRemoter Quick Build Script :: Usage: build.cmd [release|debug] [x64|x86|all] [server|clean|publish|go-server|server-linux|serverd|client] [-name NAME] :: go-server Build Go fallback server only - Bin\YamaGo_x64.exe :: go-server publish Same, plus UPX --best compression :: server-linux Cross-compile Go server for Linux - Bin\server_linux_amd64 :: serverd Debug server only (x64) - Bin\Yama_x64d.exe :: client Debug client (x64) - x64\Debug\ghost.exe :: -name NAME Server output name, writes Bin\NAME_x64.exe instead of :: Bin\Yama_x64.exe. Use it to build while the Release :: server is running and Bin\Yama_x64.exe is locked: :: build.cmd server -name YamaTest :: Applies to server / serverd / publish. :: :: NOTE: keep this file pure ASCII. cmd reads .cmd as the OEM code page (936 :: here), so UTF-8 text can swallow the following newline and merge the next :: command into a comment line - which then turns its ">" into a redirect. setlocal enabledelayedexpansion :: Capture the script directory before any shift: shift moves %0 along with :: %1..%9, after which %~dp0 resolves to the current directory instead. set SCRIPT_DIR=%~dp0 set CONFIG=Release set PLATFORM=x64 set EXTRA_ARGS= set SERVER_NAME= :parse_args if "%~1"=="" goto :run if /i "%~1"=="release" (set CONFIG=Release& shift& goto :parse_args) if /i "%~1"=="debug" (set CONFIG=Debug& shift& goto :parse_args) if /i "%~1"=="x64" (set PLATFORM=x64& shift& goto :parse_args) if /i "%~1"=="x86" (set PLATFORM=x86& shift& goto :parse_args) if /i "%~1"=="all" (set PLATFORM=all& shift& goto :parse_args) if /i "%~1"=="server" (set EXTRA_ARGS=!EXTRA_ARGS! -ServerOnly& shift& goto :parse_args) if /i "%~1"=="clean" (set EXTRA_ARGS=!EXTRA_ARGS! -Clean& shift& goto :parse_args) if /i "%~1"=="publish" (set EXTRA_ARGS=!EXTRA_ARGS! -Publish& shift& goto :parse_args) if /i "%~1"=="go-server" (set EXTRA_ARGS=!EXTRA_ARGS! -GoServer& shift& goto :parse_args) if /i "%~1"=="server-linux" (set EXTRA_ARGS=!EXTRA_ARGS! -GoServerLinux& shift& goto :parse_args) :: Debug presets: serverd = debug server x64 only, client = debug ghost x64 only if /i "%~1"=="serverd" (set CONFIG=Debug& set PLATFORM=x64& set EXTRA_ARGS=!EXTRA_ARGS! -ServerOnly& shift& goto :parse_args) if /i "%~1"=="client" (set CONFIG=Debug& set PLATFORM=x64& set EXTRA_ARGS=!EXTRA_ARGS! -ClientOnly& shift& goto :parse_args) if /i "%~1"=="-name" ( if "%~2"=="" ( echo ERROR: -name needs a value, e.g. build.cmd server -name YamaTest exit /b 1 ) set SERVER_NAME=%~2 shift shift goto :parse_args ) echo Unknown argument: %~1 shift goto :parse_args :run echo. echo Building SimpleRemoter: %CONFIG% ^| %PLATFORM% if not "%SERVER_NAME%"=="" echo Server name: %SERVER_NAME% echo. set NAME_ARG= if not "%SERVER_NAME%"=="" set NAME_ARG=-ServerName "%SERVER_NAME%" powershell -ExecutionPolicy Bypass -File "%SCRIPT_DIR%build.ps1" -Config %CONFIG% -Platform %PLATFORM% %EXTRA_ARGS% %NAME_ARG% if %errorlevel% neq 0 ( echo. echo Build FAILED! pause exit /b 1 ) echo. pause