blob: fbe42487e21c72485ed020dbd88a033d3767b715 [file] [log] [blame]
# 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"
}
# Numerical values associated with special API levels, as established by
# RFC-0246.
_FUCHSIA_PLATFORM_VALUE = 4293918720
if (override_target_api_level == "PLATFORM") {
clang_fuchsia_api_level = _FUCHSIA_PLATFORM_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}"
}