blob: bd345c884508fa948be392d5d8818beb4837bfd0 [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Modifications Copyright 2017 Google Inc. 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.
import("//cobalt/build/config/base.gni")
# TODO: split out into relevant subdirectories
config("compiler_defaults") {
if (cobalt_media_buffer_pool_allocate_on_demand) {
allocate_on_demand = 1
} else {
allocate_on_demand = 0
}
defines = [
"COBALT",
"COBALT_MEDIA_BUFFER_POOL_ALLOCATE_ON_DEMAND=$allocate_on_demand",
"COBALT_MEDIA_BUFFER_INITIAL_CAPACITY=$cobalt_media_buffer_initial_capacity",
"COBALT_MEDIA_BUFFER_MAX_CAPACITY_1080p=$cobalt_media_buffer_max_capacity_1080p",
"COBALT_MEDIA_BUFFER_MAX_CAPACITY_4K=$cobalt_media_buffer_max_capacity_4k",
"COBALT_MEDIA_BUFFER_ALLOCATION_UNIT=$cobalt_media_buffer_allocation_unit",
"COBALT_MEDIA_BUFFER_ALIGNMENT=$cobalt_media_buffer_alignment",
"COBALT_MEDIA_BUFFER_PADDING=$cobalt_media_buffer_padding",
"COBALT_MEDIA_BUFFER_PROGRESSIVE_BUDGET=$cobalt_media_buffer_progressive_budget",
"COBALT_MEDIA_BUFFER_NON_VIDEO_BUDGET=$cobalt_media_buffer_non_video_budget",
"COBALT_MEDIA_BUFFER_VIDEO_BUDGET_1080P=$cobalt_media_buffer_video_budget_1080p",
"COBALT_MEDIA_BUFFER_VIDEO_BUDGET_4K=$cobalt_media_buffer_video_budget_4k",
"COBALT_MEDIA_SOURCE_GARBAGE_COLLECTION_DURATION_THRESHOLD_IN_SECONDS=$cobalt_media_source_garbage_collection_duration_threshold_in_seconds",
# From common.gypi
"USE_OPENSSL=1",
]
include_dirs = [ "//" ]
if (cobalt_use_media_source_2016) {
defines += [ "COBALT_MEDIA_SOURCE_2016=1" ]
} else {
defines += [ "COBALT_MEDIA_SOURCE_2012=1" ]
}
if (cobalt_media_buffer_storage_type == "memory") {
defines += [ "COBALT_MEDIA_BUFFER_STORAGE_TYPE_MEMORY=1" ]
} else {
defines += [ "COBALT_MEDIA_BUFFER_STORAGE_TYPE_FILE=1" ]
}
if (enable_in_app_dial) {
defines += [ "DIAL_SERVER" ]
}
if (!enable_spdy) {
defines += [ "COBALT_DISABLE_SPDY" ]
}
}
config("final_executable_target_config") {
# XXX: ideally this config would only apply when we are compiling targets
# for the target platform. We try to check for that here, however, this check
# is ineffective when default_toolchain happens to be the same as
# host_toolchain.
# Therefore, **targets which should be compiled for the host must remove this
# config from their list of configs.**
if (current_toolchain == default_toolchain &&
final_executable_type == "shared_library") {
defines = [
# Rewrite main() functions into StarboardMain. TODO: This is a
# hack, it would be better to be more surgical, here.
"main=StarboardMain",
]
cflags = [
# To link into a shared library on Linux and similar platforms,
# the compiler must be told to generate Position Independent Code.
# This appears to cause errors when linking the code statically,
# however.
"-fPIC",
]
}
}
config("compiler_defaults_debug") {
defines = [
"ALLOCATOR_STATS_TRACKING",
"COBALT_BOX_DUMP_ENABLED",
"COBALT_BUILD_TYPE_DEBUG",
"COBALT_ENABLE_JAVASCRIPT_ERROR_LOGGING",
"COBALT_SECURITY_SCREEN_CLEAR_TO_UGLY_COLOR",
"_DEBUG",
"ENABLE_DEBUG_COMMAND_LINE_SWITCHES",
"ENABLE_DEBUG_C_VAL",
"ENABLE_DEBUG_CONSOLE",
"ENABLE_IGNORE_CERTIFICATE_ERRORS",
"ENABLE_PARTIAL_LAYOUT_CONTROL",
"ENABLE_TEST_DATA",
"ENABLE_TEST_RUNNER",
"__LB_SHELL__FORCE_LOGGING__", # TODO: Rename to COBALT_LOGGING_ENABLED.
"SK_DEVELOPER",
]
}
config("compiler_defaults_devel") {
defines = [
"_DEBUG",
"ALLOCATOR_STATS_TRACKING",
"COBALT_BUILD_TYPE_DEVEL",
"COBALT_ENABLE_JAVASCRIPT_ERROR_LOGGING",
"COBALT_SECURITY_SCREEN_CLEAR_TO_UGLY_COLOR",
"ENABLE_DEBUG_COMMAND_LINE_SWITCHES",
"ENABLE_DEBUG_C_VAL",
"ENABLE_DEBUG_CONSOLE",
"ENABLE_IGNORE_CERTIFICATE_ERRORS",
"ENABLE_PARTIAL_LAYOUT_CONTROL",
"ENABLE_TEST_DATA",
"ENABLE_TEST_RUNNER",
"__LB_SHELL__FORCE_LOGGING__",
"SK_DEVELOPER",
]
}
config("compiler_defaults_qa") {
defines = [
"ALLOCATOR_STATS_TRACKING",
"COBALT_BUILD_TYPE_QA",
"COBALT_ENABLE_JAVASCRIPT_ERROR_LOGGING",
"COBALT_SECURITY_SCREEN_CLEAR_TO_UGLY_COLOR",
"ENABLE_DEBUG_COMMAND_LINE_SWITCHES",
"ENABLE_DEBUG_C_VAL",
"ENABLE_DEBUG_CONSOLE",
"ENABLE_IGNORE_CERTIFICATE_ERRORS",
"ENABLE_PARTIAL_LAYOUT_CONTROL",
"ENABLE_TEST_DATA",
"ENABLE_TEST_RUNNER",
"NDEBUG",
]
}
config("compiler_defaults_gold") {
defines = [
"ALLOCATOR_STATS_TRACKING",
"COBALT_BUILD_TYPE_GOLD",
"COBALT_FORCE_CSP",
"COBALT_FORCE_HTTPS",
"NDEBUG",
"TRACING_DISABLED",
]
}
config("chromium_code") {
defines = [
"__STDC_CONSTANT_MACROS",
"__STDC_FORMAT_MACROS",
]
}