mirror of
https://github.com/Imp0ssibl33z/BA-translator.git
synced 2025-12-10 05:19:38 +05:00
83 lines
2.3 KiB
Batchfile
83 lines
2.3 KiB
Batchfile
@echo off
|
|
REM FlatBuffers Compiler Setup Script for Windows
|
|
REM This script downloads and sets up the FlatBuffers compiler (flatc.exe) for use with the BA-translator project
|
|
|
|
echo FlatBuffers Compiler Setup for BA-translator
|
|
echo =============================================
|
|
echo.
|
|
|
|
REM Check if flatc.exe already exists
|
|
if exist "flatc.exe" (
|
|
echo flatc.exe already exists in current directory.
|
|
echo Checking version...
|
|
flatc.exe --version
|
|
echo.
|
|
choice /C YN /M "Do you want to re-download flatc.exe"
|
|
if errorlevel 2 goto :end
|
|
echo.
|
|
)
|
|
|
|
echo Downloading FlatBuffers compiler...
|
|
echo.
|
|
|
|
REM Create temporary directory
|
|
set TEMP_DIR=%TEMP%\flatbuffers_download
|
|
if exist "%TEMP_DIR%" rmdir /s /q "%TEMP_DIR%"
|
|
mkdir "%TEMP_DIR%"
|
|
|
|
REM Download the latest FlatBuffers release (adjust URL as needed)
|
|
echo Downloading from GitHub releases...
|
|
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri 'https://github.com/google/flatbuffers/releases/latest/download/Windows.flatc.binary.zip' -OutFile '%TEMP_DIR%\flatbuffers.zip'}"
|
|
|
|
if not exist "%TEMP_DIR%\flatbuffers.zip" (
|
|
echo.
|
|
echo ERROR: Failed to download FlatBuffers compiler.
|
|
echo Please download manually from: https://github.com/google/flatbuffers/releases
|
|
echo Extract flatc.exe to the current directory.
|
|
echo.
|
|
pause
|
|
goto :end
|
|
)
|
|
|
|
echo Extracting flatc.exe...
|
|
powershell -Command "Expand-Archive -Path '%TEMP_DIR%\flatbuffers.zip' -DestinationPath '%TEMP_DIR%' -Force"
|
|
|
|
REM Find and copy flatc.exe
|
|
for /r "%TEMP_DIR%" %%f in (flatc.exe) do (
|
|
if exist "%%f" (
|
|
copy "%%f" "%~dp0flatc.exe" >nul
|
|
echo flatc.exe copied to current directory.
|
|
goto :found
|
|
)
|
|
)
|
|
|
|
echo ERROR: flatc.exe not found in downloaded archive.
|
|
echo Please download manually and place flatc.exe in the current directory.
|
|
pause
|
|
goto :cleanup
|
|
|
|
:found
|
|
echo.
|
|
echo Testing flatc.exe...
|
|
flatc.exe --version
|
|
if errorlevel 1 (
|
|
echo ERROR: flatc.exe is not working properly.
|
|
pause
|
|
goto :cleanup
|
|
)
|
|
|
|
echo.
|
|
echo SUCCESS: FlatBuffers compiler is ready!
|
|
echo.
|
|
echo You can now use the following commands:
|
|
echo python generate_flatbuffer_folders.py --auto
|
|
echo python generate_flatbuffer_folders.py schema.fbs
|
|
echo.
|
|
|
|
:cleanup
|
|
REM Clean up temporary files
|
|
if exist "%TEMP_DIR%" rmdir /s /q "%TEMP_DIR%"
|
|
|
|
:end
|
|
echo Setup complete.
|
|
pause |