-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmingwBuild.bat
More file actions
89 lines (78 loc) · 3.1 KB
/
Copy pathmingwBuild.bat
File metadata and controls
89 lines (78 loc) · 3.1 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@echo off
setlocal
pushd "%~dp0"
REM Usage: mingwBuild.bat [Debug|Release] [SDK install prefix] [x64|arm64|all]
REM Shortcut: mingwBuild.bat [Debug|Release] [x64|arm64|all]
REM All relative build paths are anchored to this repository, even when this
REM script is called by the sibling application build.
set "BUILD_TYPE=Debug"
if /I "%~1"=="release" set "BUILD_TYPE=Release"
if /I "%~1"=="debug" set "BUILD_TYPE=Debug"
set "INSTALL_ARG=%~2"
set "TARGET_ARCH=%~3"
if not defined TARGET_ARCH if /I "%INSTALL_ARG%"=="x64" set "TARGET_ARCH=x64"
if not defined TARGET_ARCH if /I "%INSTALL_ARG%"=="arm64" set "TARGET_ARCH=arm64"
if not defined TARGET_ARCH if /I "%INSTALL_ARG%"=="all" set "TARGET_ARCH=all"
if /I "%INSTALL_ARG%"=="x64" set "INSTALL_ARG="
if /I "%INSTALL_ARG%"=="arm64" set "INSTALL_ARG="
if /I "%INSTALL_ARG%"=="all" set "INSTALL_ARG="
if not defined TARGET_ARCH set "TARGET_ARCH=%VIBRANCE_WINDOWS_ARCHITECTURE%"
if not defined TARGET_ARCH set "TARGET_ARCH=x64"
if /I "%TARGET_ARCH%"=="amd64" set "TARGET_ARCH=x64"
if /I "%TARGET_ARCH%"=="aarch64" set "TARGET_ARCH=arm64"
if /I "%TARGET_ARCH%"=="all" (
if defined INSTALL_ARG (
call "%~f0" "%BUILD_TYPE%" "%INSTALL_ARG%\windows-x64" x64
if errorlevel 1 goto :fail
call "%~f0" "%BUILD_TYPE%" "%INSTALL_ARG%\windows-arm64" arm64
if errorlevel 1 goto :fail
) else (
call "%~f0" "%BUILD_TYPE%" "%~dp0install\windows-x64" x64
if errorlevel 1 goto :fail
call "%~f0" "%BUILD_TYPE%" "%~dp0install\windows-arm64" arm64
if errorlevel 1 goto :fail
)
popd
endlocal
exit /b 0
)
if /I not "%TARGET_ARCH%"=="x64" if /I not "%TARGET_ARCH%"=="arm64" (
echo Error: architecture must be x64, arm64, or all.
popd
endlocal
exit /b 2
)
set "INSTALL_DIR=%INSTALL_ARG%"
if not defined INSTALL_DIR set "INSTALL_DIR=%~dp0install\windows-%TARGET_ARCH%"
if not exist "build" mkdir "build"
> "build\.active_build" echo %TARGET_ARCH%\%BUILD_TYPE%
echo Building vibrance-engine for Windows %TARGET_ARCH% with configuration: %BUILD_TYPE%
echo Installing vibrance-engine SDK to: %INSTALL_DIR%
set "TARGET_DIR=build\windows-%TARGET_ARCH%\%BUILD_TYPE%"
if not exist "%TARGET_DIR%" mkdir "%TARGET_DIR%"
echo Configuring engine CMake for %BUILD_TYPE%...
if /I "%TARGET_ARCH%"=="arm64" (
cmake -S . -B "%TARGET_DIR%" -G "MinGW Makefiles" ^
"-DCMAKE_TOOLCHAIN_FILE=%~dp0cmake\toolchains\windows-arm64-llvm-mingw.cmake" ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-DVIBRANCE_WINDOWS_ARCHITECTURE=arm64 ^
"-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%"
) else (
cmake -S . -B "%TARGET_DIR%" -G "MinGW Makefiles" ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-DVIBRANCE_WINDOWS_ARCHITECTURE=x64 ^
"-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%"
)
if errorlevel 1 goto :fail
cmake --build "%TARGET_DIR%" --config %BUILD_TYPE%
if errorlevel 1 goto :fail
cmake --install "%TARGET_DIR%" --prefix "%INSTALL_DIR%" --config %BUILD_TYPE%
if errorlevel 1 goto :fail
popd
endlocal
exit /b 0
:fail
set "BUILD_EXIT_CODE=%errorlevel%"
if "%BUILD_EXIT_CODE%"=="0" set "BUILD_EXIT_CODE=1"
popd
endlocal & exit /b %BUILD_EXIT_CODE%