@@ -44,6 +44,13 @@ def _ecsact_binary_impl(ctx):
4444 if interface_output_file != None :
4545 outputs .append (interface_output_file )
4646
47+ if ctx .attr .tracy :
48+ tracy_dll_file = ctx .actions .declare_file ("{}{}" .format ("profiler" , ".dll" ))
49+ tracy_lib_file = ctx .actions .declare_file ("{}{}" .format ("profiler" , ".lib" ))
50+
51+ outputs .append (tracy_dll_file )
52+ outputs .append (tracy_lib_file )
53+
4754 args = ctx .actions .args ()
4855 args .add ("build" )
4956 args .add_all (ctx .files .srcs )
@@ -80,6 +87,9 @@ def _ecsact_binary_impl(ctx):
8087
8188 args .add ("--compiler_config" , compiler_config_file )
8289
90+ if ctx .attr .tracy :
91+ args .add ("--tracy" )
92+
8393 if ctx .attr .allow_unresolved_imports :
8494 args .add ("--allow-unresolved-imports" )
8595
@@ -105,7 +115,9 @@ def _ecsact_binary_impl(ctx):
105115 toolchain = Label ("//ecsact:toolchain_type" ),
106116 )
107117
108- library_to_link = cc_common .create_library_to_link (
118+ link_libraries = []
119+
120+ runtime_link_library = cc_common .create_library_to_link (
109121 actions = ctx .actions ,
110122 feature_configuration = feature_configuration ,
111123 cc_toolchain = cc_toolchain ,
@@ -116,8 +128,23 @@ def _ecsact_binary_impl(ctx):
116128 alwayslink = False ,
117129 )
118130
131+ link_libraries .append (runtime_link_library )
132+
133+ if ctx .attr .tracy :
134+ tracy_link_library = cc_common .create_library_to_link (
135+ actions = ctx .actions ,
136+ feature_configuration = feature_configuration ,
137+ cc_toolchain = cc_toolchain ,
138+ static_library = None ,
139+ pic_static_library = None ,
140+ interface_library = tracy_lib_file ,
141+ dynamic_library = tracy_dll_file ,
142+ alwayslink = False ,
143+ )
144+ link_libraries .append (tracy_link_library )
145+
119146 linker_input = cc_common .create_linker_input (
120- libraries = depset ([ library_to_link ] ),
147+ libraries = depset (link_libraries ),
121148 user_link_flags = depset (ctx .attr .linkopts ),
122149 owner = ctx .label ,
123150 )
@@ -165,6 +192,10 @@ _ecsact_binary = rule(
165192 mandatory = False ,
166193 default = False ,
167194 ),
195+ "tracy" : attr .bool (
196+ mandatory = False ,
197+ default = False ,
198+ ),
168199 },
169200 toolchains = ["//ecsact:toolchain_type" ] + use_cc_toolchain (),
170201 fragments = ["cpp" ],
0 commit comments