mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-09 22:36:01 +05:45
* Use early exit in objc_framework CMakeLists.txt * Clean up objc_framework CMakeLists.txt * Use `version` consistently * Use `firebase_ios_version` for the repo-level version * Remove INCLUDE directories that are no longer needed * Sort dependencies * Simplify Example/App/CMakeLists.txt * Add `OBJC_FLAGS` directly, avoiding a separate `sources` variable. * Add resources directly * Rename test host app to firebase_firestore_example_app * Add a firebase_ios prefix to functions and variables This reduces the chance of collision with other projects. * Simplify compiler_setup Now that compiler_setup.cmake no longer has side-effects, fold compiler_id.cmake and archive_options.cmake into it and move the include of compiler_setup up to the top of the main build. * Add support for building for iOS * Make building benchmarks optional * Disable protoc-based source generators when cross-compiling * Make downloading googletest optional * Add DISABLE_STRICT_WARNINGS mode to cc_rules This makes it possible to build non-Firestore components in the CMake build to a lower standard than that to which we hold ourselves without sacrificing the utility of the various build rules that we have.
64 lines
2.1 KiB
CMake
64 lines
2.1 KiB
CMake
# Copyright 2018 Google LLC
|
|
#
|
|
# 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.
|
|
|
|
function(download_external_sources)
|
|
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/external)
|
|
|
|
set(DOWNLOAD_BENCHMARK ${FIREBASE_IOS_BUILD_BENCHMARKS})
|
|
set(DOWNLOAD_GOOGLETEST ${FIREBASE_IOS_BUILD_TESTS})
|
|
|
|
execute_process(
|
|
COMMAND
|
|
${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
|
|
-DFIREBASE_DOWNLOAD_DIR=${FIREBASE_DOWNLOAD_DIR}
|
|
-DCMAKE_INSTALL_PREFIX=${FIREBASE_INSTALL_DIR}
|
|
-DFUZZING=${FUZZING}
|
|
-DDOWNLOAD_BENCHMARK=${DOWNLOAD_BENCHMARK}
|
|
-DDOWNLOAD_GOOGLETEST=${DOWNLOAD_GOOGLETEST}
|
|
${PROJECT_SOURCE_DIR}/cmake/external
|
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external
|
|
)
|
|
|
|
# Run downloads in parallel if we know how
|
|
if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
|
|
set(cmake_build_args -j)
|
|
endif()
|
|
|
|
execute_process(
|
|
COMMAND ${CMAKE_COMMAND} --build . -- ${cmake_build_args}
|
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external
|
|
)
|
|
endfunction()
|
|
|
|
function(add_external_subdirectory NAME)
|
|
string(TOUPPER ${NAME} UPPER_NAME)
|
|
if (NOT EXISTS ${${UPPER_NAME}_SOURCE_DIR})
|
|
set(${UPPER_NAME}_SOURCE_DIR "${FIREBASE_BINARY_DIR}/external/src/${NAME}")
|
|
set(${UPPER_NAME}_SOURCE_DIR "${${UPPER_NAME}_SOURCE_DIR}" PARENT_SCOPE)
|
|
endif()
|
|
|
|
if (NOT EXISTS ${${UPPER_NAME}_BINARY_DIR})
|
|
set(${UPPER_NAME}_BINARY_DIR "${${UPPER_NAME}_SOURCE_DIR}-build")
|
|
set(${UPPER_NAME}_BINARY_DIR "${${UPPER_NAME}_BINARY_DIR}" PARENT_SCOPE)
|
|
endif()
|
|
|
|
if (EXISTS "${${UPPER_NAME}_SOURCE_DIR}/CMakeLists.txt")
|
|
add_subdirectory(
|
|
${${UPPER_NAME}_SOURCE_DIR}
|
|
${${UPPER_NAME}_BINARY_DIR}
|
|
EXCLUDE_FROM_ALL
|
|
)
|
|
endif()
|
|
endfunction()
|