2020-01-17 21:05:03 +08:00
|
|
|
# Copyright 2019 Google LLC
|
2019-07-15 19:42:39 +08:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
2022-01-28 17:38:27 +08:00
|
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
2019-07-15 19:42:39 +08:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2022-01-18 19:22:35 +08:00
|
|
|
# If Sandboxed API is built from a plain checkout, built everything.
|
|
|
|
# Otherwise, skip tests and examples.
|
|
|
|
if(SAPI_PROJECT_IS_TOP_LEVEL)
|
|
|
|
set(_sapi_enable_tests_examples_default ON)
|
|
|
|
else()
|
|
|
|
set(_sapi_enable_tests_examples_default OFF)
|
|
|
|
endif()
|
|
|
|
|
2019-07-26 20:50:45 +08:00
|
|
|
# These options determine whether CMake should download the libraries that
|
|
|
|
# Sandboxed API depends on at configure time.
|
|
|
|
# The CMake script SapiDeps.cmake checks for the presence of certain build
|
|
|
|
# targets to determine whether a library can be used. Disabling the options
|
|
|
|
# below enables embedding projects to selectively override/replace these
|
|
|
|
# dependencies. This is useful for cases where embedding projects already
|
|
|
|
# depend on some of these libraries (e.g. Abseil).
|
2019-11-21 21:16:59 +08:00
|
|
|
option(SAPI_DOWNLOAD_ABSL "Download Abseil at config time" ON)
|
|
|
|
option(SAPI_DOWNLOAD_GOOGLETEST "Download googletest at config time" ON)
|
|
|
|
option(SAPI_DOWNLOAD_BENCHMARK "Download benchmark at config time" ON)
|
|
|
|
option(SAPI_DOWNLOAD_GFLAGS "Download gflags at config time" ON)
|
|
|
|
option(SAPI_DOWNLOAD_GLOG "Download glog at config time" ON)
|
|
|
|
option(SAPI_DOWNLOAD_PROTOBUF "Download protobuf at config time" ON)
|
|
|
|
option(SAPI_DOWNLOAD_LIBUNWIND "Download libunwind at config time" ON)
|
|
|
|
option(SAPI_DOWNLOAD_LIBCAP "Download libcap at config time" ON)
|
|
|
|
option(SAPI_DOWNLOAD_LIBFFI "Download libffi at config time" ON)
|
2019-07-26 20:50:45 +08:00
|
|
|
|
2020-04-30 19:57:09 +08:00
|
|
|
# Options for building examples
|
2022-04-21 16:17:08 +08:00
|
|
|
option(SAPI_BUILD_EXAMPLES
|
|
|
|
"If ON, build example code" ${_sapi_enable_tests_examples_default}
|
2022-01-18 19:22:35 +08:00
|
|
|
)
|
|
|
|
option(SAPI_DOWNLOAD_ZLIB
|
2022-04-21 16:17:08 +08:00
|
|
|
"Download zlib at config time (only if SAPI_BUILD_EXAMPLES is set)"
|
2022-01-18 19:22:35 +08:00
|
|
|
${_sapi_enable_tests_examples_default}
|
|
|
|
)
|
2020-04-30 19:57:09 +08:00
|
|
|
|
2022-04-21 16:17:08 +08:00
|
|
|
option(SAPI_BUILD_TESTING
|
|
|
|
"If ON, this will build all of Sandboxed API's own tests"
|
|
|
|
${_sapi_enable_tests_examples_default}
|
2022-01-18 19:22:35 +08:00
|
|
|
)
|
2022-02-02 23:01:48 +08:00
|
|
|
# Disabled by default, as this will download a lot of extra content.
|
2022-04-21 16:17:08 +08:00
|
|
|
option(SAPI_CONTRIB_BUILD_TESTING "Build tests for sandboxes in 'contrib'" OFF)
|
2022-02-02 23:01:48 +08:00
|
|
|
|
2022-01-18 19:22:35 +08:00
|
|
|
option(SAPI_ENABLE_GENERATOR
|
|
|
|
"Build Clang based code generator from source" OFF
|
|
|
|
)
|
2019-06-25 20:48:56 +08:00
|
|
|
|
2020-12-15 01:15:40 +08:00
|
|
|
# This flag should be only enabled for embedded and resource-constrained
|
2022-01-18 19:22:35 +08:00
|
|
|
# environments.
|
2020-12-15 01:15:40 +08:00
|
|
|
option(SAPI_ENABLE_SHARED_LIBS "Build SAPI shared libs" OFF)
|
|
|
|
|
2020-12-12 06:58:01 +08:00
|
|
|
option(SAPI_HARDENED_SOURCE "Build with hardening compiler options" OFF)
|
|
|
|
|
2022-01-18 19:22:35 +08:00
|
|
|
option(SAPI_FORCE_COLOR_OUTPUT
|
|
|
|
"Force colored compiler diagnostics when using Ninja" ON
|
|
|
|
)
|