forked from gatsby/embedded-autobuild
53 lines
1.6 KiB
Batchfile
53 lines
1.6 KiB
Batchfile
@echo off
|
|
REM Check if exactly two arguments are provided and not empty
|
|
if "%~2"=="" (
|
|
echo Usage: launch.bat ^<version^> ^<work_dir^>
|
|
exit /b 1
|
|
)
|
|
if not "%~3"=="" (
|
|
echo Usage: launch.bat ^<version^> ^<work_dir^>
|
|
exit /b 1
|
|
)
|
|
|
|
REM Use regex to check if input version code is valid
|
|
set "xilinx_version=%1"
|
|
set "version_pattern=20[12][01234789][.][12]"
|
|
echo %xilinx_version% | findstr /r /c:"%version_pattern%" >nul
|
|
if %errorlevel% NEQ 0 (
|
|
echo Error: %xilinx_version% is not a valid version coede ^(e.g., 2019.1^)
|
|
exit /b 1
|
|
)
|
|
|
|
REM Check if the build directory already exists
|
|
set "work_dir=%2"
|
|
if not exist "%work_dir%" (
|
|
echo Error: no `%work_dir%' folder
|
|
echo try to create project before launching SDK
|
|
pause >nul
|
|
)
|
|
|
|
REM Convert it to a integer
|
|
for /f "tokens=1,2 delims=." %%a in ("%xilinx_version%") do (
|
|
set major=%%a
|
|
set minor=%%b
|
|
)
|
|
set /a version_number=%major%%minor%
|
|
set /a lowest_vits_version=20192
|
|
set /a new_vits_version=20232
|
|
|
|
REM Determine which tool to launch based on the Xilinx version
|
|
if %version_number% lss %lowest_vits_version% (
|
|
REM Version is less than 2019.2, use xsdk
|
|
echo Launching Xilinx SDK...
|
|
xsdk -workspace "%work_dir%"
|
|
) else if %version_number% lss %new_vits_version% (
|
|
REM Version is between 2019.2 and 2023.1, use vitis
|
|
echo Launching Xilinx Vitis...
|
|
vitis -workspace "%work_dir%"
|
|
) else (
|
|
REM Version is 2023.2 or higher, use vitis -classic
|
|
echo Launching Xilinx Vitis Classic...
|
|
vitis -classic -workspace "%work_dir%"
|
|
)
|
|
|
|
exit /b 0 |