Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
2155b63
Add boringssl rules.
jonsimantov Dec 7, 2020
8e01d52
Patch boringssl to look like openssl.
jonsimantov Dec 7, 2020
be3173b
Force boringssl for curl build.
jonsimantov Dec 8, 2020
5562af2
Merge branch 'feature/fix-corrupt-mac-libs' into feature/js-switch-to…
jonsimantov Dec 8, 2020
8656c5b
Merge branch 'feature/fix-corrupt-mac-libs' into feature/js-switch-to…
jonsimantov Dec 8, 2020
90912c2
Populate the boringssl aliases with paths to the built libs.
jonsimantov Dec 8, 2020
23f1e1e
Install golang (required for boringssl) in prereqs.
jonsimantov Dec 8, 2020
1b15f97
Additional work to get boringssl to be used by all deps.
jonsimantov Dec 8, 2020
9f56b89
Move boringssl declares earlier.
jonsimantov Dec 8, 2020
86c27f1
Merge branch 'dev' into feature/js-switch-to-boringssl
jonsimantov Dec 9, 2020
3d96595
Fix spelling of Nanopb library.
jonsimantov Dec 9, 2020
56fb379
Merge branch 'feature/js-switch-to-boringssl' of https://github.com/f…
jonsimantov Dec 9, 2020
5f3138b
Fix packaging script to rename dependencies in *all* libraries, not j…
jonsimantov Dec 9, 2020
75c4ee5
Don't build boringssl on desktop.
jonsimantov Dec 9, 2020
e257fc6
Try the newer binutils again.
jonsimantov Dec 9, 2020
091b16d
Don't use if(DESKTOP) in external_rules.cmake
jonsimantov Dec 9, 2020
8019d82
Make BoringSSL build cross-platform and propagate some build flags to
jonsimantov Dec 9, 2020
334e94c
Fix OSX architecture to not emit the flag if it's blank.
jonsimantov Dec 9, 2020
692b59e
Disable an MSVC warning-as-error that boringssl triggers.
jonsimantov Dec 9, 2020
62a9104
Merge branch 'feature/js-switch-to-boringssl' of https://github.com/f…
jonsimantov Dec 9, 2020
5526066
For BoringSSL, only build the ssl and crypto targets.
jonsimantov Dec 9, 2020
459b2dd
Remove flag to disable warning.
jonsimantov Dec 9, 2020
1ee06fb
Set no-asm mode for boringssl in the main package as well.
jonsimantov Dec 9, 2020
9886184
Rename Curl option for Windows that changed names in the newer version.
jonsimantov Dec 9, 2020
db060cb
Don't build CURL tests.
jonsimantov Dec 9, 2020
972a2cc
Pass MSVC runtime flags directly to sub-build.
jonsimantov Dec 9, 2020
3685d0b
Move openssl-specific cmake subbuild options out, in case we use addi…
jonsimantov Dec 9, 2020
c164701
Pass along Linux c++11 ABI option, and MSVC runtime.
jonsimantov Dec 9, 2020
83b6bf9
Pass along Linux c++11 ABI option, and MSVC runtime.
jonsimantov Dec 9, 2020
85151d5
Revert "Pass MSVC runtime flags directly to sub-build."
jonsimantov Dec 9, 2020
b1562c0
Merge branch 'feature/js-switch-to-boringssl' of https://github.com/f…
jonsimantov Dec 9, 2020
84002a6
Fix cmake format issue.
jonsimantov Dec 9, 2020
ef11889
Fix cmake.
jonsimantov Dec 9, 2020
6c705b3
Fix subbuild flags and add generator.
jonsimantov Dec 9, 2020
86202ff
Change strequals to strequal
jonsimantov Dec 9, 2020
00e7aa8
Add C++11 ABI option to main CMake file, and fix stdlib.h include file
jonsimantov Dec 9, 2020
fa063b4
Get the correct ssl and crypto path on Windows.
jonsimantov Dec 9, 2020
31f5ca1
Swap the library order, as ssl needs to be linked before crypto.
jonsimantov Dec 9, 2020
06e457c
Fix the link order of libssl.a and libcrypto.a, which for some reason
jonsimantov Dec 9, 2020
c6e7c01
Fix extraneous libcrypto linkage.
jonsimantov Dec 9, 2020
df68f32
Repeat the same SSL workaround for Firebase C++ tests also.
jonsimantov Dec 9, 2020
284b5f5
Fix target link libraries for ssl/crypto.
jonsimantov Dec 9, 2020
a63f09a
Remove workaround since now the imported OpenSSL::SSL library is set to
jonsimantov Dec 9, 2020
e16bdc8
Fix database test dependency for boringssl.
jonsimantov Dec 9, 2020
5dbdc00
Add additional dependencies for app, required for unit tests building
jonsimantov Dec 10, 2020
d486c8e
Clean up platform-specific dependencies - we only need crypt32 on
jonsimantov Dec 10, 2020
b6d505d
Fix Windows generated package names to be merged in.
jonsimantov Dec 10, 2020
2af8037
Fix bad ssl library prefix in packaging script, and make the grpc libs
jonsimantov Dec 10, 2020
0481990
Fix database libcrypto dependendency
jonsimantov Dec 10, 2020
fea8495
Fix linux 32-bit build error due to cflags mis-setting.
jonsimantov Dec 10, 2020
91afab6
On Windows, the cmake subbuild needs to be passed --config Release for
jonsimantov Dec 10, 2020
e7812a2
Turn on verbose mode for all builds.
jonsimantov Dec 10, 2020
8eec1a2
Turn on verbose mode in CI build, and turn off in packaging build.
jonsimantov Dec 10, 2020
91b2303
Remove openssl from vcpkg list, as it's causing tests to use it rather
jonsimantov Dec 10, 2020
7302e31
Change around dependencies for libssl and libcrypto on Windows.
jonsimantov Dec 10, 2020
148c9c2
Add some diagnostics to detect if the openssl library changes, and also
jonsimantov Dec 10, 2020
c110209
Add a workaround to copy the built BoringSSL libraries to
jonsimantov Dec 10, 2020
52bca9c
Fix workaround path.
jonsimantov Dec 10, 2020
a6f0220
Remove the code to only build boringssl once.
jonsimantov Dec 10, 2020
7a7babf
Only build boringssl in the cmake configure step, not during the build
jonsimantov Dec 10, 2020
ce1e6ef
Cleaned up the openssl/boringssl definitions a bit.
jonsimantov Dec 10, 2020
fa15d8d
Remove extra checks on boringssl changing, which breaks non-desktop
jonsimantov Dec 10, 2020
5479fe9
Inspect all built libraries, not just firebase ones.
jonsimantov Dec 10, 2020
ddd952e
Also specify CMAKE_MSVC_RUNTIME_LIBRARY for sub-build.
jonsimantov Dec 10, 2020
050b869
Attempt to fix setting MSVC runtime for sub-build.
jonsimantov Dec 10, 2020
c365615
Also try MSVC_RUNTIME_LIBRARY
jonsimantov Dec 10, 2020
78a1d13
Cleaned up the MSVC runtime passing to subbuild.
jonsimantov Dec 10, 2020
7c291af
Fix badly-formatted comment.
jonsimantov Dec 10, 2020
aa7cb0e
Add CFLAGS back in for windows.
jonsimantov Dec 10, 2020
8158b25
Fix another cmake typo.
jonsimantov Dec 10, 2020
59232cb
Remove verbose output from github workflow.
jonsimantov Dec 10, 2020
c326461
Merge branch 'dev' into feature/js-switch-to-boringssl
jonsimantov Dec 11, 2020
787c744
Address PR comments by adding some comments and making a few minor ch…
jonsimantov Dec 11, 2020
9a6208d
Fix bad conditional.
jonsimantov Dec 11, 2020
8803578
Added a comment about tweaking the files on desktop after download.
jonsimantov Dec 11, 2020
1f8dfd3
Add FIREBASE_USE_BORINGSSL option, off by default but on for standalo…
jonsimantov Dec 11, 2020
628cb6e
Fix boringSSL path when linking SDK from source.
jonsimantov Dec 14, 2020
5ca920c
Add option to integration_tests workflow to build tests using openssl…
jonsimantov Dec 14, 2020
559ba8e
Reworded parameter.
jonsimantov Dec 14, 2020
98652b2
Move SSL parameter above optional params.
jonsimantov Dec 14, 2020
8a27f75
Rephrased comment
jonsimantov Dec 14, 2020
11a9b5c
Add SSL variant to job name.
jonsimantov Dec 14, 2020
04fb042
Remove extraneous ADDITIONAL_LIBS variable, which was used in an earl…
jonsimantov Dec 14, 2020
587d96c
Fix build integration tests on Windows.
jonsimantov Dec 14, 2020
b8a1b2b
Also ensure openssl is installed by prereqs script.
jonsimantov Dec 14, 2020
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Force boringssl for curl build.
  • Loading branch information
