Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/56751 )

Change subject: scons: Process the SConsopts files for each variant.
......................................................................

scons: Process the SConsopts files for each variant.

The SConsopts files that need to be processed is affected by the EXTRAS
setting, and if all settings are going to be local to the variants, that
means each variant can have a different set of SConsopts files to use.

This does result in Configure type output showing up repeatedly when
building multiple variants, but that's uncommon for users, and will
hopefully become unnecessary for developers over time.

Change-Id: I7df287c37fc32e91576dced80d0a9e56806c4581
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56751
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandb...@arm.com>
---
M SConstruct
1 file changed, 67 insertions(+), 46 deletions(-)

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




diff --git a/SConstruct b/SConstruct
index fe7b3ab..ec36532 100755
--- a/SConstruct
+++ b/SConstruct
@@ -597,52 +597,6 @@

 ########################################################################
 #
-# Read and process SConsopts files. These can add new settings which
-# affect each variant directory independently.
-#
-########################################################################
-
-# Register a callback which is called after all SConsopts files have been read.
-after_sconsopts_callbacks = []
-def AfterSConsopts(cb):
-    after_sconsopts_callbacks.append(cb)
-Export('AfterSConsopts')
-
-# Sticky variables get saved in the variables file so they persist from
-# one invocation to the next (unless overridden, in which case the new
-# value becomes sticky).
-sticky_vars = Variables(args=ARGUMENTS)
-Export('sticky_vars')
-
-# Sticky variables that should be exported to #defines in config/*.hh
-# (see src/SConscript).
-export_vars = []
-Export('export_vars')
-
-# Walk the tree and execute all SConsopts scripts that wil add to the
-# above variables
-if GetOption('verbose'):
-    print("Reading SConsopts")
-for bdir in [ base_dir ] + extras_dir_list:
-    if not isdir(bdir):
-        error("Directory '%s' does not exist." % bdir)
-    for root, dirs, files in os.walk(bdir):
-        if 'SConsopts' in files:
-            if GetOption('verbose'):
-                print("Reading", os.path.join(root, 'SConsopts'))
-            SConscript(os.path.join(root, 'SConsopts'))
-
-# Call any callbacks which the SConsopts files registered.
-for cb in after_sconsopts_callbacks:
-    cb()
-
-# Add any generic sticky variables here.
-sticky_vars.Add(BoolVariable('USE_EFENCE',
-    'Link with Electric Fence malloc debugger', False))
-
-
-########################################################################
-#
 # Define build environments for required variants.
 #
 ########################################################################
@@ -659,6 +613,52 @@
     # determine the build parameters (e.g., 'X86')
     (build_root, variant_dir) = os.path.split(variant_path)

+    ####################################################################
+    #
+    # Read and process SConsopts files. These can add new settings which
+    # affect each variant directory independently.
+    #
+    ####################################################################
+
+    # Register a callback to call after all SConsopts files have been read.
+    after_sconsopts_callbacks = []
+    def AfterSConsopts(cb):
+        after_sconsopts_callbacks.append(cb)
+    Export('AfterSConsopts')
+
+    # Sticky variables get saved in the variables file so they persist from
+    # one invocation to the next (unless overridden, in which case the new
+    # value becomes sticky).
+    sticky_vars = Variables(args=ARGUMENTS)
+    Export('sticky_vars')
+
+    # Sticky variables that should be exported to #defines in config/*.hh
+    # (see src/SConscript).
+    export_vars = []
+    Export('export_vars')
+
+    # Walk the tree and execute all SConsopts scripts that wil add to the
+    # above variables
+    if GetOption('verbose'):
+        print("Reading SConsopts")
+    for bdir in [ base_dir ] + extras_dir_list:
+        if not isdir(bdir):
+            error("Directory '%s' does not exist." % bdir)
+        for root, dirs, files in os.walk(bdir):
+            if 'SConsopts' in files:
+                if GetOption('verbose'):
+                    print("Reading", os.path.join(root, 'SConsopts'))
+                SConscript(os.path.join(root, 'SConsopts'),
+                        exports={'main': env})
+
+    # Call any callbacks which the SConsopts files registered.
+    for cb in after_sconsopts_callbacks:
+        cb()
+
+    # Add any generic sticky variables here.
+    sticky_vars.Add(BoolVariable('USE_EFENCE',
+        'Link with Electric Fence malloc debugger', False))
+
     # Set env variables according to the build directory config.
     sticky_vars.files = []
     # Variables for $BUILD_ROOT/$VARIANT_DIR are stored in

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56751
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: I7df287c37fc32e91576dced80d0a9e56806c4581
Gerrit-Change-Number: 56751
Gerrit-PatchSet: 9
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.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