| # Copyright 2022 Comcast Cable Communications Management, 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. |
| # |
| # SPDX-License-Identifier: Apache-2.0 |
| # |
| # Copyright 2021 The Cobalt Authors. All Rights Reserved. |
| # |
| # 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. |
| |
| config("platform_configuration") { |
| configs = [ |
| "//starboard/build/config/sabi", |
| ] |
| cflags = [] |
| ldflags = [] |
| defines = [] |
| cflags_cc = [] |
| |
| if (current_toolchain == host_toolchain) { |
| cflags += [ |
| "-O2", |
| "-Wno-unused-parameter", |
| ] |
| } else { |
| configs += [ |
| "//build/config/compiler:rtti", |
| ] |
| |
| libs = [ |
| "pthread", |
| ] |
| |
| cflags += [ |
| "-fvisibility=hidden", |
| "-fsigned-char", |
| "-fno-strict-aliasing", |
| "-fno-delete-null-pointer-checks", |
| ] |
| |
| cflags_cc += [ |
| "-std=gnu++14", |
| "-Wno-literal-suffix", |
| # Generated by Audio Renderer and Audio Sink implementations. |
| "-Wno-reorder", |
| ] |
| |
| if (is_qa || is_gold) { |
| cflags += [ |
| "-g1", |
| ] |
| } else { |
| cflags += [ |
| "-g", |
| ] |
| } |
| |
| if (use_asan) { |
| cflags += [ |
| "-fsanitize=address", |
| "-fno-omit-frame-pointer", |
| ] |
| ldflags += [ |
| "-fsanitize=address", |
| |
| # Force linking of the helpers in sanitizer_options.cc |
| "-Wl,-u_sanitizer_options_link_helper", |
| ] |
| defines += [ "ADDRESS_SANITIZER" ] |
| } else if (use_tsan) { |
| cflags += [ |
| "-fsanitize=thread", |
| "-fno-omit-frame-pointer", |
| ] |
| ldflags += [ "-fsanitize=thread" ] |
| defines += [ "THREAD_SANITIZER" ] |
| } |
| |
| defines += [ |
| # Defined to get format macro constants from <inttypes.h>. |
| "__STDC_FORMAT_MACROS", |
| "COBALT_LINUX", |
| ] |
| } |
| } |
| |
| config("speed") { |
| cflags = [ "-O2" ] |
| |
| if (is_qa || is_gold) { |
| cflags += [ |
| # Compile symbols in separate sections |
| "-ffunction-sections", |
| "-fdata-sections", |
| ] |
| } |
| } |
| |
| config("size") { |
| cflags = [ "-Os" ] |
| |
| if (is_qa || is_gold) { |
| cflags += [ |
| # Compile symbols in separate sections |
| "-ffunction-sections", |
| "-fdata-sections", |
| ] |
| } |
| } |
| |
| config("pedantic_warnings") { |
| cflags = [ |
| "-Wall", |
| "-Wextra", |
| "-Wunreachable-code", |
| ] |
| if (!is_clang) { |
| cflags += [ |
| "-Wno-expansion-to-defined", |
| ] |
| } |
| } |
| |
| config("no_pedantic_warnings") { |
| if (!is_clang) { |
| cflags = [ |
| "-Wno-conversion", |
| "-Wno-deprecated-declarations", |
| "-Wno-ignored-qualifiers", |
| "-Wno-multichar", |
| "-Wno-sign-conversion", |
| "-Wno-unused-function", |
| "-Wno-unused-local-typedefs", |
| "-Wno-unused-parameter", |
| "-Wno-unused-variable", |
| "-Wno-unused-but-set-variable", |
| ] |
| cflags_cc = [ |
| "-Wno-deprecated-copy", |
| "-Wno-invalid-offsetof", |
| "-Wno-literal-suffix", |
| "-Wno-pessimizing-move", |
| ] |
| } else { |
| cflags = [ |
| # Do not warn for implicit type conversions that may change a value. |
| "-Wno-conversion", |
| "-Wno-deprecated-declarations", |
| "-Wno-inconsistent-missing-override", |
| "-Wno-unknown-warning-option", |
| ] |
| } |
| } |