@echo off
setlocal
REM Set the current directory
set "INSTALL_DIR=%~dp0"
REM Install CMake in C:\Program Files\CMake
echo Installing CMake...
start /wait msiexec /i "%INSTALL_DIR%cmake-4.0.0-rc3-windows-x86_64.msi" /quiet /norestart INSTALLDIR="C:\Program Files\CMake"
REM Install .NET SDK
echo Installing .NET SDK...
start /wait "" "%INSTALL_DIR%dotnet-sdk-6.0.421-win-x64.exe" /quiet /norestart
REM Install Python
echo Installing Python...
start /wait "" "%INSTALL_DIR%python-3.10.5-amd64.exe" /quiet InstallAllUsers=1 PrependPath=1
REM Install VC Redistributable
echo Installing VC Redistributable...
start /wait "" "%INSTALL_DIR%vc_redist.x64.exe" /quiet /norestart
REM Pause for installation completion
echo Waiting for installations to finish...
timeout /t 10
REM Find Python path and add it to the system PATH
echo Adding Python to PATH...
for /f "delims=" %%A in ('where python') do set "PYTHON_PATH=%%A"
for %%A in ("%PYTHON_PATH%") do set "PYTHON_DIR=%%~dpA"
setx PATH "%PYTHON_DIR%;%PATH%" /M
REM Find CMake path dynamically and add it to PATH
echo Adding CMake to PATH...
for /f "delims=" %%A in ('where cmake') do set "CMAKE_PATH=%%A"
for %%A in ("%CMAKE_PATH%") do set "CMAKE_DIR=%%~dpA"
setx PATH "%CMAKE_DIR%;%PATH%" /M
REM Activate virtual environment
echo Activating virtual environment...
call venv\Scripts\activate.bat
REM Run PyInstaller
echo Building project with PyInstaller...
pyinstaller main.spec
echo Process complete!
pause