@@ -132,8 +132,8 @@ def _verilator_cc_library(ctx):
132132 verilog_files .append (file )
133133
134134 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 )
137137
138138 prefix = "V" + ctx .attr .module_top
139139
@@ -175,7 +175,7 @@ def _verilator_cc_library(ctx):
175175 defines = ["VM_TRACE" ] if ctx .attr .trace else []
176176 deps = [ctx .attr ._verilator_lib , ctx .attr ._zlib , ctx .attr ._verilator_svdpi ]
177177
178- return cc_compile_and_link_static_library (
178+ [ default , cc ] = cc_compile_and_link_static_library (
179179 ctx ,
180180 srcs = [verilator_output_cpp ],
181181 hdrs = [verilator_output_hpp ],
@@ -184,6 +184,10 @@ def _verilator_cc_library(ctx):
184184 includes = [verilator_output_hpp .path ],
185185 deps = deps ,
186186 )
187+ return [
188+ DefaultInfo (files = depset ([verilator_output_hpp ], transitive = [default .files ])),
189+ cc ,
190+ ]
187191
188192verilator_cc_library = rule (
189193 _verilator_cc_library ,
@@ -209,6 +213,10 @@ verilator_cc_library = rule(
209213 doc = "List of additional compilation flags" ,
210214 default = [],
211215 ),
216+ "out_include_dir" : attr .string (
217+ doc = "Name of the output subdirectory with the header files." ,
218+ default = "include" ,
219+ ),
212220 "_cc_toolchain" : attr .label (
213221 doc = "CC compiler." ,
214222 default = Label ("@bazel_tools//tools/cpp:current_cc_toolchain" ),
0 commit comments