Skip to content

(Desktop) Firestore C++ Core from TIP by default #855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 46 additions & 12 deletions cmake/external/firestore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,52 @@ if(TARGET firestore)
return()
endif()

set(version CocoaPods-8.12.1)
ExternalProject_Add(
firestore
function(GetReleasedDep version)
message("Getting released firebase-ios-sdk @ ${version}")
ExternalProject_Add(
firestore

DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
URL https://github.com/firebase/firebase-ios-sdk/archive/${version}.tar.gz
DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
URL https://github.com/firebase/firebase-ios-sdk/archive/${version}.tar.gz

PREFIX ${PROJECT_BINARY_DIR}
PREFIX ${PROJECT_BINARY_DIR}

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
HTTP_HEADER "${EXTERNAL_PROJECT_HTTP_HEADER}"
)
endfunction()

function(GetTag t)
message("Getting firebase-ios-sdk from ${t}")
ExternalProject_Add(
firestore

DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
GIT_REPOSITORY "https://github.com/firebase/firebase-ios-sdk.git"
GIT_TAG ${t}
GIT_SHALLOW "ON"

PREFIX ${PROJECT_BINARY_DIR}

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
HTTP_HEADER "${EXTERNAL_PROJECT_HTTP_HEADER}"
)
endfunction()

if((NOT FIRESTORE_DEP_SOURCE) OR (FIRESTORE_DEP_SOURCE STREQUAL "RELEASED"))
# Get from released dependency by default
GetReleasedDep("CocoaPods-8.12.1")
else()
if(FIRESTORE_DEP_SOURCE STREQUAL "TIP")
GetTag("origin/master")
else()
GetTag(${FIRESTORE_DEP_SOURCE})
endif()
endif()

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
HTTP_HEADER "${EXTERNAL_PROJECT_HTTP_HEADER}"
)
1 change: 1 addition & 0 deletions cmake/external_rules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function(download_external_sources)
-DEXTERNAL_PROJECT_HTTP_HEADER=${EXTERNAL_PROJECT_HTTP_HEADER}
-DFIREBASE_CPP_BUILD_TESTS=${FIREBASE_CPP_BUILD_TESTS}
-DFIREBASE_CPP_BUILD_STUB_TESTS=${FIREBASE_CPP_BUILD_STUB_TESTS}
-DFIRESTORE_DEP_SOURCE=${FIRESTORE_DEP_SOURCE}
${PROJECT_SOURCE_DIR}/cmake/external
OUTPUT_FILE ${PROJECT_BINARY_DIR}/external/output_cmake_config.txt
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external
Expand Down
10 changes: 8 additions & 2 deletions scripts/gha/build_desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, cleanup=True

def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='legacy',
build_tests=True, config=None, target_format=None,
use_openssl=False, disable_vcpkg=False, gha_build=False, verbose=False):
use_openssl=False, disable_vcpkg=False, firestore_dep_source=None,
gha_build=False, verbose=False):
""" CMake configure.

If you are seeing problems when running this multiple times,
Expand All @@ -193,6 +194,7 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
use_openssl (bool) : Use prebuilt OpenSSL library instead of using boringssl
downloaded and built during the cmake configure step.
disable_vcpkg (bool): If True, skip vcpkg and just use CMake for deps.
firestore_dep_source (str): Where to get Firestore C++ Core source code.
gha_build (bool): If True, this build will be marked as having been built
from GitHub, which is useful for metrics tracking.
verbose (bool): If True, enable verbose mode in the CMake file.
Expand Down Expand Up @@ -252,6 +254,9 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
if not use_openssl:
cmd.append('-DFIREBASE_USE_BORINGSSL=ON')

if firestore_dep_source:
cmd.append('-DFIRESTORE_DEP_SOURCE={0}'.format(firestore_dep_source))

# When building from GitHub Actions, this should always be set.
if gha_build:
cmd.append('-DFIREBASE_GITHUB_ACTION_BUILD=ON')
Expand Down Expand Up @@ -288,7 +293,7 @@ def main():
# CMake configure
cmake_configure(args.build_dir, args.arch, args.msvc_runtime_library, args.linux_abi,
args.build_tests, args.config, args.target_format,
args.use_openssl, args.disable_vcpkg, args.gha_build, args.verbose)
args.use_openssl, args.disable_vcpkg, args.firestore_dep_source, args.gha_build, args.verbose)

# CMake build
# cmake --build build -j 8
Expand Down Expand Up @@ -318,6 +323,7 @@ def parse_cmdline_args():
parser.add_argument('--target', nargs='+', help='A list of CMake build targets (eg: firebase_app firebase_auth)')
parser.add_argument('--target_format', default=None, help='(Mac only) whether to output frameworks (default) or libraries.')
parser.add_argument('--use_openssl', action='store_true', default=None, help='Use openssl for build instead of boringssl')
parser.add_argument('--firestore_dep_source', default='RELEASED', help='Where to get Firestore C++ Core source code. "RELEASED"/"TIP"/(Git tag/branch/commit)')
parser.add_argument('--gha_build', action='store_true', default=None, help='Set to true when building on GitHub, for metric tracking purposes (also changes some prerequisite installation behavior).')
args = parser.parse_args()
return args
Expand Down