-
Notifications
You must be signed in to change notification settings - Fork 33
/
build.bat
96 lines (83 loc) · 2.62 KB
/
build.bat
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
90
91
92
93
94
95
96
@echo off
SETLOCAL ENABLEEXTENSIONS
SET BUILD_FOLDER=%CD%\build
SET BUILD_SIMULATOR_FOLDER=%CD%\build_simulator
SET TOOLS_FOLDER=%CD%\tools
SET MAKE_OAT_FILE_PATH=%TOOLS_FOLDER%\ota_file_maker
SET MAKE_PADDING_FILE_PATH=%TOOLS_FOLDER%\padding_bin_file
SET ASTYLE_PATH=%TOOLS_FOLDER%\AStyle.bat
SET PACK_PATH=%CD%\pack.bat
SET LANGUAGE_PATH=%CD%\src\ui\lv_i18n
SET LANGUAGE_SCRIPT=py data_loader.py
SET RUST_C_PATH=%CD%\rust\rust_c
SET "build_options=log copy production screen debug format release rebuild btc_only simulator language clean"
FOR %%O IN (%build_options%) DO SET "build_%%O=false"
FOR %%i in (%*) DO (
IF /I "%%i"=="format" (
pushd %TOOLS_FOLDER%
echo format file...
call %ASTYLE_PATH%
popd
) ELSE (
SET "build_%%i=true"
)
)
IF "%build_rebuild%"=="true" (
IF EXIST %BUILD_FOLDER% rd /s /q %BUILD_FOLDER%
pushd %RUST_C_PATH%
cargo clean
popd
)
IF NOT EXIST %BUILD_FOLDER% mkdir %BUILD_FOLDER%
IF NOT EXIST %BUILD_FOLDER%\padding_bin_file.py (
copy %TOOLS_FOLDER%\padding_bin_file\padding_bin_file.py %BUILD_FOLDER%\padding_bin_file.py /Y
)
CALL :EXECUTE_BUILD
ENDLOCAL
GOTO :EOF
:EXECUTE_BUILD
IF "%build_language%"=="true" (
pushd %LANGUAGE_PATH%
%LANGUAGE_SCRIPT%
popd
)
SET cmake_parm=
IF "%build_production%"=="true" SET "cmake_parm=%cmake_parm% -DBUILD_PRODUCTION=true"
IF "%build_btc_only%"=="true" SET "cmake_parm=%cmake_parm% -DBTC_ONLY=true"
IF "%build_screen%"=="true" SET "cmake_parm=%cmake_parm% -DENABLE_SCREEN_SHOT=true"
IF "%build_debug%"=="true" SET "cmake_parm=%cmake_parm% -DDEBUG_MEMORY=true"
IF "%build_simulator%"=="true" (
IF NOT EXIST %BUILD_SIMULATOR_FOLDER% mkdir %BUILD_SIMULATOR_FOLDER%
pushd %BUILD_SIMULATOR_FOLDER%
cmake -G "Unix Makefiles" -DBUILD_TYPE=Simulator %cmake_parm% ..
make -j16
popd
) ELSE (
pushd %BUILD_FOLDER%
cmake -G "Unix Makefiles" %cmake_parm% ..
IF "%build_log%"=="true" (
make -j16 > makefile.log 2>&1
) ELSE (
make -j16
)
python3 padding_bin_file.py mh1903.bin
popd
)
IF "%build_copy%"=="true" (
echo generating pillar.bin file...
pushd %MAKE_OAT_FILE_PATH%
echo generating pillar.bin file...
call make_ota_file.bat %CD%\build\pillar.bin
call make_ota_file.bat %CD%\build\keystone3.bin
call make_ota_file.bat d:\pillar.bin
popd
) ELSE IF "%build_release%"=="true" (
pushd %MAKE_OAT_FILE_PATH%
echo generating pillar.bin file...
call make_ota_file.bat %CD%\build\pillar.bin
call make_ota_file.bat %CD%\build\keystone3.bin
popd
) ELSE IF "%build_simulator%"=="true" (
.\build\simulator.exe
)
GOTO :EOF