jonsimantov committed Dec 8, 2020
commit be3173bec64ec64801eb608cf76be6af2f0a637f
33 changes: 29 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ else()
download_external_sources()
message(STATUS "Download complete.")

set(FIRESTORE_SOURCE_DIR ${FIREBASE_BINARY_DIR}/external/src/firestore)
message(STATUS "Building external project dependencies...")
build_external_dependencies()
message(STATUS "Build of external project dependencies complete.")

set(FIRESTORE_SOURCE_DIR ${FIREBASE_BINARY_DIR}/external/src/firestore)
endif()

# Include Firestore's external build early to resolve conflicts on packages.
Expand Down Expand Up @@ -239,7 +243,7 @@ if(DESKTOP)
add_external_library(boringssl)
set(OPENSSL_FOUND TRUE)
set(OPENSSL_ROOT_DIR ${CMAKE_BINARY_DIR}/external/src/boringssl-build)
set(OPENSSL_INCLUDE_DIR ${CMAKE_BINARY_DIR}/external/src/boringssl/src/include)
set(OPENSSL_INCLUDE_DIR ${CMAKE_BINARY_DIR}/external/src/boringssl/include)
set(OPENSSL_CRYPTO_LIBRARY ${CMAKE_BINARY_DIR}/external/src/boringssl-build/crypto/libcrypto.a)
set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
set(OPENSSL_SSL_LIBRARY ${CMAKE_BINARY_DIR}/external/src/boringssl-build/ssl/libssl.a)
Expand All @@ -248,11 +252,32 @@ if(DESKTOP)
# BoringSSL is compatible with OpenSSL 1.1.0.
set(OPENSSL_VERSION '1.1.0')

