Skip to content

Commit

Permalink
Try to use boringssl instead of openssl for https on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVautherin committed Dec 4, 2024
1 parent ce9d3a3 commit f9ed83e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
4 changes: 2 additions & 2 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (SUPERBUILD)
build_target(liblzma)

if(NOT BUILD_WITHOUT_CURL)
build_target(openssl)
build_target(boringssl)

if(NOT IOS)
build_target(zlib-ng)
Expand All @@ -25,7 +25,7 @@ if (SUPERBUILD)

if(BUILD_MAVSDK_SERVER)
if (BUILD_WITHOUT_CURL)
build_target(openssl)
build_target(boringssl)
endif()

build_target(cares)
Expand Down
52 changes: 52 additions & 0 deletions third_party/boringssl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.10.2)

project(external-boringssl)
include(ExternalProject)

list(APPEND CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}"
"-DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}"
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
"-DBUILD_SHARED_LIBS=OFF"
)

if(ANDROID)
list(APPEND CMAKE_ARGS
"-DANDROID_ABI:STRING=${ANDROID_ABI}"
"-DANDROID_STL:STRING=${ANDROID_STL}"
"-DANDROID_PLATFORM=${ANDROID_PLATFORM}"
)
elseif(IOS)
list(APPEND CMAKE_ARGS
"-DIOS_PLATFORM=${IOS_PLATFORM}"
)
endif()

# We disable ASM optimizations for MSVC and iOS (see above for iOS), which
# might have a performance impact on secure communications.
# This should be benchmarked/evaluated before we decide if it is worth
# enabling them or not in our case.
#
# More information here: https://github.com/grpc/grpc/issues/9440
#if (IOS OR MSVC)
# list(APPEND CMAKE_ARGS
# "-DOPENSSL_NO_ASM=ON" # Note: https://github.com/grpc/grpc/issues/9440
# )
#else()
# list(APPEND CMAKE_ARGS
# "-DOPENSSL_NO_ASM=OFF" # Note: https://github.com/grpc/grpc/issues/9440
# )
#endif()

message(STATUS "Preparing external project \"boringssl\" with args:")
foreach(CMAKE_ARG ${CMAKE_ARGS})
message(STATUS "-- ${CMAKE_ARG}")
endforeach()

ExternalProject_add(
boringssl
URL https://github.com/google/boringssl/releases/download/0.20241203.0/boringssl-0.20241203.0.tar.gz
URL_MD5 3320699951028ba64150b5296bc9d0e6
PREFIX boringssl
CMAKE_ARGS "${CMAKE_ARGS}"
)

0 comments on commit f9ed83e

Please sign in to comment.