Skip to content

Commit 396d8b4

Browse files
wilhuffa-maurice
authored andcommitted
Add an external download for Firestore
PiperOrigin-RevId: 297709959
1 parent 2ec1e5c commit 396d8b4

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

cmake/external/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Google
1+
# Copyright 2018 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ project(Firebase-cpp-download C CXX)
2323
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
2424

2525
include(flatbuffers)
26+
include(firestore)
2627

2728

2829
# Some of the external dependencies are not needed for mobile.

cmake/external/firestore.cmake

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
include(ExternalProject)
16+
17+
if(TARGET firestore)
18+
return()
19+
endif()
20+
21+
# Pin to the first revision that including
22+
# https://github.com/firebase/firebase-ios-sdk/pull/4984, that contains all the
23+
# fixes required to operate as an external build from within this repo.
24+
set(version d4e86ba091b0aeccfcdcf9d344338564f45c21c1)
25+
26+
ExternalProject_Add(
27+
firestore
28+
29+
DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
30+
DOWNLOAD_NAME firestore-${version}.tar.gz
31+
URL https://github.com/firebase/firebase-ios-sdk/archive/${version}.tar.gz
32+
33+
PREFIX ${PROJECT_BINARY_DIR}
34+
35+
CONFIGURE_COMMAND ""
36+
BUILD_COMMAND ""
37+
INSTALL_COMMAND ""
38+
TEST_COMMAND ""
39+
)

cmake/external_rules.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,23 @@ function(download_external_sources)
3737
set(external_platform DESKTOP)
3838
endif()
3939

40+
# Prepare the Firestore CMake build as well.
41+
if(FIREBASE_INCLUDE_FIRESTORE)
42+
set(FIRESTORE_BINARY_DIR ${PROJECT_BINARY_DIR}/external/src/firestore-build)
43+
44+
execute_process(
45+
COMMAND
46+
${ENV_COMMAND} cmake
47+
-DFIREBASE_DOWNLOAD_DIR=${FIREBASE_DOWNLOAD_DIR}
48+
-DCMAKE_INSTALL_PREFIX=${FIREBASE_INSTALL_DIR}
49+
${PROJECT_BINARY_DIR}/external/src/firestore
50+
51+
WORKING_DIRECTORY ${FIRESTORE_BINARY_DIR}
52+
)
53+
54+
set(NANOPB_SRC_DIR ${FIRESTORE_BINARY_DIR}/external/src/nanopb)
55+
endif()
56+
4057
# Set variables to indicate if local versions of third party libraries should
4158
# be used instead of downloading them.
4259
function(check_use_local_directory NAME)

0 commit comments

Comments
 (0)