add_library(OpenSSL::Crypto STATIC IMPORTED)
set_target_properties(OpenSSL::Crypto PROPERTIES
IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}"
)
add_library(OpenSSL::SSL STATIC IMPORTED)
set_target_properties(OpenSSL::SSL PROPERTIES
IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}"
)

# Now if we do find_package(OpenSSL) it should give us BoringSSL.
find_package(OpenSSL)

if(NOT ${OPENSSL_INCLUDE_DIR} MATCHES boringssl)
message(FATAL_ERROR "BoringSSL was not configured correctly.")
endif()

# Build curl as a static library
set(CURL_STATICLIB ON CACHE BOOL "")
if (WIN32)
set(CMAKE_USE_WINSSL ON CACHE BOOL "")
endif()
add_library(OpenSSL::Crypto ALIAS crypto)
add_library(OpenSSL::SSL ALIAS ssl)

add_external_library(curl)

add_external_library(libuv)
Expand Down Expand Up @@ -326,7 +351,7 @@ if(DESKTOP)
if(FIRESTORE_USE_EXTERNAL_CMAKE_BUILD)
# The Firestore build includes protobuf and nanopb already
list(APPEND CMAKE_MODULE_PATH ${NANOPB_SOURCE_DIR}/extra)
find_package(Nanopb REQUIRED)
find_package(NANOPB REQUIRED)

