| # 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. |
| |
| # This file handles the removal of platform-specific files from the |
| # Skia build. |
| |
| template("skia_common") { |
| # This list will contain all defines that also need to be exported to |
| # dependent components. |
| skia_export_defines = [ |
| "SK_DISABLE_EFFECT_DESERIALIZATION=1", |
| "SK_SUPPORT_GPU=1", |
| "SK_USER_CONFIG_HEADER=\"cobalt/renderer/rasterizer/skia/skia/config/SkUserConfig.h\"", |
| ] |
| |
| if (target_os == "win") { |
| skia_export_defines += [ |
| # Required define by Skia to take certain code paths, such |
| # as including windows.h in various places. |
| "SK_BUILD_FOR_WIN32", |
| ] |
| } |
| |
| # The |default_font_cache_limit| specifies the max size of the glyph cache, |
| # which contains path and metrics information for glyphs, before it will |
| # start purging entries. The current value matches the limit used by |
| # Android. Set the value to 1*1024*1024. |
| default_font_cache_limit = 1048576 |
| |
| config("skia_common_config_$target_name") { |
| if (is_clang) { |
| cflags = [ "-Wno-tautological-compare" ] |
| } |
| } |
| |
| config("skia_common_config_public_$target_name") { |
| defines = skia_export_defines |
| |
| # We would prefer this to be direct_dependent_settings, |
| # however we currently have no means to enforce that direct dependents |
| # re-export if they include Skia headers in their public headers. |
| include_dirs = [ "config" ] |
| } |
| |
| static_library(target_name) { |
| forward_variables_from(invoker, "*", [ "configs" ]) |
| |
| if (defined(include_dirs)) { |
| include_dirs += [ "//third_party/skia" ] |
| } else { |
| include_dirs = [ "//third_party/skia" ] |
| } |
| |
| defines = [ |
| # skia uses static initializers to initialize the serialization logic |
| # of its "pictures" library. This is currently not used in Cobalt; if |
| # it ever gets used the processes that use it need to call |
| # SkGraphics::Init(). |
| "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0", |
| |
| # ETC1 texture encoding is not supported in Cobalt by default. |
| "SK_IGNORE_ETC1_SUPPORT", |
| |
| "SK_DEFAULT_FONT_CACHE_LIMIT=$default_font_cache_limit", |
| |
| # Use scalar portable implementations instead of Clang/GCC vector extensions |
| # in SkVx.h, as this causes an internal compiler error for raspi-2. |
| "SKNX_NO_SIMD", |
| ] |
| |
| configs += [ ":skia_common_config_$target_name" ] |
| |
| if (defined(invoker.configs)) { |
| configs += invoker.configs |
| } |
| |
| if (defined(public_configs)) { |
| public_configs += [ ":skia_common_config_public_$target_name" ] |
| } else { |
| public_configs = [ ":skia_common_config_public_$target_name" ] |
| } |
| |
| if (defined(deps)) { |
| deps += [ "//starboard:starboard_headers_only" ] |
| } else { |
| deps = [ "//starboard:starboard_headers_only" ] |
| } |
| } |
| } |