@@ -75,7 +75,7 @@ def install_x86_support_libraries():
7575 utils .run_command (['apt' , 'install' , '-y' ] + packages , as_root = True )
7676
7777
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 ):
7979 """Install packages with vcpkg.
8080
8181 This does the following,
@@ -85,6 +85,7 @@ def _install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library):
8585 Args:
8686 arch (str): Architecture (eg: 'x86', 'x64').
8787 msvc_runtime_library (str): Runtime library for MSVC (eg: 'static', 'dynamic').
88+ use_openssl (bool): Use OpenSSL based vcpkg response files.
8889 """
8990
9091 # Install vcpkg executable if its not installed already
@@ -101,15 +102,21 @@ def _install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library):
101102 # for each desktop platform, there exists a vcpkg response file in the repo
102103 # (external/vcpkg_<triplet>_response_file.txt) defined for each target triplet
103104 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 ))
106112
107113 # Eg: ./external/vcpkg/vcpkg install @external/vcpkg_x64-osx_response_file.txt
108114 # --disable-metrics
109115 utils .run_command ([vcpkg_executable_file_path , 'install' ,
110116 '@' + vcpkg_response_file_path , '--disable-metrics' ])
111117
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 ):
113120 """Install packages with vcpkg and optionally cleanup any intermediates.
114121
115122 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
119126 arch (str): Architecture (eg: 'x86', 'x64').
120127 msvc_runtime_library (str): Runtime library for MSVC (eg: 'static', 'dynamic').
121128 cleanup (bool): Clean up intermediate files used during installation.
129+ use_openssl (bool): Use OpenSSL based vcpkg response files.
122130
123131 Raises:
124132 (ValueError) If installation wasn't successful.
125133 """
126- _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library )
134+ _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library , use_openssl )
127135 vcpkg_triplet = utils .get_vcpkg_triplet (arch , msvc_runtime_library )
128136 # Verify the installation with an attempt to auto fix any issues.
129137 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
141149 utils .clean_vcpkg_temp_data ()
142150
143151def 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 ):
145153 """ CMake configure.
146154
147155 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
156164 config (str): Release/Debug config.
157165 If its not specified, cmake's default is used (most likely Debug).
158166 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.
159169 """
160170 cmd = ['cmake' , '-S' , '.' , '-B' , build_dir ]
161171
@@ -201,7 +211,8 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
201211 if (target_format ):
202212 cmd .append ('-DFIREBASE_XCODE_TARGET_FORMAT={0}' .format (target_format ))
203213
204- cmd .append ('-DFIREBASE_USE_BORINGSSL=ON' )
214+ if not use_openssl :
215+ cmd .append ('-DFIREBASE_USE_BORINGSSL=ON' )
205216 utils .run_command (cmd )
206217
207218def main ():
@@ -218,15 +229,15 @@ def main():
218229
219230 # Install C++ dependencies using vcpkg
220231 install_cpp_dependencies_with_vcpkg (args .arch , args .msvc_runtime_library ,
221- cleanup = True )
232+ cleanup = True , use_openssl = args . use_openssl )
222233
223234 if args .vcpkg_step_only :
224235 print ("Exiting without building the Firebase C++ SDK as just vcpkg step was requested." )
225236 return
226237
227238 # CMake configure
228239 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 )
230241
231242 # Small workaround before build, turn off -Werror=sign-compare for a specific Firestore core lib.
232243 if not utils .is_windows_os ():
@@ -267,6 +278,7 @@ def parse_cmdline_args():
267278 parser .add_argument ('--config' , default = 'Release' , help = 'Release/Debug config' )
268279 parser .add_argument ('--target' , nargs = '+' , help = 'A list of CMake build targets (eg: firebase_app firebase_auth)' )
269280 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' )
270282 args = parser .parse_args ()
271283 return args
272284
0 commit comments