| # Copyright 2022 The Pigweed Authors |
| # |
| # 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 |
| # |
| # https://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. |
| |
| # Constants that represent the different C++ standards. These are set to the |
| # value of __cplusplus, which allows for unambiguous numeric comparison of C++ |
| # standards. |
| pw_toolchain_STANDARD = { |
| CXX98 = 199711 |
| CXX11 = 201103 |
| CXX14 = 201402 |
| CXX17 = 201703 |
| CXX20 = 202002 |
| } |
| |
| declare_args() { |
| # Specifies the C++ standard this toolchain is compiling for. The value must |
| # be an integer that matches the value of the __cplusplus macro when compiling |
| # with that standard. Use the pw_toolchain_CXX_STANDARD_## constants to set |
| # this value. |
| pw_toolchain_CXX_STANDARD = pw_toolchain_STANDARD.CXX17 |
| } |
| |
| assert( |
| pw_toolchain_CXX_STANDARD == pw_toolchain_STANDARD.CXX98 || |
| pw_toolchain_CXX_STANDARD == pw_toolchain_STANDARD.CXX11 || |
| pw_toolchain_CXX_STANDARD == pw_toolchain_STANDARD.CXX14 || |
| pw_toolchain_CXX_STANDARD == pw_toolchain_STANDARD.CXX17 || |
| pw_toolchain_CXX_STANDARD == pw_toolchain_STANDARD.CXX20, |
| "pw_toolchain_CXX_STANDARD ($pw_toolchain_CXX_STANDARD) is an " + |
| "unsupported value. The toolchain must set it to one of the " + |
| "pw_toolchain_STANDARD constants (e.g. pw_toolchain_STANDARD.CXX17).") |
| |
| assert(pw_toolchain_CXX_STANDARD >= pw_toolchain_STANDARD.CXX14, |
| "Pigweed requires at least C++14.") |