diff --git a/CMakeLists.txt b/CMakeLists.txt index 83b2a3fde5..cafac6bba9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -472,32 +472,6 @@ if(DESKTOP) endif() endif() -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) - - set(PROTOBUF_FOUND ON) - else() - find_package(Protobuf) - if (PROTOBUF_FOUND) - # NanoPB requires Protobuf to be present, so only add it if it was found. - add_external_library(nanopb) - - # 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) - - target_compile_definitions( - protobuf-nanopb-static - PUBLIC -DPB_FIELD_32BIT -DPB_ENABLE_MALLOC - ) - endif() - endif() -endif() - if(DESKTOP AND NOT CMAKE_CROSSCOMPILING) # Desktop platforms do not need to declare this dependency, as they will build # flatc correctly when needed. diff --git a/README.md b/README.md index d9efcfe5a5..35e70fda88 100644 --- a/README.md +++ b/README.md @@ -60,44 +60,25 @@ required packages: * python -m ensurepip --default-pip * python -m pip install --user absl-py -* python -m pip install --user protobuf ### Prerequisites for Desktop The following prerequisites are required when building the libraries for desktop platforms. - [OpenSSL](https://www.openssl.org/), needed for Realtime Database and Cloud Firestore -- [Protobuf](https://github.com/protocolbuffers/protobuf/blob/master/src/README.md), - needed for Remote Config ### Prerequisites for Windows Prebuilt packages for openssl can be found using google and if CMake fails to find the install path use the command line option **-DOPENSSL_ROOT_DIR=[Open SSL Dir]**. -Since there are no prebuilt packages for protobuf, getting it working on Windows -is a little tricky. The following steps can be used as a guide: - -* Download source [zip from github](https://github.com/protocolbuffers/protobuf/releases/download/v3.9.2/protobuf-all-3.9.2.zip). -* Extract source and open command prompt to root folder -* Make new folder **vsprojects** -* CD to **vsprojects** -* run cmake: **cmake ..\cmake -Dprotobuf_BUILD_TESTS=OFF -A Win32** -* Build solution -* Add command line define to firebase cmake command (see below) - **-DPROTOBUF_SRC_ROOT_FOLDER=[Source Root Folder]** - -Note: For x64 builds folder needs to be **vsprojects\x64** and change **Win32** -in cmake command to **x64** - ### Prerequisites for Mac Home brew can be used to install required dependencies: ```bash -# https://github.com/protocolbuffers/protobuf/blob/master/kokoro/macos/prepare_build_macos_rc#L20 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" source $HOME/.rvm/scripts/rvm -brew install cmake protobuf python3 +brew install cmake python3 sudo chown -R $(whoami) /usr/local ``` diff --git a/build_scripts/android/install_prereqs.sh b/build_scripts/android/install_prereqs.sh index 6bb0f19d7e..c189ef4218 100755 --- a/build_scripts/android/install_prereqs.sh +++ b/build_scripts/android/install_prereqs.sh @@ -41,7 +41,7 @@ if [[ -z $(which python) ]]; then exit 1 else updated_pip=0 - if ! $(echo "import absl"$'\n'"import google.protobuf" | python - 2> /dev/null); then + if ! $(echo "import absl"$'\n' | python - 2> /dev/null); then echo "Installing python packages." set -x # On Windows bash shell, sudo doesn't exist @@ -50,7 +50,7 @@ else else python -m pip install --upgrade pip fi - pip install absl-py protobuf + pip install absl-py set +x fi fi diff --git a/build_scripts/tvos/install_prereqs.sh b/build_scripts/tvos/install_prereqs.sh index 8f36bf01ba..e2a87d8e44 100755 --- a/build_scripts/tvos/install_prereqs.sh +++ b/build_scripts/tvos/install_prereqs.sh @@ -17,11 +17,11 @@ if [[ -z $(which python) ]]; then exit 1 else updated_pip=0 - if ! $(echo "import absl"$'\n'"import google.protobuf" | python - 2> /dev/null); then + if ! $(echo "import absl"$'\n' | python - 2> /dev/null); then echo "Installing python packages." set -x sudo python -m pip install --upgrade pip - pip install absl-py protobuf + pip install absl-py set +x fi fi diff --git a/cmake/external/CMakeLists.txt b/cmake/external/CMakeLists.txt index 2af4b10b82..c2377e8485 100644 --- a/cmake/external/CMakeLists.txt +++ b/cmake/external/CMakeLists.txt @@ -32,7 +32,6 @@ if (${FIREBASE_EXTERNAL_PLATFORM} STREQUAL "DESKTOP") include(curl) include(libuv) include(leveldb) - include(nanopb) include(uWebSockets) include(zlib) endif() diff --git a/cmake/external/nanopb.cmake b/cmake/external/nanopb.cmake deleted file mode 100644 index 8b9609e06f..0000000000 --- a/cmake/external/nanopb.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2019 Google -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -include(ExternalProject) - -if(TARGET nanopb OR NOT DOWNLOAD_NANOPB) - return() -endif() - -set(version 0.3.9.8) - -ExternalProject_Add( - nanopb - - DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR} - URL https://github.com/nanopb/nanopb/archive/nanopb-${version}.tar.gz - URL_HASH SHA256=2047ff111ca408c9b3c06a6774b723c1b1c9e31dc2320c61ee3abce93359eb30 - - PREFIX ${PROJECT_BINARY_DIR} - - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - HTTP_HEADER "${EXTERNAL_PROJECT_HTTP_HEADER}" -) \ No newline at end of file diff --git a/cmake/external_rules.cmake b/cmake/external_rules.cmake index 69337a5356..4bb6d4bbd6 100644 --- a/cmake/external_rules.cmake +++ b/cmake/external_rules.cmake @@ -37,12 +37,6 @@ function(download_external_sources) set(external_platform "DESKTOP") endif() - # When building with Firestore, use the NanoPB source from that instead. - if(FIREBASE_INCLUDE_FIRESTORE) - set(FIRESTORE_BINARY_DIR ${PROJECT_BINARY_DIR}/external/src/firestore-build) - set(NANOPB_SOURCE_DIR ${FIRESTORE_BINARY_DIR}/external/src/nanopb) - endif() - # Set variables to indicate if local versions of third party libraries should # be used instead of downloading them. function(check_use_local_directory NAME) @@ -56,7 +50,6 @@ function(download_external_sources) check_use_local_directory(CURL) check_use_local_directory(FLATBUFFERS) check_use_local_directory(LIBUV) - check_use_local_directory(NANOPB) check_use_local_directory(UWEBSOCKETS) check_use_local_directory(ZLIB) check_use_local_directory(FIREBASE_IOS_SDK) @@ -91,7 +84,6 @@ function(download_external_sources) -DDOWNLOAD_FLATBUFFERS=${DOWNLOAD_FLATBUFFERS} -DDOWNLOAD_GOOGLETEST=${FIREBASE_DOWNLOAD_GTEST} -DDOWNLOAD_LIBUV=${DOWNLOAD_LIBUV} - -DDOWNLOAD_NANOPB=${DOWNLOAD_NANOPB} -DDOWNLOAD_UWEBSOCKETS=${DOWNLOAD_UWEBSOCKETS} -DDOWNLOAD_ZLIB=${DOWNLOAD_ZLIB} -DDOWNLOAD_FIREBASE_IOS_SDK=${DOWNLOAD_FIREBASE_IOS_SDK} diff --git a/remote_config/CMakeLists.txt b/remote_config/CMakeLists.txt index 96e58688e8..17a26282ca 100644 --- a/remote_config/CMakeLists.txt +++ b/remote_config/CMakeLists.txt @@ -55,34 +55,23 @@ set(android_SRCS set(ios_SRCS src/ios/remote_config_ios.mm) -if (NOT PROTOBUF_FOUND) - # Only log a message if building for Desktop, since mobile doesn't care. - if (NOT ANDROID AND NOT IOS) - message(FATAL_ERROR "Unable to find Protobuf, which is needed for Remote \ - Configs's desktop implementation. Install Protobuf and add it to \ - your PATH, or set the CMake option FIREBASE_INCLUDE_REMOTE_CONFIG \ - to OFF to disable the firebase_remote_config build target.") - endif() -else() - set(desktop_SRCS - ${PROTO_SRCS} - ${PROTO_HDRS} - ${request_resource_source} - ${request_resource_header} - ${response_resource_source} - ${response_resource_header} - ${FIREBASE_GEN_FILE_DIR}/remote_config/request_generated.h - ${FIREBASE_GEN_FILE_DIR}/remote_config/response_generated.h - src/desktop/rest.cc - src/desktop/config_data.cc - src/desktop/file_manager.cc - src/desktop/metadata.cc - src/desktop/notification_channel.cc - src/desktop/remote_config_desktop.cc - src/desktop/remote_config_request.cc - src/desktop/remote_config_response.cc - ) -endif() +# Source files used by the desktop implementation. +set(desktop_SRCS + ${request_resource_source} + ${request_resource_header} + ${response_resource_source} + ${response_resource_header} + ${FIREBASE_GEN_FILE_DIR}/remote_config/request_generated.h + ${FIREBASE_GEN_FILE_DIR}/remote_config/response_generated.h + src/desktop/rest.cc + src/desktop/config_data.cc + src/desktop/file_manager.cc + src/desktop/metadata.cc + src/desktop/notification_channel.cc + src/desktop/remote_config_desktop.cc + src/desktop/remote_config_request.cc + src/desktop/remote_config_response.cc +) if(ANDROID) set(remote_config_platform_SRCS