Add error directives for api.h/api_cpp.h #ifdef __EMSCRIPTEN__ This could avoid including dawn's version of webgpu headers and confusion at runtime when build with emscripten. Emscripten's system/include/webgpu headers should be used. Bug: None Change-Id: Ie8c6ebc23f28a56b1cb887ae7f11d3f738151aec Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79740 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Shrek Shao <shrekshao@google.com>
diff --git a/generator/templates/api_cpp.h b/generator/templates/api_cpp.h index d54dcc3..2a207cc 100644 --- a/generator/templates/api_cpp.h +++ b/generator/templates/api_cpp.h
@@ -13,6 +13,11 @@ //* limitations under the License. {% set API = metadata.api.upper() %} {% set api = API.lower() %} +{% if 'dawn' not in enabled_tags %} + #ifdef __EMSCRIPTEN__ + #error "Do not include this header. Emscripten already provides headers needed for {{metadata.api}}." + #endif +{% endif %} #ifndef {{API}}_CPP_H_ #define {{API}}_CPP_H_