Last active
December 24, 2021 04:05
-
-
Save Jj0YzL5nvJ/af564b9304ee4f15408951d7e4e530e8 to your computer and use it in GitHub Desktop.
Utility to build and package "GLideN64" automatically, almost a copy of GLideN64/appveyor.yml script. This is the Alpha version of: https://github.com/gonetz/GLideN64/blob/master/projects/msvc/GLideN64_Builder.cmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: Last modification: 2020/10/08 | |
setlocal enableextensions disabledelayedexpansion | |
cls | |
pushd "%~dps0" | |
set ORIG=%CD% | |
set mg=ERROR | |
set ERR=if errorlevel 1 goto err | |
if not defined ARCH set ARCH=x64 | |
set TARCH=%ARCH% | |
if not defined CONF set CONF=Release | |
set VSPF=%ProgramFiles(x86)% | |
if "%PROCESSOR_ARCHITECTURE%"=="x86" set ARCH=x86& set VSPF=%ProgramFiles% | |
set VSDEVSCRIPT=Common7\Tools\VsDevCmd.bat | |
set VS2013=Microsoft Visual Studio 12.0 | |
set VS2015=Microsoft Visual Studio 14.0 | |
set VS2017=Microsoft Visual Studio\2017 | |
set VS2019=Microsoft Visual Studio\2019 | |
for %%A in (Community Enterprise Professional) do ( | |
if exist "%VSPF%\%VS2019%\%%A\%VSDEVSCRIPT%" set VSDEVSCRIPT="%VSPF%\%VS2019%\%%A\%VSDEVSCRIPT%"& goto VSENV | |
if exist "%VSPF%\%VS2017%\%%A\%VSDEVSCRIPT%" set VSDEVSCRIPT="%VSPF%\%VS2017%\%%A\%VSDEVSCRIPT%"& goto VSENV | |
) | |
:VSENV | |
if exist "%VSPF%\%VS2015%\%VSDEVSCRIPT%" set VSDEVSCRIPT="%VSPF%\%VS2015%\%VSDEVSCRIPT%" | |
if exist "%VSPF%\%VS2013%\%VSDEVSCRIPT%" set VSDEVSCRIPT="%VSPF%\%VS2013%\%VSDEVSCRIPT%" | |
msbuild -version >nul 2>&1 | |
if errorlevel 1 call %VSDEVSCRIPT% | |
%ERR% | |
7z >nul 2>&1 | |
%ERR% | |
git --version >nul 2>&1 | |
%ERR% | |
taskkill /im msbuild.exe /f 2>nul | |
taskkill /im vctip.exe /f 2>nul | |
taskkill /im mspdbsrv.exe /f 2>nul | |
rd /s /q GLideN64 | |
git clone https://github.com/gonetz/GLideN64.git | |
%ERR% | |
:X86 | |
cd "%ORIG%" | |
if "%ARCH%"=="x86" set TARCH=Win32 | |
if not defined BUILD_PATH set BUILD_PATH=%ORIG%\build | |
if not defined QTDIR_%ARCH% set QTDIR_%ARCH%=%ORIG%\Static_Qt_%ARCH% | |
if not defined QT_BUILD_%ARCH% set QT_BUILD_%ARCH%=qt-5_7_1-%ARCH%-msvc2017-static | |
set QT_BUILD_BASE_URL=https://github.com/gonetz/GLideN64/releases/download/qt_build | |
set ALTER= | |
if "%ARCH%"=="x64" set ALTER=_x64 | |
set PJ64PluginsDirQT%ALTER%=%BUILD_PATH%\QT_for_Project64_%ARCH%\ | |
set PJ64PluginsDirWTL%ALTER%=%BUILD_PATH%\WTL_for_Project64_%ARCH%\ | |
set Mupen64PluginsDir%ALTER%=%BUILD_PATH%\for_Mupen64Plus_%ARCH%\ | |
if "%ARCH%" NEQ "x64" goto skip1 | |
if exist "%QTDIR_x64%\%QT_BUILD_x64%\include\QtCore" goto skip1 | |
curl -L -o %QT_BUILD_x64%.7z %QT_BUILD_BASE_URL%/%QT_BUILD_x64%.7z | |
%ERR% | |
7z x -o%QTDIR_x64% %QT_BUILD_x64%.7z | |
%ERR% | |
:skip1 | |
if "%ARCH%" NEQ "x86" goto skip2 | |
if exist "%QTDIR_x86%\%QT_BUILD_x86%\include\QtCore" goto skip2 | |
curl -L -o %QT_BUILD_x86%.7z %QT_BUILD_BASE_URL%/%QT_BUILD_x86%.7z | |
%ERR% | |
7z x -o%QTDIR_x86% %QT_BUILD_x86%.7z | |
%ERR% | |
:skip2 | |
cd GLideN64 | |
%ERR% | |
if "%ARCH%"=="x64" set QTDIR=%QTDIR_x64%\%QT_BUILD_x64% | |
if "%ARCH%"=="x86" set QTDIR=%QTDIR_x86%\%QT_BUILD_x86% | |
set PTS= | |
if defined TOOLSET set PTS=;PlatformToolset=%TOOLSET% | |
:: Zilmar-spec (Qt) | |
msbuild projects\msvc\GLideNUI.vcxproj /m /p:Configuration=%CONF%;Platform=%TARCH%%PTS% | |
%ERR% | |
msbuild projects\msvc\GLideN64.sln /m /p:Configuration=%CONF%_qt;Platform=%TARCH%%PTS% | |
%ERR% | |
:: Zilmar-spec (WTL) | |
msbuild projects\msvc\GLideNUI-wtl.vcxproj /m /p:Configuration=%CONF%;Platform=%TARCH%%PTS% | |
%ERR% | |
msbuild projects\msvc\GLideN64.sln /m /p:Configuration=%CONF%_wtl;Platform=%TARCH%%PTS% | |
%ERR% | |
:: Mupen64Plus | |
msbuild projects\msvc\GLideN64.sln /m /p:Configuration=%CONF%_mupenplus;Platform=%TARCH%%PTS% | |
%ERR% | |
if "%ARCH%" NEQ "x64" goto skip3 | |
:: Zilmar-spec (Qt) x64 | |
copy /y ini\GLideN64.custom.ini "%PJ64PluginsDirQT_x64%" | |
%ERR% | |
copy /y translations\release\*.qm "%PJ64PluginsDirQT_x64%" | |
%ERR% | |
:: Zilmar-spec (WTL) x64 | |
copy /y ini\GLideN64.custom.ini "%PJ64PluginsDirWTL_x64%" | |
%ERR% | |
md "%PJ64PluginsDirWTL_x64%\translations" | |
copy /y translations\wtl\*.Lang "%PJ64PluginsDirWTL_x64%\translations" | |
%ERR% | |
:: Mupen64Plus x64 | |
copy /y ini\GLideN64.custom.ini "%Mupen64PluginsDir_x64%\" | |
%ERR% | |
:: Cleanup x64 | |
del /q "%PJ64PluginsDirQT_x64%\*.lib" "%PJ64PluginsDirQT_x64%\*.exp" | |
del /q "%PJ64PluginsDirWTL_x64%\*.lib" "%PJ64PluginsDirWTL_x64%\*.exp" | |
del /q "%Mupen64PluginsDir_x64%\*.lib" "%Mupen64PluginsDir_x64%\*.exp" | |
:skip3 | |
if "%ARCH%" NEQ "x86" goto skip4 | |
:: Zilmar-spec (Qt) x86 | |
copy /y ini\GLideN64.custom.ini "%PJ64PluginsDirQT%" | |
%ERR% | |
copy /y translations\release\*.qm "%PJ64PluginsDirQT%" | |
%ERR% | |
:: Zilmar-spec (WTL) x86 | |
copy /y ini\GLideN64.custom.ini "%PJ64PluginsDirWTL%" | |
%ERR% | |
md "%PJ64PluginsDirWTL%\translations" | |
copy /y translations\wtl\*.Lang "%PJ64PluginsDirWTL%\translations" | |
%ERR% | |
:: Mupen64Plus x86 | |
copy /y ini\GLideN64.custom.ini "%Mupen64PluginsDir%\" | |
%ERR% | |
:: Cleanup x86 | |
del /q "%PJ64PluginsDirQT%\*.lib" "%PJ64PluginsDirQT%\*.exp" | |
del /q "%PJ64PluginsDirWTL%\*.lib" "%PJ64PluginsDirWTL%\*.exp" | |
del /q "%Mupen64PluginsDir%\*.lib" "%Mupen64PluginsDir%\*.exp" | |
:skip4 | |
if "%ARCH%"=="x64" ( | |
if "%1"=="--all" set ARCH=x86& goto X86 | |
) | |
set ALTER=_%ARCH% | |
if "%1"=="--all" set ALTER=_* | |
for /f "tokens=1" %%A in ('git describe --always') do set revision=%%A | |
cd "%BUILD_PATH%" | |
set archive_name=GLideN64-%revision%[email protected] | |
forfiles /p %BUILD_PATH% /m *%ALTER% /c "cmd /c 7z a %archive_name% @path\*" | |
set mg=DONE | |
echo. | |
:err | |
echo %mg%! | |
cd "%ORIG%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment