1*ec63e07aSXin Li# Copyright 2019 Google LLC 2*ec63e07aSXin Li# 3*ec63e07aSXin Li# Licensed under the Apache License, Version 2.0 (the "License"); 4*ec63e07aSXin Li# you may not use this file except in compliance with the License. 5*ec63e07aSXin Li# You may obtain a copy of the License at 6*ec63e07aSXin Li# 7*ec63e07aSXin Li# https://www.apache.org/licenses/LICENSE-2.0 8*ec63e07aSXin Li# 9*ec63e07aSXin Li# Unless required by applicable law or agreed to in writing, software 10*ec63e07aSXin Li# distributed under the License is distributed on an "AS IS" BASIS, 11*ec63e07aSXin Li# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*ec63e07aSXin Li# See the License for the specific language governing permissions and 13*ec63e07aSXin Li# limitations under the License. 14*ec63e07aSXin Li 15*ec63e07aSXin Li# If Sandboxed API is built from a plain checkout, built everything. 16*ec63e07aSXin Li# Otherwise, skip tests and examples. 17*ec63e07aSXin Liif(SAPI_PROJECT_IS_TOP_LEVEL) 18*ec63e07aSXin Li set(_sapi_enable_tests_examples_default ON) 19*ec63e07aSXin Lielse() 20*ec63e07aSXin Li set(_sapi_enable_tests_examples_default OFF) 21*ec63e07aSXin Liendif() 22*ec63e07aSXin Li 23*ec63e07aSXin Li# These options determine whether CMake should download the libraries that 24*ec63e07aSXin Li# Sandboxed API depends on at configure time. 25*ec63e07aSXin Li# The CMake script SapiDeps.cmake checks for the presence of certain build 26*ec63e07aSXin Li# targets to determine whether a library can be used. Disabling the options 27*ec63e07aSXin Li# below enables embedding projects to selectively override/replace these 28*ec63e07aSXin Li# dependencies. This is useful for cases where embedding projects already 29*ec63e07aSXin Li# depend on some of these libraries (e.g. Abseil). 30*ec63e07aSXin Lioption(SAPI_DOWNLOAD_ABSL "Download Abseil at config time" ON) 31*ec63e07aSXin Lioption(SAPI_DOWNLOAD_GOOGLETEST "Download googletest at config time" ON) 32*ec63e07aSXin Lioption(SAPI_DOWNLOAD_BENCHMARK "Download benchmark at config time" ON) 33*ec63e07aSXin Lioption(SAPI_DOWNLOAD_PROTOBUF "Download protobuf at config time" ON) 34*ec63e07aSXin Lioption(SAPI_DOWNLOAD_LIBUNWIND "Download libunwind at config time" ON) 35*ec63e07aSXin Lioption(SAPI_DOWNLOAD_LIBCAP "Download libcap at config time" ON) 36*ec63e07aSXin Lioption(SAPI_DOWNLOAD_LIBFFI "Download libffi at config time" ON) 37*ec63e07aSXin Li 38*ec63e07aSXin Li# Options for building examples 39*ec63e07aSXin Lioption(SAPI_BUILD_EXAMPLES 40*ec63e07aSXin Li "If ON, build example code" ${_sapi_enable_tests_examples_default} 41*ec63e07aSXin Li) 42*ec63e07aSXin Lioption(SAPI_DOWNLOAD_ZLIB 43*ec63e07aSXin Li "Download zlib at config time (only if SAPI_BUILD_EXAMPLES is set)" 44*ec63e07aSXin Li ${_sapi_enable_tests_examples_default} 45*ec63e07aSXin Li) 46*ec63e07aSXin Li 47*ec63e07aSXin Lioption(SAPI_BUILD_TESTING 48*ec63e07aSXin Li "If ON, this will build all of Sandboxed API's own tests" 49*ec63e07aSXin Li ${_sapi_enable_tests_examples_default} 50*ec63e07aSXin Li) 51*ec63e07aSXin Li# Disabled by default, as this will download a lot of extra content. 52*ec63e07aSXin Lioption(SAPI_CONTRIB_BUILD_TESTING "Build tests for sandboxes in 'contrib'" OFF) 53*ec63e07aSXin Li 54*ec63e07aSXin Lioption(SAPI_ENABLE_CLANG_TOOL 55*ec63e07aSXin Li "Use the new Clang tool based header generator" OFF 56*ec63e07aSXin Li) 57*ec63e07aSXin Lioption(SAPI_ENABLE_CLANG_TOOL_STATIC 58*ec63e07aSXin Li "Link the Clang libraries statically into the tool" OFF 59*ec63e07aSXin Li) 60*ec63e07aSXin Li 61*ec63e07aSXin Li# This flag should be only enabled for embedded and resource-constrained 62*ec63e07aSXin Li# environments. 63*ec63e07aSXin Lioption(SAPI_ENABLE_SHARED_LIBS "Build SAPI shared libs" OFF) 64*ec63e07aSXin Li 65*ec63e07aSXin Lioption(SAPI_HARDENED_SOURCE "Build with hardening compiler options" OFF) 66*ec63e07aSXin Li 67*ec63e07aSXin Lioption(SAPI_FORCE_COLOR_OUTPUT 68*ec63e07aSXin Li "Force colored compiler diagnostics when using Ninja" ON 69*ec63e07aSXin Li) 70