set(PROTOBUF_FOUND ON)
else()
Expand All @@ -338,7 +363,7 @@ if(DESKTOP)
# NanoPB has a FindNanopb which defines the function to generate files,
# so add it to the module path, and use that.
list(APPEND CMAKE_MODULE_PATH ${NANOPB_SOURCE_DIR}/extra)
find_package(Nanopb)
find_package(NANOPB)

target_compile_definitions(
protobuf-nanopb-static
Expand Down
3 changes: 2 additions & 1 deletion cmake/external/boringssl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ endif()

# Based on https://github.com/grpc/grpc/blob/v1.27.0/bazel/grpc_deps.bzl
# master-with-bazel@{2019-10-18}
set(commit 83da28a68f32023fd3b95a8ae94991a07b1f6c62)
# set(commit 83da28a68f32023fd3b95a8ae94991a07b1f6c62)
set(commit master)

ExternalProject_Add(
boringssl
Expand Down
3 changes: 2 additions & 1 deletion cmake/external/curl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ if(TARGET curl OR NOT DOWNLOAD_CURL)
endif()

#set(version 7_58_0)
set(version master)
set(version 7_73_0)
#set(version master)

ExternalProject_Add(
curl
Expand Down
35 changes: 33 additions & 2 deletions cmake/external_rules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,45 @@ function(download_external_sources)
)

# CMake's find_package(OpenSSL) doesn't quite work right with BoringSSL unless the header file contains OPENSSL_VERSION_NUMBER.
file(READ ${PROJECT_BINARY_DIR}/external/src/boringssl/src/include/openssl/opensslv.h TMP_HEADER_CONTENTS)
file(READ ${PROJECT_BINARY_DIR}/external/src/boringssl/include/openssl/opensslv.h TMP_HEADER_CONTENTS)
if (NOT TMP_HEADER_CONTENTS MATCHES OPENSSL_VERSION_NUMBER)
file(APPEND ${PROJECT_BINARY_DIR}/external/src/boringssl/src/include/openssl/opensslv.h
file(APPEND ${PROJECT_BINARY_DIR}/external/src/boringssl/include/openssl/opensslv.h
"#ifndef OPENSSL_VERSION_NUMBER\n# define OPENSSL_VERSION_NUMBER 0x10100000L\n#endif\n")
endif()

endfunction()

# Builds a subset of external dependencies that need to be built before everything else.
function(build_external_dependencies)
# Setup cmake environment.
# These commands are executed from within the currect context, which has set
# variables for the target platform. We use "env -i" to clear these
# variables, and manually keep the PATH to regular bash path.
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
# Windows doesn't have an 'env' command
set(ENV_COMMAND "")
else()
set(firebase_command_line_path "$ENV{PATH}")
set(firebase_command_line_home "$ENV{HOME}")
set(ENV_COMMAND env -i PATH=${firebase_command_line_path} HOME=${firebase_command_line_home} )
endif()

execute_process(
COMMAND ${ENV_COMMAND} cmake ../boringssl
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external/src/boringssl-build
)

# Run downloads in parallel if we know how
if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
set(cmake_build_args -j)
endif()

execute_process(
COMMAND ${ENV_COMMAND} cmake --build . -- ${cmake_build_args}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external/src/boringssl-build
)
endfunction()

# Populates directory variables for the given name to the location that name
# would be in after a call to download_external_sources, if the variable is
# not already a valid directory.
Expand Down