| # Copyright 2021 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| declare_args() { |
| # Specify a specific target API level for the platform build. |
| # |
| # For the normal platform build, the API level is "PLATFORM", which is greater |
| # than (that is to say: "newer than") all other API levels. |
| # |
| # If this is _not_ set to "PLATFORM", then it must be set to a positive |
| # integer corresponding to a currently supported (not sunset) API level. In |
| # that case, the build will target the given API level. |
| # |
| # This is primarily used by the IDK. Not all targets support the non-default |
| # value. In particular, `:default` currently fails. |
| override_target_api_level = "PLATFORM" |
| } |
| |
| # LINT.IfChange(fuchsia_head_value) |
| FUCHSIA_HEAD_VALUE = 4292870144 |
| |
| # LINT.ThenChange(//zircon/system/public/zircon/availability.h:fuchsia_head_value) |
| |
| if (override_target_api_level == "PLATFORM") { |
| # This constant actually gives the API level for `HEAD`. It _should_ be the |
| # API level for `PLATFORM`, and will be soon, but I'm taking tiny baby steps. |
| # |
| # TODO(https://fxbug.dev/330426357): Switch this to a constant for `PLATFORM`, |
| # once one exists. |
| clang_fuchsia_api_level = FUCHSIA_HEAD_VALUE |
| |
| # By default the FIDL APIs are compiled at the "LEGACY" level, which is an |
| # older name for the "PLATFORM" API level. This level is only meant to be used |
| # in the platform itself, SDK users aren't expected to target it. It's a |
| # higher level than the "HEAD" API level, in other words, "HEAD" is a subset |
| # of "LEGACY". |
| fidl_fuchsia_api_level = "LEGACY" |
| |
| # Directory name to use for target API level. |
| target_cpu_dir_name_for_target_api_level = target_cpu |
| |
| # Base path for library binaries in SDKs. |
| sdk_prebuilt_base_for_target_api_level = |
| "arch/${target_cpu_dir_name_for_target_api_level}" |
| } else { |
| # Ensure that `override_target_api_level` is an integer corresponding to a |
| # normal API level. |
| assert( |
| 0 < override_target_api_level, |
| "Override must be 'PLATFORM' or a positive integer, not: ${override_target_api_level}") |
| assert(override_target_api_level < 2147483648, |
| "Special API levels should be given by name, not number.") |
| |
| clang_fuchsia_api_level = override_target_api_level |
| fidl_fuchsia_api_level = "$override_target_api_level" |
| |
| target_cpu_dir_name_for_target_api_level = |
| "${target_cpu}-api-${override_target_api_level}" |
| sdk_prebuilt_base_for_target_api_level = |
| "obj/${target_cpu_dir_name_for_target_api_level}" |
| } |