Skip to content

Commit 4b76d92

Browse files
authored
Remove protobuf and nanopb setup (#968)
* Remove protobuf and nanopb setup * Remove random extra letter in README
1 parent 2f6ba46 commit 4b76d92

File tree

8 files changed

+22
-124
lines changed

8 files changed

+22
-124
lines changed

CMakeLists.txt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -472,32 +472,6 @@ if(DESKTOP)
472472
endif()
473473
endif()
474474

475-
if(DESKTOP)
476-
if(FIRESTORE_USE_EXTERNAL_CMAKE_BUILD)
477-
# The Firestore build includes protobuf and nanopb already
478-
list(APPEND CMAKE_MODULE_PATH ${NANOPB_SOURCE_DIR}/extra)
479-
find_package(Nanopb)
480-
481-
set(PROTOBUF_FOUND ON)
482-
else()
483-
find_package(Protobuf)
484-
if (PROTOBUF_FOUND)
485-
# NanoPB requires Protobuf to be present, so only add it if it was found.
486-
add_external_library(nanopb)
487-
488-
# NanoPB has a FindNanopb which defines the function to generate files,
489-
# so add it to the module path, and use that.
490-
list(APPEND CMAKE_MODULE_PATH ${NANOPB_SOURCE_DIR}/extra)
491-
find_package(Nanopb)
492-
493-
target_compile_definitions(
494-
protobuf-nanopb-static
495-
PUBLIC -DPB_FIELD_32BIT -DPB_ENABLE_MALLOC
496-
)
497-
endif()
498-
endif()
499-
endif()
500-
501475
if(DESKTOP AND NOT CMAKE_CROSSCOMPILING)
502476
# Desktop platforms do not need to declare this dependency, as they will build
503477
# flatc correctly when needed.

README.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,44 +60,25 @@ required packages:
6060

6161
* python -m ensurepip --default-pip
6262
* python -m pip install --user absl-py
63-
* python -m pip install --user protobuf
6463

6564
### Prerequisites for Desktop
6665
The following prerequisites are required when building the libraries for
6766
desktop platforms.
6867

6968
- [OpenSSL](https://www.openssl.org/), needed for Realtime Database and Cloud Firestore
70-
- [Protobuf](https://github.com/protocolbuffers/protobuf/blob/master/src/README.md),
71-
needed for Remote Config
7269

7370
### Prerequisites for Windows
7471
Prebuilt packages for openssl can be found using google and if CMake fails to
7572
find the install path use the command line option
7673
**-DOPENSSL_ROOT_DIR=[Open SSL Dir]**.
7774

78-
Since there are no prebuilt packages for protobuf, getting it working on Windows
79-
is a little tricky. The following steps can be used as a guide:
80-
81-
* Download source [zip from github](https://github.com/protocolbuffers/protobuf/releases/download/v3.9.2/protobuf-all-3.9.2.zip).
82-
* Extract source and open command prompt to root folder
83-
* Make new folder **vsprojects**
84-
* CD to **vsprojects**
85-
* run cmake: **cmake ..\cmake -Dprotobuf_BUILD_TESTS=OFF -A Win32**
86-
* Build solution
87-
* Add command line define to firebase cmake command (see below)
88-
**-DPROTOBUF_SRC_ROOT_FOLDER=[Source Root Folder]**
89-
90-
Note: For x64 builds folder needs to be **vsprojects\x64** and change **Win32**
91-
in cmake command to **x64**
92-
9375
### Prerequisites for Mac
9476
Home brew can be used to install required dependencies:
9577

9678
```bash
97-
# https://github.com/protocolbuffers/protobuf/blob/master/kokoro/macos/prepare_build_macos_rc#L20
9879
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
9980
source $HOME/.rvm/scripts/rvm
100-
brew install cmake protobuf python3
81+
brew install cmake python3
10182
sudo chown -R $(whoami) /usr/local
10283
```
10384

build_scripts/android/install_prereqs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if [[ -z $(which python) ]]; then
4141
exit 1
4242
else
4343
updated_pip=0
44-
if ! $(echo "import absl"$'\n'"import google.protobuf" | python - 2> /dev/null); then
44+
if ! $(echo "import absl"$'\n' | python - 2> /dev/null); then
4545
echo "Installing python packages."
4646
set -x
4747
# On Windows bash shell, sudo doesn't exist
@@ -50,7 +50,7 @@ else
5050
else
5151
python -m pip install --upgrade pip
5252
fi
53-
pip install absl-py protobuf
53+
pip install absl-py
5454
set +x
5555
fi
5656
fi

build_scripts/tvos/install_prereqs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ if [[ -z $(which python) ]]; then
1717
exit 1
1818
else
1919
updated_pip=0
20-
if ! $(echo "import absl"$'\n'"import google.protobuf" | python - 2> /dev/null); then
20+
if ! $(echo "import absl"$'\n' | python - 2> /dev/null); then
2121
echo "Installing python packages."
2222
set -x
2323
sudo python -m pip install --upgrade pip
24-
pip install absl-py protobuf
24+
pip install absl-py
2525
set +x
2626
fi
2727
fi

cmake/external/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ if (${FIREBASE_EXTERNAL_PLATFORM} STREQUAL "DESKTOP")
3232
include(curl)
3333
include(libuv)
3434
include(leveldb)
35-
include(nanopb)
3635
include(uWebSockets)
3736
include(zlib)
3837
endif()

cmake/external/nanopb.cmake

Lines changed: 0 additions & 37 deletions
This file was deleted.

cmake/external_rules.cmake

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

40-
# When building with Firestore, use the NanoPB source from that instead.
41-
if(FIREBASE_INCLUDE_FIRESTORE)
42-
set(FIRESTORE_BINARY_DIR ${PROJECT_BINARY_DIR}/external/src/firestore-build)
43-
set(NANOPB_SOURCE_DIR ${FIRESTORE_BINARY_DIR}/external/src/nanopb)
44-
endif()
45-
4640
# Set variables to indicate if local versions of third party libraries should
4741
# be used instead of downloading them.
4842
function(check_use_local_directory NAME)
@@ -56,7 +50,6 @@ function(download_external_sources)
5650
check_use_local_directory(CURL)
5751
check_use_local_directory(FLATBUFFERS)
5852
check_use_local_directory(LIBUV)
59-
check_use_local_directory(NANOPB)
6053
check_use_local_directory(UWEBSOCKETS)
6154
check_use_local_directory(ZLIB)
6255
check_use_local_directory(FIREBASE_IOS_SDK)
@@ -91,7 +84,6 @@ function(download_external_sources)
9184
-DDOWNLOAD_FLATBUFFERS=${DOWNLOAD_FLATBUFFERS}
9285
-DDOWNLOAD_GOOGLETEST=${FIREBASE_DOWNLOAD_GTEST}
9386
-DDOWNLOAD_LIBUV=${DOWNLOAD_LIBUV}
94-
-DDOWNLOAD_NANOPB=${DOWNLOAD_NANOPB}
9587
-DDOWNLOAD_UWEBSOCKETS=${DOWNLOAD_UWEBSOCKETS}
9688
-DDOWNLOAD_ZLIB=${DOWNLOAD_ZLIB}
9789
-DDOWNLOAD_FIREBASE_IOS_SDK=${DOWNLOAD_FIREBASE_IOS_SDK}

remote_config/CMakeLists.txt

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,34 +55,23 @@ set(android_SRCS
5555
set(ios_SRCS
5656
src/ios/remote_config_ios.mm)
5757

58-
if (NOT PROTOBUF_FOUND)
59-
# Only log a message if building for Desktop, since mobile doesn't care.
60-
if (NOT ANDROID AND NOT IOS)
61-
message(FATAL_ERROR "Unable to find Protobuf, which is needed for Remote \
62-
Configs's desktop implementation. Install Protobuf and add it to \
63-
your PATH, or set the CMake option FIREBASE_INCLUDE_REMOTE_CONFIG \
64-
to OFF to disable the firebase_remote_config build target.")
65-
endif()
66-
else()
67-
set(desktop_SRCS
68-
${PROTO_SRCS}
69-
${PROTO_HDRS}
70-
${request_resource_source}
71-
${request_resource_header}
72-
${response_resource_source}
73-
${response_resource_header}
74-
${FIREBASE_GEN_FILE_DIR}/remote_config/request_generated.h
75-
${FIREBASE_GEN_FILE_DIR}/remote_config/response_generated.h
76-
src/desktop/rest.cc
77-
src/desktop/config_data.cc
78-
src/desktop/file_manager.cc
79-
src/desktop/metadata.cc
80-
src/desktop/notification_channel.cc
81-
src/desktop/remote_config_desktop.cc
82-
src/desktop/remote_config_request.cc
83-
src/desktop/remote_config_response.cc
84-
)
85-
endif()
58+
# Source files used by the desktop implementation.
59+
set(desktop_SRCS
60+
${request_resource_source}
61+
${request_resource_header}
62+
${response_resource_source}
63+
${response_resource_header}
64+
${FIREBASE_GEN_FILE_DIR}/remote_config/request_generated.h
65+
${FIREBASE_GEN_FILE_DIR}/remote_config/response_generated.h
66+
src/desktop/rest.cc
67+
src/desktop/config_data.cc
68+
src/desktop/file_manager.cc
69+
src/desktop/metadata.cc
70+
src/desktop/notification_channel.cc
71+
src/desktop/remote_config_desktop.cc
72+
src/desktop/remote_config_request.cc
73+
src/desktop/remote_config_response.cc
74+
)
8675

8776
if(ANDROID)
8877
set(remote_config_platform_SRCS

0 commit comments

Comments
 (0)