@@ -132,8 +132,8 @@ def _verilator_cc_library(ctx):
132
132
verilog_files .append (file )
133
133
134
134
verilator_output = ctx .actions .declare_directory (ctx .label .name + "-gen" )
135
- verilator_output_cpp = ctx .actions .declare_directory (ctx .label .name + ". cpp" )
136
- verilator_output_hpp = ctx .actions .declare_directory (ctx .label . name + ".h" )
135
+ verilator_output_cpp = ctx .actions .declare_directory (ctx .label .name + "- cpp" )
136
+ verilator_output_hpp = ctx .actions .declare_directory (ctx .attr . out_include_dir )
137
137
138
138
prefix = "V" + ctx .attr .module_top
139
139
@@ -175,7 +175,7 @@ def _verilator_cc_library(ctx):
175
175
defines = ["VM_TRACE" ] if ctx .attr .trace else []
176
176
deps = [ctx .attr ._verilator_lib , ctx .attr ._zlib , ctx .attr ._verilator_svdpi ]
177
177
178
- return cc_compile_and_link_static_library (
178
+ [ default , cc ] = cc_compile_and_link_static_library (
179
179
ctx ,
180
180
srcs = [verilator_output_cpp ],
181
181
hdrs = [verilator_output_hpp ],
@@ -184,6 +184,10 @@ def _verilator_cc_library(ctx):
184
184
includes = [verilator_output_hpp .path ],
185
185
deps = deps ,
186
186
)
187
+ return [
188
+ DefaultInfo (files = depset ([verilator_output_hpp ], transitive = [default .files ])),
189
+ cc ,
190
+ ]
187
191
188
192
verilator_cc_library = rule (
189
193
_verilator_cc_library ,
@@ -209,6 +213,10 @@ verilator_cc_library = rule(
209
213
doc = "List of additional compilation flags" ,
210
214
default = [],
211
215
),
216
+ "out_include_dir" : attr .string (
217
+ doc = "Name of the output subdirectory with the header files." ,
218
+ default = "include" ,
219
+ ),
212
220
"_cc_toolchain" : attr .label (
213
221
doc = "CC compiler." ,
214
222
default = Label ("@bazel_tools//tools/cpp:current_cc_toolchain" ),
0 commit comments