@@ -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 )
@@ -141,7 +149,7 @@ def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, cleanup=True
141
149
utils .clean_vcpkg_temp_data ()
142
150
143
151
def cmake_configure (build_dir , arch , msvc_runtime_library = 'static' , linux_abi = 'legacy' ,
144
- build_tests = True , config = None , target_format = None ):
152
+ build_tests = True , config = None , target_format = None , use_openssl = False ):
145
153
""" CMake configure.
146
154
147
155
If you are seeing problems when running this multiple times,
@@ -156,6 +164,8 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
156
164
config (str): Release/Debug config.
157
165
If its not specified, cmake's default is used (most likely Debug).
158
166
target_format (str): If specified, build for this targetformat ('frameworks' or 'libraries').
167
+ use_openssl (bool) : Use prebuilt OpenSSL library instead of using boringssl
168
+ downloaded and built during the cmake configure step.
159
169
"""
160
170
cmd = ['cmake' , '-S' , '.' , '-B' , build_dir ]
161
171
@@ -201,7 +211,8 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
201
211
if (target_format ):
202
212
cmd .append ('-DFIREBASE_XCODE_TARGET_FORMAT={0}' .format (target_format ))
203
213
204
- cmd .append ('-DFIREBASE_USE_BORINGSSL=ON' )
214
+ if not use_openssl :
215
+ cmd .append ('-DFIREBASE_USE_BORINGSSL=ON' )
205
216
utils .run_command (cmd )
206
217
207
218
def main ():
@@ -218,15 +229,15 @@ def main():
218
229
219
230
# Install C++ dependencies using vcpkg
220
231
install_cpp_dependencies_with_vcpkg (args .arch , args .msvc_runtime_library ,
221
- cleanup = True )
232
+ cleanup = True , use_openssl = args . use_openssl )
222
233
223
234
if args .vcpkg_step_only :
224
235
print ("Exiting without building the Firebase C++ SDK as just vcpkg step was requested." )
225
236
return
226
237
227
238
# CMake configure
228
239
cmake_configure (args .build_dir , args .arch , args .msvc_runtime_library , args .linux_abi ,
229
- args .build_tests , args .config , args .target_format )
240
+ args .build_tests , args .config , args .target_format , args . use_openssl )
230
241
231
242
# Small workaround before build, turn off -Werror=sign-compare for a specific Firestore core lib.
232
243
if not utils .is_windows_os ():
@@ -267,6 +278,7 @@ def parse_cmdline_args():
267
278
parser .add_argument ('--config' , default = 'Release' , help = 'Release/Debug config' )
268
279
parser .add_argument ('--target' , nargs = '+' , help = 'A list of CMake build targets (eg: firebase_app firebase_auth)' )
269
280
parser .add_argument ('--target_format' , default = None , help = '(Mac only) whether to output frameworks (default) or libraries.' )
281
+ parser .add_argument ('--use_openssl' , default = None , help = 'Use openssl for build instead of boringssl' )
270
282
args = parser .parse_args ()
271
283
return args
272
284
0 commit comments