mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-11 22:55:59 +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.
53 lines
2.2 KiB
CMake
53 lines
2.2 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.
|
|
|
|
# Add fuzz testing options to the current build.
|
|
|
|
option(FUZZING "Build for Fuzz Testing (local fuzzing and OSS Fuzz)" OFF)
|
|
|
|
# Assume OSS Fuzz if LIB_FUZZING_ENGINE environment variable is set. OSS Fuzz
|
|
# provides its required compiler-specific flags in CXXFLAGS, which are
|
|
# automatically added to CMAKE_CXX_FLAGS. For local fuzzing, multiple compile
|
|
# and linking flags must be set. These flags depend on the compiler version.
|
|
if(FUZZING AND NOT DEFINED ENV{LIB_FUZZING_ENGINE})
|
|
if(WIN32)
|
|
# Currently, libFuzzer cannot be built on Windows.
|
|
message(FATAL_ERROR "Fuzzing is currently not supported on Windows.")
|
|
endif()
|
|
|
|
# Address sanitizer must be enabled during fuzzing to detect memory errors.
|
|
if(NOT WITH_ASAN)
|
|
message(FATAL_ERROR "Fuzzing requires WITH_ASAN=ON to detect memory errors.")
|
|
endif()
|
|
|
|
# Set the flag to enable code coverage instrumentation. Fuzzing engines use
|
|
# code coverage as a metric to guide the fuzzing. We use the basic code
|
|
# coverage level (trace-pc). This flag has different values in Clang and GNU.
|
|
# Other values, such as trace-cmp, can be used to trace data flow. See the
|
|
# official documentation for the compiler flags.
|
|
if(CXX_CLANG)
|
|
# TODO(minafarid): Check the version of Clang. Clang versions >= 5.0 should
|
|
# have libFuzzer by default.
|
|
set(fuzzing_flags -fsanitize-coverage=trace-pc-guard)
|
|
elseif(CXX_GNU)
|
|
set(fuzzing_flags -fsanitize-coverage=trace-pc)
|
|
else()
|
|
message(FATAL_ERROR "Only Clang and GCC support fuzzing.")
|
|
endif()
|
|
|
|
foreach(flag ${fuzzing_flags})
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
|
endforeach()
|
|
endif()
|