Fix SCons linking error when building for Multi ISA.

When building for Multi ISA the link command throws:
'argument list too long' error since the list string being
pass to the linker exceeds the ARG_MAX value. The solution is to
split the object list into two distinct static libraries and have them
link back together.

Prohibit unknown variable use.
The script now checks for unknown parameters.

Resolves: COMPMID-4921
Change-Id: I97a27e86f90a7cc680a3c487da1c468cd3e1084e
Signed-off-by: Motti Gondabi <motti.gondabi@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6847
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Reviewed-by: SiCong Li <sicong.li@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
diff --git a/SConstruct b/SConstruct
index 2a8403f..28704d3 100644
--- a/SConstruct
+++ b/SConstruct
@@ -126,6 +126,7 @@
     ("build_config", "Operator/Data-type/Data-layout configuration to use for tailored ComputeLibrary builds. Can be a JSON file or a JSON formatted string", "")
 )
 
+
 env = Environment(platform="posix", variables=vars, ENV = os.environ)
 build_path = env['build_dir']
 # If build_dir is a relative path then add a #build/ prefix:
@@ -248,6 +249,13 @@
     print("ERROR: armv7a architecture has only 32-bit execution state")
     Exit(1)
 
+if 'sve' in env['arch']:
+    env.Append(CPPDEFINES = ['ENABLE_SVE', 'ARM_COMPUTE_ENABLE_SVE'])
+    if 'sve2' in env['arch']:
+        env.Append(CPPDEFINES = ['ARM_COMPUTE_ENABLE_SVE2'])
+else:
+    env.Append(CPPDEFINES = ['ENABLE_NEON', 'ARM_COMPUTE_ENABLE_NEON'])
+
 # Add architecture specific flags
 prefix = ""
 if env['multi_isa']:
@@ -262,17 +270,6 @@
 
 else: # NONE "multi_isa" builds
 
-    if 'sve' in env['arch']:
-        env.Append(CPPDEFINES = ['ENABLE_SVE', 'ARM_COMPUTE_ENABLE_SVE'])
-        if 'sve2' in env['arch']:
-            env.Append(CPPDEFINES = ['ARM_COMPUTE_ENABLE_SVE2'])
-    else:
-        # FIXME: The NEON flags should be always defined for CPU.
-        #        however, build fails when SVE/SVE2 & NEON flags
-        #        defined together.
-        env.Append(CPPDEFINES = ['ENABLE_NEON', 'ARM_COMPUTE_ENABLE_NEON'])
-    
-
     if 'v7a' in env['arch']:
         env.Append(CXXFLAGS = ['-march=armv7-a', '-mthumb', '-mfpu=neon'])
         if (env['os'] == 'android' or env['os'] == 'tizen') and not 'hf' in env['arch']:
@@ -483,3 +480,11 @@
         print("WARNING: Building tests for bare metal and armv7a is not supported")
         Return()
     SConscript('./tests/SConscript', variant_dir='%s/tests' % build_path, duplicate=0)
+
+# Unknown variables are not allowed
+# Note: we must delay the call of UnknownVariables until after
+# we have applied the Variables object to the construction environment
+unknown = vars.UnknownVariables()
+if unknown:
+    print("Unknown variables: %s" % " ".join(unknown.keys()))
+    Exit(1)
\ No newline at end of file