@@ -75,7 +75,7 @@ def install_x86_support_libraries():
75
75
utils .run_command (['apt' , 'install' , '-y' ] + packages , as_root = True )
76
76
77
77
78
- def _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library ):
78
+ def _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library , use_openssl = False ):
79
79
"""Install packages with vcpkg.
80
80
81
81
This does the following,
@@ -85,6 +85,7 @@ def _install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library):
85
85
Args:
86
86
arch (str): Architecture (eg: 'x86', 'x64').
87
87
msvc_runtime_library (str): Runtime library for MSVC (eg: 'static', 'dynamic').
88
+ use_openssl (bool): Use OpenSSL based vcpkg response files.
88
89
"""
89
90
90
91
# Install vcpkg executable if its not installed already
@@ -101,15 +102,21 @@ def _install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library):
101
102
# for each desktop platform, there exists a vcpkg response file in the repo
102
103
# (external/vcpkg_<triplet>_response_file.txt) defined for each target triplet
103
104
vcpkg_triplet = utils .get_vcpkg_triplet (arch , msvc_runtime_library )
104
- vcpkg_response_file_path = os .path .join (os .getcwd (), 'external' , 'vcpkg_custom_data' ,
105
- 'response_files' , '{0}.txt' .format (vcpkg_triplet ))
105
+ vcpkg_response_files_dir_path = os .path .join (os .getcwd (), 'external' , 'vcpkg_custom_data' ,
106
+ 'response_files' )
107
+ if use_openssl :
108
+ vcpkg_response_files_dir_path = os .path .join (vcpkg_response_files_dir_path , 'openssl' )
109
+
110
+ vcpkg_response_file_path = os .path .join (vcpkg_response_files_dir_path ,
111
+ '{0}.txt' .format (vcpkg_triplet ))
106
112
107
113
# Eg: ./external/vcpkg/vcpkg install @external/vcpkg_x64-osx_response_file.txt
108
114
# --disable-metrics
109
115
utils .run_command ([vcpkg_executable_file_path , 'install' ,
110
116
'@' + vcpkg_response_file_path , '--disable-metrics' ])
111
117
112
- def install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library , cleanup = True ):
118
+ def install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library , cleanup = True ,
119
+ use_openssl = False ):
113
120
"""Install packages with vcpkg and optionally cleanup any intermediates.
114
121
115
122
This is a wrapper over a low level installation function and attempts the
@@ -119,11 +126,12 @@ def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, cleanup=True
119
126
arch (str): Architecture (eg: 'x86', 'x64').
120
127
msvc_runtime_library (str): Runtime library for MSVC (eg: 'static', 'dynamic').
121
128
cleanup (bool): Clean up intermediate files used during installation.
129
+ use_openssl (bool): Use OpenSSL based vcpkg response files.
122
130
123
131
Raises:
124
132
(ValueError) If installation wasn't successful.
125
133
"""
126
- _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library )
134
+ _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library , use_openssl )
127
135
vcpkg_triplet = utils .get_vcpkg_triplet (arch , msvc_runtime_library )
128
136
# Verify the installation with an attempt to auto fix any issues.
129
137
success = utils .verify_vcpkg_build (vcpkg_triplet , attempt_auto_fix = True )
@@ -142,7 +150,7 @@ def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, cleanup=True
142
150
143
151
def cmake_configure (build_dir , arch , msvc_runtime_library = 'static' , linux_abi = 'legacy' ,
144
152
build_tests = True , config = None , target_format = None ,
145
- disable_vcpkg = False , verbose = False ):
153
+ use_openssl = False , disable_vcpkg = False , verbose = False ):
146
154
""" CMake configure.
147
155
148
156
If you are seeing problems when running this multiple times,
@@ -157,6 +165,8 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
157
165
config (str): Release/Debug config.
158
166
If its not specified, cmake's default is used (most likely Debug).
159
167
target_format (str): If specified, build for this targetformat ('frameworks' or 'libraries').
168
+ use_openssl (bool) : Use prebuilt OpenSSL library instead of using boringssl
169
+ downloaded and built during the cmake configure step.
160
170
disable_vcpkg (bool): If True, skip vcpkg and just use CMake for deps.
161
171
verbose (bool): If True, enable verbose mode in the CMake file.
162
172
"""
@@ -203,7 +213,8 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
203
213
if (target_format ):
204
214
cmd .append ('-DFIREBASE_XCODE_TARGET_FORMAT={0}' .format (target_format ))
205
215
206
- cmd .append ('-DFIREBASE_USE_BORINGSSL=ON' )
216
+ if not use_openssl :
217
+ cmd .append ('-DFIREBASE_USE_BORINGSSL=ON' )
207
218
208
219
# Print out every command while building.
209
220
if verbose :
@@ -224,18 +235,20 @@ def main():
224
235
if args .arch == 'x86' and utils .is_linux_os ():
225
236
install_x86_support_libraries ()
226
237
238
+ # Install C++ dependencies using vcpkg
227
239
if not args .disable_vcpkg :
228
240
# Install C++ dependencies using vcpkg
229
241
install_cpp_dependencies_with_vcpkg (args .arch , args .msvc_runtime_library ,
230
- cleanup = True )
242
+ cleanup = True , use_openssl = args . use_openssl )
231
243
232
244
if args .vcpkg_step_only :
233
245
print ("Exiting without building the Firebase C++ SDK as just vcpkg step was requested." )
234
246
return
235
247
236
248
# CMake configure
237
249
cmake_configure (args .build_dir , args .arch , args .msvc_runtime_library , args .linux_abi ,
238
- args .build_tests , args .config , args .target_format , args .disable_vcpkg , args .verbose )
250
+ args .build_tests , args .config , args .target_format ,
251
+ args .use_openssl , args .disable_vcpkg , args .verbose )
239
252
240
253
# CMake build
241
254
# cmake --build build -j 8
@@ -264,6 +277,7 @@ def parse_cmdline_args():
264
277
parser .add_argument ('--config' , default = 'Release' , help = 'Release/Debug config' )
265
278
parser .add_argument ('--target' , nargs = '+' , help = 'A list of CMake build targets (eg: firebase_app firebase_auth)' )
266
279
parser .add_argument ('--target_format' , default = None , help = '(Mac only) whether to output frameworks (default) or libraries.' )
280
+ parser .add_argument ('--use_openssl' , action = 'store_true' , default = None , help = 'Use openssl for build instead of boringssl' )
267
281
args = parser .parse_args ()
268
282
return args
269
283
0 commit comments