diff --git a/starboard/nplb/BUILD.gn b/starboard/nplb/BUILD.gn index 95ad19131f84..68c21ad89b99 100644 --- a/starboard/nplb/BUILD.gn +++ b/starboard/nplb/BUILD.gn @@ -303,6 +303,12 @@ target(gtest_target_type, "nplb") { "window_get_size_test.cc", ] + if (!is_android) { + # Android has a different clang version than linux. + sources += + [ "//starboard/nplb/compiler_compliance/cpp_compiler_version_check.cc" ] + } + configs += [ "//starboard/build/config:starboard_implementation" ] if (sb_enable_cast_codec_tests) { configs += [ ":cast_codec_tests" ] diff --git a/starboard/nplb/compiler_compliance/cpp_compiler_version_check.cc b/starboard/nplb/compiler_compliance/cpp_compiler_version_check.cc new file mode 100644 index 000000000000..51ea6b039579 --- /dev/null +++ b/starboard/nplb/compiler_compliance/cpp_compiler_version_check.cc @@ -0,0 +1,28 @@ +// Copyright 2024 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 aLicense 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. + +#include + +#ifdef __clang__ +// Check Clang major version required for building Nplb tests. +// Clang major version can be deduced from "clang_revision" in +// starboard/build/config/clang.gni +static_assert( + __clang_major__ >= 17, + "We compile above Starboard targets like Cobalt, Nplb with " + "clang17 or higher. If you are building with a non-Cobalt " + "provided toolchain you may run into this error. To fix this error" + "build libnplb using the Evergreen toolchain : " + "cobalt.dev/development/setup-raspi"); +#endif // __clang__