-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild_windows.bat
163 lines (133 loc) · 5.11 KB
/
build_windows.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
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
@echo off
set BUILD_DIR_ROOT=%CD%\lzsbuild
set DEPS_BUILD_DIR_ROOT=%BUILD_DIR_ROOT%\deps
set DEPS_BUILD_DIR_ROOT_32=%DEPS_BUILD_DIR_ROOT%\win32
set DEPS_BUILD_DIR_ROOT_64=%DEPS_BUILD_DIR_ROOT%\win64
set DEPS_BUILD_DIR_ROOT_ARM64=%DEPS_BUILD_DIR_ROOT%\winarm64
set LIB_BUILD_DIR_ROOT=%BUILD_DIR_ROOT%\lib
set LIB_BUILD_DIR_ROOT_32=%LIB_BUILD_DIR_ROOT%\win32
set LIB_BUILD_DIR_ROOT_64=%LIB_BUILD_DIR_ROOT%\win64
set LIB_BUILD_DIR_ROOT_ARM64=%LIB_BUILD_DIR_ROOT%\winarm64
set ARTIFACTS_DIR_ROOT=%CD%\artifacts
set ARTIFACTS_DIR_ROOT_64=%ARTIFACTS_DIR_ROOT%\win64
set ARTIFACTS_DIR_ROOT_32=%ARTIFACTS_DIR_ROOT%\win32
set ARTIFACTS_DIR_ROOT_ARM64=%ARTIFACTS_DIR_ROOT%\winarm64
set CONFIG=RelWithDebInfo
set COMMON_CMAKE_PARAMS=-DCMAKE_BUILD_TYPE=%CONFIG% -G "Visual Studio 17 2022"
set CPARAMS_DEPS=-DCMAKE_C_FLAGS_INIT="/Qspectre /guard:cf /sdl /wd4996"
set CPARAMS=-DCMAKE_C_FLAGS_INIT="/Qspectre /guard:cf /sdl"
set CXXPARAMS=-DCMAKE_CXX_FLAGS_INIT="/W3"
set LINKER_PARAMS=-DCMAKE_EXE_LINKER_FLAGS_INIT="/PROFILE /DYNAMICBASE /CETCOMPAT /guard:cf"
set LINKER_PARAMS_ARM64=-DCMAKE_EXE_LINKER_FLAGS_INIT="/PROFILE /DYNAMICBASE /guard:cf"
echo Common cmake params: %COMMON_CMAKE_PARAMS%
echo 32-bit dependencies artifacts dir: %ARTIFACTS_DIR_ROOT_32%
echo 64-bit dependencies artifacts dir: %ARTIFACTS_DIR_ROOT_64%
echo 64-bit arm dependencies artifacts dir: %ARTIFACTS_DIR_ROOT_ARM64%
echo 32-bit dependencies build root: %DEPS_BUILD_DIR_ROOT_32%
echo 64-bit dependencies build root: %DEPS_BUILD_DIR_ROOT_64%
echo 64-bit arm dependencies build root: %DEPS_BUILD_DIR_ROOT_ARM64%
echo 32-bit library build root: %LIB_BUILD_DIR_ROOT_32%
echo 64-bit library build root: %LIB_BUILD_DIR_ROOT_64%
echo 64-bit arm library build root: %LIB_BUILD_DIR_ROOT_ARM64%
pushd .
cd external\vcpkg
call bootstrap-vcpkg.bat
popd
external\vcpkg\vcpkg.exe integrate install
if %errorlevel% neq 0 exit /b %errorlevel%
REM 64-bit deps
mkdir "%DEPS_BUILD_DIR_ROOT_64%"
cmake %COMMON_CMAKE_PARAMS% ^
%CPARAMS_DEPS% ^
%CXXPARAMS% ^
%LINKER_PARAMS% ^
-B "%DEPS_BUILD_DIR_ROOT_64%" ^
-DVCPKG_TARGET_TRIPLET=x64-windows-static ^
-DBUILD_DEPENDENCIES=ON ^
"-DARTIFACTS_ROOT_DIR=%ARTIFACTS_DIR_ROOT_64%" ^
"-DCMAKE_INSTALL_PREFIX=%ARTIFACTS_DIR_ROOT_64%" ^
-A x64 .
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --build "%DEPS_BUILD_DIR_ROOT_64%" -v --config %CONFIG%
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --install "%DEPS_BUILD_DIR_ROOT_64%" --config %CONFIG%
if %errorlevel% neq 0 exit /b %errorlevel%
REM 64-bit arm deps
mkdir "%DEPS_BUILD_DIR_ROOT_ARM64%"
cmake %COMMON_CMAKE_PARAMS% ^
%CPARAMS_DEPS% ^
%CXXPARAMS% ^
%LINKER_PARAMS_ARM64% ^
-B "%DEPS_BUILD_DIR_ROOT_ARM64%" ^
-DVCPKG_TARGET_TRIPLET=arm-windows-static ^
-DBUILD_DEPENDENCIES=ON ^
"-DARTIFACTS_ROOT_DIR=%ARTIFACTS_DIR_ROOT_ARM64%" ^
"-DCMAKE_INSTALL_PREFIX=%ARTIFACTS_DIR_ROOT_ARM64%" ^
-A arm64 .
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --build "%DEPS_BUILD_DIR_ROOT_ARM64%" -v --config %CONFIG%
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --install "%DEPS_BUILD_DIR_ROOT_ARM64%" --config %CONFIG%
if %errorlevel% neq 0 exit /b %errorlevel%
REM 32-bit deps
mkdir "%DEPS_BUILD_DIR_ROOT_32%"
cmake %COMMON_CMAKE_PARAMS% ^
%CPARAMS_DEPS% ^
%CXXPARAMS% ^
%LINKER_PARAMS% ^
-B "%DEPS_BUILD_DIR_ROOT_32%" ^
-DVCPKG_TARGET_TRIPLET=x86-windows-static ^
-DBUILD_DEPENDENCIES=ON ^
"-DARTIFACTS_ROOT_DIR=%ARTIFACTS_DIR_ROOT_32%" ^
"-DCMAKE_INSTALL_PREFIX=%ARTIFACTS_DIR_ROOT_32%" ^
-A Win32 .
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --build "%DEPS_BUILD_DIR_ROOT_32%" --config %CONFIG% -v
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --install "%DEPS_BUILD_DIR_ROOT_32%" --config %CONFIG%
if %errorlevel% neq 0 exit /b %errorlevel%
REM 64-bit library
mkdir "%LIB_BUILD_DIR_ROOT_64%"
cmake %COMMON_CMAKE_PARAMS% ^
%CPARAMS% ^
%CXXPARAMS% ^
%LINKER_PARAMS% ^
-B "%LIB_BUILD_DIR_ROOT_64%" ^
-DVCPKG_TARGET_TRIPLET=x64-windows-static ^
-DBUILD_LIBZIP=ON ^
"-DARTIFACTS_ROOT_DIR=%ARTIFACTS_DIR_ROOT_64%" ^
"-DCMAKE_INSTALL_PREFIX=%ARTIFACTS_DIR_ROOT_64%" ^
-A x64 .
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --build "%LIB_BUILD_DIR_ROOT_64%" --config %CONFIG% -v
if %errorlevel% neq 0 exit /b %errorlevel%
REM 64-bit arm library
mkdir "%LIB_BUILD_DIR_ROOT_ARM64%"
cmake %COMMON_CMAKE_PARAMS% ^
%CPARAMS% ^
%CXXPARAMS% ^
%LINKER_PARAMS_ARM64% ^
-B "%LIB_BUILD_DIR_ROOT_ARM64%" ^
-DVCPKG_TARGET_TRIPLET=arm-windows-static ^
-DBUILD_LIBZIP=ON ^
"-DARTIFACTS_ROOT_DIR=%ARTIFACTS_DIR_ROOT_ARM64%" ^
"-DCMAKE_INSTALL_PREFIX=%ARTIFACTS_DIR_ROOT_ARM64%" ^
-A arm64 .
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --build "%LIB_BUILD_DIR_ROOT_ARM64%" --config %CONFIG% -v
if %errorlevel% neq 0 exit /b %errorlevel%
REM 32-bit library
mkdir "%LIB_BUILD_DIR_ROOT_32%"
cmake %COMMON_CMAKE_PARAMS% ^
%CPARAMS% ^
%CXXPARAMS% ^
%LINKER_PARAMS% ^
-B "%LIB_BUILD_DIR_ROOT_32%" ^
-DVCPKG_TARGET_TRIPLET=x86-windows-static ^
-DBUILD_LIBZIP=ON ^
"-DARTIFACTS_ROOT_DIR=%ARTIFACTS_DIR_ROOT_32%" ^
"-DCMAKE_INSTALL_PREFIX=%ARTIFACTS_DIR_ROOT_32%" ^
-A Win32 .
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --build "%LIB_BUILD_DIR_ROOT_32%" --config %CONFIG% -v
if %errorlevel% neq 0 exit /b %errorlevel%