forked from CrealityOfficial/CrealityPrint
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_deps.bat
More file actions
185 lines (160 loc) · 4.45 KB
/
Copy pathbuild_deps.bat
File metadata and controls
185 lines (160 loc) · 4.45 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
@echo off
@REM Only use to build depslib from deps src
set ROOT=%CD%
set build_type=%1
set cache_dep_continue=OFF
IF EXIST "%ROOT%\tools\vswhere.exe" (
for /f "usebackq tokens=*" %%i in (`%ROOT%\tools\vswhere.exe -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property catalog_productLineVersion`) do (
set LastVerion=%%i
)
)
if "%LastVerion%"=="2019" (
set VS_Version=Visual Studio 16 2019
) else (
set VS_Version=Visual Studio 17 2022
)
echo LastVerion= %LastVerion%
if [%1] == [] (
goto help
)
if [%1] == [Debug] (
set build_type=Debug
set Build_ON=ON
) else (
set build_type=Release
set Build_ON=OFF
)
set DEL_ZIP_CACHE=ON
SET ROOT_DEP=%ROOT%\deps
SET DEP_BUILD_DIR=%ROOT_DEP%\build_%build_type%
SET DEP_INSTALL_DIR=%ROOT%\dep_%build_type%
SET ENV_DEPS=%DEPS_DLL_PATH_RELEASE%
if(%build_type% == Debug) (
echo "Debug build"
) else (
echo ENV_DEPS=%ENV_DEPS%
if [%ENV_DEPS%] == [] (
echo "ENV_DEPS is empty"
) else (
SET DEP_INSTALL_DIRATH=%ENV_DEPS%
SET DEP_INSTALL_DIR=%ENV_DEPS%
)
)
if [%2] == [-c] (
set cache_dep_continue=ON
goto GenerateDep
) else (
set cache_dep_continue=OFF
)
:::deps before
echo %DEP_INSTALL_DIRATH%
if exist "%DEP_INSTALL_DIR%" (
rem need not download third deplib
echo "%DEP_INSTALL_DIR% is exist,skip build."
goto End
) else (
goto downDepsSrcZip
)
:downDepsSrcZip
set "url=http://172.20.180.14/soft/DepsLibBuild.zip"
set "zipfile=%ROOT%\DepsLibBuild.zip"
set "unzipdir=%ROOT%/"
REM 1. download zip file
echo downloading... %zipfile%
powershell -Command "(New-Object Net.WebClient).DownloadFile('%url%', '%zipfile%')"
REM 2. check download result
echo %zipfile%
if not exist "%zipfile%" (
echo download failed!
exit /b 1
)
REM 3. mkdir destdir
mkdir "%unzipdir%"
REM 4. unzip
echo unziping...
powershell -Command "Expand-Archive -LiteralPath '%zipfile%' -DestinationPath '%unzipdir%' -Force"
REM 5. check unzip result
if errorlevel 1 (
echo unzip failed.
exit /b 1
)
del "%zipfile%"
echo unzip finished
:GenerateDep_Before
echo GenerateDep
@REM Remove dep build dir if exist
IF EXIST %DEP_BUILD_DIR% (
echo RD /S /Q %DEP_BUILD_DIR%
RD /S /Q %DEP_BUILD_DIR%
) ELSE (
echo HINT: %DEP_BUILD_DIR% NOT EXIST, skip remove
)
@REM Remove dep install dir if exist
IF EXIST %DEP_INSTALL_DIR% (
echo RD /S /Q %DEP_INSTALL_DIR%
RD /S /Q %DEP_INSTALL_DIR%
) ELSE (
echo HINT: %DEP_INSTALL_DIR% NOT EXIST, skip remove
)
:GenerateDep
@REM build dep
cd %ROOT_DEP%
echo my=%ROOT_DEP%
mkdir build_%build_type%
cd build_%build_type%
echo cmake ../ -G "%VS_Version%" -A x64 -DDESTDIR="%DEP_INSTALL_DIR%" -DCMAKE_BUILD_TYPE=%build_type% -DDEP_DEBUG=%Build_ON% -DORCA_INCLUDE_DEBUG_INFO=OFF -DDEPS_ARCH=x64
cmake ../ -G "%VS_Version%" -A x64 -DDESTDIR="%DEP_INSTALL_DIR%" -DCMAKE_BUILD_TYPE=%build_type% -DDEP_DEBUG=%Build_ON% -DORCA_INCLUDE_DEBUG_INFO=OFF -DDEPS_ARCH=x64
if %cache_dep_continue% == ON (
echo cmake --build . --config %build_type% --target deps -- -m
cmake --build . --config %build_type% --target deps -- -m
goto End
)
@REM Extract DL_CACHE.zip
cd %ROOT_DEP%
IF EXIST DL_CACHE\ (
echo RD /S /Q DL_CACHE
RD /S /Q DL_CACHE
) ELSE (
echo HINT: DL_CACHE\ NOT EXIST, Skip remove
)
echo 7z x %ROOT%\DL_CACHE.zip
%ROOT%\tools\7z.exe x %ROOT%\DL_CACHE.zip
@REM REM Deal with wxWidgets
set WXWIDGETS_PREFIX_ROOT=%DEP_BUILD_DIR%\dep_wxWidgets-prefix
cd %WXWIDGETS_PREFIX_ROOT%\src
IF EXIST dep_wxWidgets\ (
echo RD /S /Q dep_wxWidgets\
RD /S /Q dep_wxWidgets\
)
echo 7z x %ROOT%\dep_wxWidgets.zip
%ROOT%\tools\7z.exe x %ROOT%\dep_wxWidgets.zip
echo python %ROOT%\wxWidgets_scrip.py %WXWIDGETS_PREFIX_ROOT%
python %ROOT%\wxWidgets_scrip.py %WXWIDGETS_PREFIX_ROOT%
:GenerateDep_After
echo GenerateDep_After
:del_unzip_cache
echo del_unzip_cache
if %DEL_ZIP_CACHE% == ON (
echo myroot=%ROOT%
del "%ROOT%\build.bat"
del "%ROOT%\DL_CACHE.zip"
del "%ROOT%\wxWidgets_scrip.py"
del "%ROOT%\dep_wxWidgets.zip"
)
:BuildDep
echo BuildDep Start
cd %DEP_BUILD_DIR%
echo cmake --build . --config %build_type% --target deps -- -m
cmake --build . --config %build_type% --target deps -- -m
:BuildDep_After
echo BuildDep_After
goto End
:help
echo -------------------------------help-----------------------
echo build.bat Debug
echo build.bat Release
echo build.bat Debug zipcache
echo build.bat Release zipcache
echo ----------------------------------------------------------
:End
echo build_deps end