Eric Ye has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/55043 )

Change subject: scons: Try to fix build dependency bug when generating fastmodels
......................................................................

scons: Try to fix build dependency bug when generating fastmodels

Bug: 201084562
Change-Id: I33cc9e09b1ce46f80864d75f088a2534949e55e1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55043
Reviewed-by: Gabe Black <gabebl...@google.com>
Maintainer: Gabe Black <gabebl...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/arm/fastmodel/SConscript
1 file changed, 47 insertions(+), 21 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/arch/arm/fastmodel/SConscript b/src/arch/arm/fastmodel/SConscript
index 63b1b16..ccfc620 100644
--- a/src/arch/arm/fastmodel/SConscript
+++ b/src/arch/arm/fastmodel/SConscript
@@ -250,6 +250,34 @@
 arm_licenses = list((Value(object()) for i in range(license_count)))
 license_cycle = cycle(arm_licenses)

+# HACK: Make sure the gic protocol headers are somewhere we can find them.
+# These should start out alongside other headers fast model provides which we
+# are already able to include, but unfortunately they're in the examples
+# directory.
+gicv3_comms_headers = (
+        'gicv3_comms_base.h', 'gicv3_comms_if.h', 'gicv3_comms_sockets.h')
+examples_common_dir = pvlib_home.Dir('examples/SystemCExport/Common')
+gic_protocol_path = 'Protocols/GICv3Comms'
+gic_protocol_dest = Dir(env['BUILDDIR']).Dir(gic_protocol_path)
+gic_protocol_src = examples_common_dir.Dir(gic_protocol_path)
+
+for header in gicv3_comms_headers:
+    Command(gic_protocol_dest.File(header), gic_protocol_src.File(header),
+            Copy('${TARGET}', '${SOURCE}'))
+# Since we are copying the source files to a different directory, Scons's
+# dependency scanner does not pick up the dependency between these files.
+# Specify them manually.
+env.Depends(gic_protocol_dest.File('gicv3_comms_base.h'),
+            gic_protocol_dest.File('gicv3_comms_if.h'))
+env.Depends(gic_protocol_dest.File('gicv3_comms_sockets.h'),
+            gic_protocol_dest.File('gicv3_comms_if.h'))
+
+common_headers = ('lisa_protocol_types.h', 'tlm_has_get_protocol_types.h')
+for header in common_headers:
+    header_target = gic_protocol_dest.Dir('include').File(header)
+    header_src = examples_common_dir.Dir('include').File(header)
+    Command(header_target, header_src, Copy('${TARGET}', '${SOURCE}'))
+
 class ArmFastModelComponent(object):
     def __init__(self, project_file, *extra_deps):
         project_file = File(project_file)
@@ -320,6 +348,11 @@

         sources = [project_file]
         sources.extend(extra_deps)
+ # The simgen-generated .lisa files may #include these gicv3 files, but + # SCons does not detect this dependency since they are generated files.
+        # Add the dependencies manually.
+        sources.extend([gic_protocol_dest.File('gicv3_comms_sockets.h'),
+                        gic_protocol_dest.File('gicv3_comms_base.h')])
         env.Command(lib_nodes + self.headers + [self.log], sources,
                     Action(self.simgen_builder, Transform('SIMGEN')))
# Distribute simgen actions among ARM license slots. All actions which
@@ -357,24 +390,3 @@
     'AmbaToTlmBridge64', 'AmbaFromTlmBridge64'])
 Source('amba_to_tlm_bridge.cc')
 Source('amba_from_tlm_bridge.cc')
-
-# HACK: Make sure the gic protocol headers are somewhere we can find them.
-# These should start out alongside other headers fast model provides which we
-# are already able to include, but unfortunately they're in the examples
-# directory.
-gicv3_comms_headers = (
-        'gicv3_comms_base.h', 'gicv3_comms_if.h', 'gicv3_comms_sockets.h')
-examples_common_dir = pvlib_home.Dir('examples/SystemCExport/Common')
-gic_protocol_path = 'Protocols/GICv3Comms'
-gic_protocol_dest = Dir(env['BUILDDIR']).Dir(gic_protocol_path)
-gic_protocol_src = examples_common_dir.Dir(gic_protocol_path)
-
-for header in gicv3_comms_headers:
-    Command(gic_protocol_dest.File(header), gic_protocol_src.File(header),
-            Copy('${TARGET}', '${SOURCE}'))
-
-common_headers = ('lisa_protocol_types.h', 'tlm_has_get_protocol_types.h')
-for header in common_headers:
-    header_target = gic_protocol_dest.Dir('include').File(header)
-    header_src = examples_common_dir.Dir('include').File(header)
-    Command(header_target, header_src, Copy('${TARGET}', '${SOURCE}'))

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/55043
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I33cc9e09b1ce46f80864d75f088a2534949e55e1
Gerrit-Change-Number: 55043
Gerrit-PatchSet: 7
Gerrit-Owner: Eric Ye <eri...@google.com>
Gerrit-Reviewer: Eric Ye <eri...@google.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to