install.bat 1.04 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
@echo off
setlocal

:: Check if project path is provided
if "%~0"=="" (
    echo Usage: install.bat PROJECT_PATH [XMAKE_CONFIG_FLAGS]
    exit /b 1
)

:: Set INFINI_ROOT
set "INFINI_ROOT=%USERPROFILE%\.infini"

:: Check if INFINI_ROOT\bin is already in PATH, if not, add it
echo %PATH% | findstr /I /C:"%INFINI_ROOT%\bin" >nul
if %errorlevel% neq 0 set "PATH=%INFINI_ROOT%\bin;%PATH%"

:: Convert relative path to absolute path
for %%I in ("%~1") do set ABS_PATH=%%~fI

:: Change to the project directory
cd %ABS_PATH%

:: Build xmake config flags
set XMAKE_FLAGS=
set i=0
for %%A in (%*) do (
    if !i! gtr  set XMAKE_FLAGS=!XMAKE_FLAGS! %%A
    set /a i+=1
)

:: Start installation
xmake clean -a
if %errorlevel% neq 0 exit /b %errorlevel%

xmake f %XMAKE_FLAGS% -cv
if %errorlevel% neq 0 exit /b %errorlevel%

xmake
if %errorlevel% neq 0 exit /b %errorlevel%

xmake install
if %errorlevel% neq 0 exit /b %errorlevel%

xmake build infiniop-test
if %errorlevel% neq 0 exit /b %errorlevel%

xmake install infiniop-test
if %errorlevel% neq 0 exit /b %errorlevel%