Split generation of dawncpp headers from libdawncpp

libdawn_native also requires the dawncpp headers. When we separated
libdawn_cpp from the dawn_headers, libdawn_native lost the cpp headers
and caused a compile failure. This patch separates the dawncpp headers
as a separate target so both libdawncpp and libdawn_native can depend
on them.

Bug: dawn:22
Change-Id: I4172f1654377afac8c4314123ee8b5b81dc7c928
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12300
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng 2019-10-16 10:26:01 +00:00 committed by Commit Bot service account
parent f3d50baf85
commit cc071e45bb
3 changed files with 28 additions and 7 deletions

View File

@ -89,7 +89,7 @@ if (dawn_enable_opengl) {
# dependencies of libdawn_native # dependencies of libdawn_native
source_set("libdawn_native_headers") { source_set("libdawn_native_headers") {
public_deps = [ public_deps = [
"${dawn_root}/src/dawn:dawn_headers", "${dawn_root}/src/dawn:dawncpp_headers",
] ]
all_dependent_configs = [ "${dawn_root}/src/common:dawn_public_include_dirs" ] all_dependent_configs = [ "${dawn_root}/src/common:dawn_public_include_dirs" ]
sources = [ sources = [
@ -669,7 +669,7 @@ static_library("dawn_utils") {
} }
public_deps = [ public_deps = [
"${dawn_root}/src/dawn:dawn_headers", "${dawn_root}/src/dawn:dawncpp_headers",
] ]
deps = [ deps = [

View File

@ -459,7 +459,7 @@ class MultiGeneratorFromDawnJSON(Generator):
return 'Generates code for various target from Dawn.json.' return 'Generates code for various target from Dawn.json.'
def add_commandline_arguments(self, parser): def add_commandline_arguments(self, parser):
allowed_targets = ['dawn_headers', 'dawncpp', 'dawn_proc', 'mock_dawn', 'dawn_wire', "dawn_native_utils"] allowed_targets = ['dawn_headers', 'dawncpp_headers', 'dawncpp', 'dawn_proc', 'mock_dawn', 'dawn_wire', "dawn_native_utils"]
parser.add_argument('--dawn-json', required=True, type=str, help ='The DAWN JSON definition to use.') parser.add_argument('--dawn-json', required=True, type=str, help ='The DAWN JSON definition to use.')
parser.add_argument('--wire-json', default=None, type=str, help='The DAWN WIRE JSON definition to use.') parser.add_argument('--wire-json', default=None, type=str, help='The DAWN WIRE JSON definition to use.')
@ -504,11 +504,13 @@ class MultiGeneratorFromDawnJSON(Generator):
renders.append(FileRender('api.h', 'src/include/dawn/dawn.h', [base_params, api_params, c_params])) renders.append(FileRender('api.h', 'src/include/dawn/dawn.h', [base_params, api_params, c_params]))
renders.append(FileRender('api_proc_table.h', 'src/include/dawn/dawn_proc_table.h', [base_params, api_params, c_params])) renders.append(FileRender('api_proc_table.h', 'src/include/dawn/dawn_proc_table.h', [base_params, api_params, c_params]))
if 'dawncpp_headers' in targets:
renders.append(FileRender('apicpp.h', 'src/include/dawn/dawncpp.h', [base_params, api_params, cpp_params]))
if 'dawn_proc' in targets: if 'dawn_proc' in targets:
renders.append(FileRender('api_proc.c', 'src/dawn/dawn_proc.c', [base_params, api_params, c_params])) renders.append(FileRender('api_proc.c', 'src/dawn/dawn_proc.c', [base_params, api_params, c_params]))
if 'dawncpp' in targets: if 'dawncpp' in targets:
renders.append(FileRender('apicpp.h', 'src/include/dawn/dawncpp.h', [base_params, api_params, cpp_params]))
renders.append(FileRender('apicpp.cpp', 'src/dawn/dawncpp.cpp', [base_params, api_params, cpp_params])) renders.append(FileRender('apicpp.cpp', 'src/dawn/dawncpp.cpp', [base_params, api_params, cpp_params]))
if 'mock_dawn' in targets: if 'mock_dawn' in targets:

View File

@ -50,6 +50,27 @@ source_set("dawn_headers") {
] ]
} }
###############################################################################
# Dawn C++ headers
###############################################################################
dawn_json_generator("dawncpp_headers_gen") {
target = "dawncpp_headers"
outputs = [
"src/include/dawn/dawncpp.h",
]
}
source_set("dawncpp_headers") {
public_deps = [
":dawn_headers",
":dawncpp_headers_gen",
]
sources = get_target_outputs(":dawncpp_headers_gen")
sources += [ "${dawn_root}/src/include/dawn/EnumClassBitmasks.h" ]
}
############################################################################### ###############################################################################
# Dawn C++ wrapper # Dawn C++ wrapper
############################################################################### ###############################################################################
@ -58,17 +79,15 @@ dawn_json_generator("dawncpp_gen") {
target = "dawncpp" target = "dawncpp"
outputs = [ outputs = [
"src/dawn/dawncpp.cpp", "src/dawn/dawncpp.cpp",
"src/include/dawn/dawncpp.h",
] ]
} }
source_set("dawncpp") { source_set("dawncpp") {
deps = [ deps = [
":dawn_headers",
":dawncpp_gen", ":dawncpp_gen",
":dawncpp_headers",
] ]
sources = get_target_outputs(":dawncpp_gen") sources = get_target_outputs(":dawncpp_gen")
sources += [ "${dawn_root}/src/include/dawn/EnumClassBitmasks.h" ]
} }
############################################################################### ###############################################################################