2021-08-17 19:53:14 +00:00
|
|
|
:: This is a comment
|
|
|
|
|
@echo off
|
2024-04-17 02:55:48 +05:30
|
|
|
SETLOCAL EnableDelayedExpansion
|
|
|
|
|
|
2021-08-17 19:53:14 +00:00
|
|
|
:: Preconfigure script for Windows
|
|
|
|
|
|
2021-10-26 15:55:03 +02:00
|
|
|
echo === Finding Python...
|
2021-08-17 19:53:14 +00:00
|
|
|
python --version > NUL 2> NUL
|
|
|
|
|
if %ERRORLEVEL% == 0 (
|
|
|
|
|
echo OK
|
2024-09-21 21:48:24 +02:00
|
|
|
pip show setuptools > NUL 1> NUL
|
|
|
|
|
if errorlevel 1 (
|
2024-09-19 13:37:31 +02:00
|
|
|
echo === Installing setuptools
|
|
|
|
|
python -m pip install -UI pip setuptools
|
|
|
|
|
)
|
2021-08-17 19:53:14 +00:00
|
|
|
) else (
|
|
|
|
|
echo ERROR
|
|
|
|
|
echo You need to install Python from the windows store or something
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
echo === Finding Git...
|
|
|
|
|
git --version > NUL 2> NUL
|
|
|
|
|
if %ERRORLEVEL% == 0 (
|
|
|
|
|
echo OK
|
|
|
|
|
) else (
|
|
|
|
|
echo You need to install GIT
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
|
|
|
|
git pull
|
|
|
|
|
|
|
|
|
|
echo === Testing for meson and ninja...
|
|
|
|
|
meson --help > NUL 2> NUL
|
|
|
|
|
if %ERRORLEVEL% == 0 (
|
|
|
|
|
echo FOUND
|
|
|
|
|
) else (
|
|
|
|
|
echo === Installing pyenv + meson + ninja
|
|
|
|
|
python -m venv venv
|
|
|
|
|
call venv\Scripts\activate.bat
|
|
|
|
|
echo === Testing for meson and ninja...
|
|
|
|
|
meson --help > NUL 2> NUL
|
|
|
|
|
if %ERRORLEVEL% == 0 (
|
|
|
|
|
echo FOUND
|
|
|
|
|
) else (
|
2025-03-15 20:03:28 +01:00
|
|
|
pip install -UI pip ninja meson
|
2021-08-17 20:18:43 +00:00
|
|
|
preconfigure.bat
|
|
|
|
|
exit /b 0
|
2021-08-17 19:53:14 +00:00
|
|
|
)
|
|
|
|
|
)
|
2021-09-25 13:20:23 +02:00
|
|
|
|
|
|
|
|
REM vs uses HOST_TARGET syntax, so: x86_amd64 means 32bit compiler for 64bit target
|
|
|
|
|
REM: Hosts: x86 amd64 x64
|
|
|
|
|
REM: Targets: x86 amd64 x64 arm arm64
|
2024-04-17 02:55:48 +05:30
|
|
|
REM Detect the host architecture intuitively and easily
|
|
|
|
|
|
|
|
|
|
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
|
|
|
|
|
SET "HOST_ARCH=amd64"
|
|
|
|
|
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="x86" (
|
|
|
|
|
SET "HOST_ARCH=x86"
|
2021-09-25 13:20:23 +02:00
|
|
|
) ELSE (
|
2024-04-17 02:55:48 +05:30
|
|
|
SET "HOST_ARCH=unknown"
|
2021-09-25 13:20:23 +02:00
|
|
|
)
|
|
|
|
|
|
2024-04-17 02:55:48 +05:30
|
|
|
REM Check if arguments are passed
|
|
|
|
|
IF "%~1"=="" (
|
|
|
|
|
echo Your current Host Architecture is !HOST_ARCH!
|
|
|
|
|
ECHO Please select the Target Architecture:
|
|
|
|
|
ECHO 1. x86
|
|
|
|
|
ECHO 2. amd64 [x64]
|
|
|
|
|
ECHO 3. arm
|
|
|
|
|
ECHO 4. arm64
|
|
|
|
|
SET /P "CHOICE=Enter your choice (1-4): "
|
|
|
|
|
|
|
|
|
|
REM Set target architecture based on user input
|
|
|
|
|
IF "!CHOICE!"=="1" (
|
|
|
|
|
SET "TARGET_ARCH=x86"
|
|
|
|
|
) ELSE IF "!CHOICE!"=="2" (
|
|
|
|
|
SET "TARGET_ARCH=amd64"
|
|
|
|
|
) ELSE IF "!CHOICE!"=="3" (
|
|
|
|
|
SET "TARGET_ARCH=arm"
|
|
|
|
|
) ELSE IF "!CHOICE!"=="4" (
|
|
|
|
|
SET "TARGET_ARCH=arm64"
|
|
|
|
|
) ELSE (
|
2025-02-22 15:21:13 +01:00
|
|
|
ECHO Invalid choice. Defaulting to amd64.
|
|
|
|
|
SET "TARGET_ARCH=amd64"
|
2024-04-17 02:55:48 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
|
|
REM Check if target and host are the same and set VSARCH accordingly
|
|
|
|
|
IF "!TARGET_ARCH!"=="!HOST_ARCH!" (
|
|
|
|
|
SET "VSARCH=!HOST_ARCH!"
|
|
|
|
|
) ELSE (
|
|
|
|
|
SET "VSARCH=!HOST_ARCH!_!TARGET_ARCH!"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
) ELSE (
|
|
|
|
|
REM Use provided host_target argument
|
|
|
|
|
SET "VSARCH=%1"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
ECHO VSARCH is set to: !VSARCH!
|
|
|
|
|
|
2021-08-17 19:53:14 +00:00
|
|
|
echo === Finding Visual Studio...
|
2025-08-20 07:05:08 +08:00
|
|
|
cl > NUL 2> NUL
|
2021-08-17 19:53:14 +00:00
|
|
|
if %ERRORLEVEL% == 0 (
|
2025-03-14 01:45:44 +01:00
|
|
|
echo FOUND
|
2021-08-17 19:53:14 +00:00
|
|
|
) else (
|
2025-03-14 01:45:44 +01:00
|
|
|
if EXIST "%VSINSTALLDIR%" (
|
|
|
|
|
set "vswherePath=C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
|
|
|
|
|
if exist "%vswherePath%" (
|
|
|
|
|
for /f "tokens=*" %%i in ('"%vswherePath%" -property installationName') do (
|
|
|
|
|
echo Visual Studio %%i is installed.
|
|
|
|
|
)
|
2025-03-20 19:05:10 +01:00
|
|
|
ENDLOCAL
|
2025-03-14 01:45:44 +01:00
|
|
|
call "%VSINSTALLDIR%VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
|
|
|
|
)
|
|
|
|
|
) else if EXIST "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" (
|
|
|
|
|
echo "Found 2022 Enterprise edition"
|
2025-03-20 19:05:10 +01:00
|
|
|
ENDLOCAL
|
2025-03-14 01:45:44 +01:00
|
|
|
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
|
|
|
|
) else if EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community" (
|
|
|
|
|
echo "Found 2022 Community edition"
|
2025-03-20 19:05:10 +01:00
|
|
|
ENDLOCAL
|
2025-03-14 01:45:44 +01:00
|
|
|
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
|
|
|
|
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" (
|
|
|
|
|
echo "Found 2022 BuildTools"
|
2025-03-20 19:05:10 +01:00
|
|
|
ENDLOCAL
|
2025-03-14 01:45:44 +01:00
|
|
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
|
|
|
|
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" (
|
|
|
|
|
echo "Found 2019 Community edition"
|
2025-03-20 19:05:10 +01:00
|
|
|
ENDLOCAL
|
2025-03-14 01:45:44 +01:00
|
|
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
|
|
|
|
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
|
|
|
|
|
echo "Found 2019 Enterprise edition"
|
2025-03-20 19:05:10 +01:00
|
|
|
ENDLOCAL
|
2025-03-14 01:45:44 +01:00
|
|
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
|
|
|
|
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" (
|
|
|
|
|
echo "Found 2019 Professional edition"
|
2025-03-20 19:05:10 +01:00
|
|
|
ENDLOCAL
|
2025-03-14 01:45:44 +01:00
|
|
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
|
|
|
|
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" (
|
|
|
|
|
echo "Found 2019 BuildTools"
|
2025-03-20 19:05:10 +01:00
|
|
|
ENDLOCAL
|
2025-03-14 01:45:44 +01:00
|
|
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
|
|
|
|
) else (
|
2025-03-20 19:05:10 +01:00
|
|
|
ENDLOCAL
|
2025-03-14 01:45:44 +01:00
|
|
|
echo "Not Found"
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
2021-08-17 19:53:14 +00:00
|
|
|
)
|
2021-08-23 22:17:08 +02:00
|
|
|
|
2025-08-20 07:05:08 +08:00
|
|
|
cl > NUL 2> NUL
|
2025-03-20 19:05:10 +01:00
|
|
|
if %ERRORLEVEL% == 0 (
|
|
|
|
|
echo CL FOUND
|
|
|
|
|
) else (
|
|
|
|
|
echo FAILED TO SETUP VISUAL STUDIO
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
2025-11-22 12:36:13 +01:00
|
|
|
set PATH=%PATH%;"C:\Program Files (x86)\Windows Kits\10\Debuggers\x64"
|
2021-08-17 20:18:43 +00:00
|
|
|
echo Now you can run 'configure'
|
2021-08-23 22:17:08 +02:00
|
|
|
cmd
|