| # Copyright 2023 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. |
| |
| _default_cxx_version = 20 |
| |
| _available_cxx_versions = [ |
| 20, |
| 23, |
| ] |
| |
| # The C++ standard version with which the Fuchsia build compiles C++ code. |
| # Possible values are integers in `_available_cxx_versions`. |
| # |
| # GN code both in fuchsia.git and in cooperating repositories should use only |
| # this variable, which can remain part of the Fuchsia build's internal GN API |
| # after the `experimental_cxx_version` build argument is removed. |
| fuchsia_cxx_version = _default_cxx_version |
| |
| declare_args() { |
| # **NOTE:** This is for **experimentation only** and should not normally be |
| # changed. Set the version of the C++ standard to use when compiling. Must be |
| # on of the values in `_available_cxx_versions`. |
| # Note also that GN code should never use this variable directly, but always |
| # instead use the `fuchsia_cxx_version` variable. |
| experimental_cxx_version = false |
| } |
| |
| if (experimental_cxx_version != false) { |
| fuchsia_cxx_version = experimental_cxx_version |
| |
| assert( |
| _available_cxx_versions + [ experimental_cxx_version ] - |
| [ experimental_cxx_version ] != _available_cxx_versions, |
| "`experimental_cxx_version=$experimental_cxx_version` must be one of $_available_cxx_versions") |
| } |