Title: [276390] trunk
Revision
276390
Author
[email protected]
Date
2021-04-21 14:13:41 -0700 (Wed, 21 Apr 2021)

Log Message

[Python 3] Update gni-to-cmake.py
https://bugs.webkit.org/show_bug.cgi?id=224880

Reviewed by Kenneth Russell.

Source/ThirdParty/ANGLE:

Update gni-to-cmake.py to run on Python 3. Added ArgumentParser support to be able to run
the script on Windows since the script assumed it would be called through a UNIX style
shell.

Ran the .gni files through the converter to verify output. It appears that the
Compiler.cmake file wasn't generated in the last update to ANGLE so it has many changes.

* Compiler.cmake:
* D3D.cmake:
* gni-to-cmake.py:

Tools:

Update script to use the `--prepend` argument.

* Scripts/update-angle:

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (276389 => 276390)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-04-21 20:53:00 UTC (rev 276389)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2021-04-21 21:13:41 UTC (rev 276390)
@@ -1,5 +1,23 @@
 2021-04-21  Don Olmstead  <[email protected]>
 
+        [Python 3] Update gni-to-cmake.py
+        https://bugs.webkit.org/show_bug.cgi?id=224880
+
+        Reviewed by Kenneth Russell.
+
+        Update gni-to-cmake.py to run on Python 3. Added ArgumentParser support to be able to run
+        the script on Windows since the script assumed it would be called through a UNIX style
+        shell.
+
+        Ran the .gni files through the converter to verify output. It appears that the
+        Compiler.cmake file wasn't generated in the last update to ANGLE so it has many changes.
+
+        * Compiler.cmake:
+        * D3D.cmake:
+        * gni-to-cmake.py:
+
+2021-04-21  Don Olmstead  <[email protected]>
+
         [CMake] Add OpenGLES2 targets
         https://bugs.webkit.org/show_bug.cgi?id=224786
 

Modified: trunk/Source/ThirdParty/ANGLE/Compiler.cmake (276389 => 276390)


--- trunk/Source/ThirdParty/ANGLE/Compiler.cmake	2021-04-21 20:53:00 UTC (rev 276389)
+++ trunk/Source/ThirdParty/ANGLE/Compiler.cmake	2021-04-21 21:13:41 UTC (rev 276390)
@@ -68,6 +68,8 @@
     "src/compiler/translator/IntermNode.h"
     "src/compiler/translator/IsASTDepthBelowLimit.cpp"
     "src/compiler/translator/IsASTDepthBelowLimit.h"
+    "src/compiler/translator/tree_ops/NameNamelessUniformBuffers.h"
+    "src/compiler/translator/tree_ops/NameNamelessUniformBuffers.cpp"
     "src/compiler/translator/Operator.cpp"
     "src/compiler/translator/Operator.h"
     "src/compiler/translator/OutputTree.cpp"
@@ -212,6 +214,7 @@
     "src/compiler/translator/tree_ops/UseInterfaceBlockFields.h"
     "src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.cpp"
     "src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h"
+    "src/compiler/translator/tree_util/AsNode.h"
     "src/compiler/translator/tree_util/BuiltIn.h"
     "src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h"
     "src/compiler/translator/tree_util/BuiltIn_complete_autogen.h"
@@ -225,6 +228,8 @@
     "src/compiler/translator/tree_util/IntermNodePatternMatcher.h"
     "src/compiler/translator/tree_util/IntermNode_util.cpp"
     "src/compiler/translator/tree_util/IntermNode_util.h"
+    "src/compiler/translator/tree_util/IntermRebuild.cpp"
+    "src/compiler/translator/tree_util/IntermRebuild.h"
     "src/compiler/translator/tree_util/IntermTraverse.cpp"
     "src/compiler/translator/tree_util/IntermTraverse.h"
     "src/compiler/translator/tree_util/NodeSearch.h"
@@ -336,6 +341,73 @@
     "src/compiler/translator/OutputVulkanGLSLForMetal.mm"
     "src/compiler/translator/TranslatorMetal.cpp"
     "src/compiler/translator/TranslatorMetal.h"
+    "src/compiler/translator/TranslatorMetalDirect.cpp"
+    "src/compiler/translator/TranslatorMetalDirect.h"
+    "src/compiler/translator/TranslatorMetalDirect/AddExplicitTypeCasts.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/AddExplicitTypeCasts.h"
+    "src/compiler/translator/TranslatorMetalDirect/AstHelpers.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/AstHelpers.h"
+    "src/compiler/translator/TranslatorMetalDirect/ConstantNames.h"
+    "src/compiler/translator/TranslatorMetalDirect/Debug.h"
+    "src/compiler/translator/TranslatorMetalDirect/DebugSink.h"
+    "src/compiler/translator/TranslatorMetalDirect/DiscoverDependentFunctions.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/DiscoverDependentFunctions.h"
+    "src/compiler/translator/TranslatorMetalDirect/DiscoverEnclosingFunctionTraverser.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/DiscoverEnclosingFunctionTraverser.h"
+    "src/compiler/translator/TranslatorMetalDirect/EmitMetal.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/EmitMetal.h"
+    "src/compiler/translator/TranslatorMetalDirect/EnvironmentVariable.h"
+    "src/compiler/translator/TranslatorMetalDirect/HoistConstants.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/HoistConstants.h"
+    "src/compiler/translator/TranslatorMetalDirect/IdGen.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/IdGen.h"
+    "src/compiler/translator/TranslatorMetalDirect/Layout.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/Layout.h"
+    "src/compiler/translator/TranslatorMetalDirect/MapFunctionsToDefinitions.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/MapFunctionsToDefinitions.h"
+    "src/compiler/translator/TranslatorMetalDirect/MapSymbols.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/MapSymbols.h"
+    "src/compiler/translator/TranslatorMetalDirect/ModifyStruct.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/ModifyStruct.h"
+    "src/compiler/translator/TranslatorMetalDirect/Name.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/Name.h"
+    "src/compiler/translator/TranslatorMetalDirect/NodeType.h"
+    "src/compiler/translator/TranslatorMetalDirect/Pipeline.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/Pipeline.h"
+    "src/compiler/translator/TranslatorMetalDirect/ProgramPrelude.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/ProgramPrelude.h"
+    "src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/ReduceInterfaceBlocks.h"
+    "src/compiler/translator/TranslatorMetalDirect/Reference.h"
+    "src/compiler/translator/TranslatorMetalDirect/RewriteCaseDeclarations.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/RewriteCaseDeclarations.h"
+    "src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/RewriteGlobalQualifierDecls.h"
+    "src/compiler/translator/TranslatorMetalDirect/RewriteKeywords.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/RewriteKeywords.h"
+    "src/compiler/translator/TranslatorMetalDirect/RewriteOutArgs.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/RewriteOutArgs.h"
+    "src/compiler/translator/TranslatorMetalDirect/RewritePipelines.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/RewritePipelines.h"
+    "src/compiler/translator/TranslatorMetalDirect/RewriteUnaddressableReferences.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/RewriteUnaddressableReferences.h"
+    "src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/SeparateCompoundExpressions.h"
+    "src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/SeparateCompoundStructDeclarations.h"
+    "src/compiler/translator/TranslatorMetalDirect/SkippingTraverser.h"
+    "src/compiler/translator/TranslatorMetalDirect/SymbolEnv.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/SymbolEnv.h"
+    "src/compiler/translator/TranslatorMetalDirect/ToposortStructs.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/ToposortStructs.h"
+    "src/compiler/translator/TranslatorMetalDirect/WrapMain.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/WrapMain.h"
+    "src/compiler/translator/TranslatorMetalDirect/TransposeRowMajorMatrices.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/TransposeRowMajorMatrices.h"
+    "src/compiler/translator/TranslatorMetalDirect/IntroduceVertexIndexID.cpp"
+    "src/compiler/translator/TranslatorMetalDirect/IntroduceVertexIndexID.h"
+    "src/compiler/translator/TranslatorMetalUtils.cpp"
+    "src/compiler/translator/TranslatorMetalUtils.h"
 )
 
 

Modified: trunk/Source/ThirdParty/ANGLE/D3D.cmake (276389 => 276390)


--- trunk/Source/ThirdParty/ANGLE/D3D.cmake	2021-04-21 20:53:00 UTC (rev 276389)
+++ trunk/Source/ThirdParty/ANGLE/D3D.cmake	2021-04-21 21:13:41 UTC (rev 276390)
@@ -1,5 +1,5 @@
 # This file was generated with the command:
-# "./gni-to-cmake.py" "src/libANGLE/renderer/d3d/BUILD.gn" "D3D.cmake" "src/libANGLE/renderer/d3d/"
+# "./gni-to-cmake.py" "src/libANGLE/renderer/d3d/BUILD.gn" "D3D.cmake" "--prepend" "src/libANGLE/renderer/d3d/"
 
 # Copyright 2020 The ANGLE Project Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be

Modified: trunk/Source/ThirdParty/ANGLE/gni-to-cmake.py (276389 => 276390)


--- trunk/Source/ThirdParty/ANGLE/gni-to-cmake.py	2021-04-21 20:53:00 UTC (rev 276389)
+++ trunk/Source/ThirdParty/ANGLE/gni-to-cmake.py	2021-04-21 21:13:41 UTC (rev 276390)
@@ -1,7 +1,9 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
+import re
 import sys
-import re
 
+from argparse import ArgumentParser
+
 # This is a very dumb regex based method of translating from
 # gn variable declarations and simple if statements to the
 # equivalent cmake code. It only supports a few constructs and
@@ -13,58 +15,57 @@
 # are added to the ANGLE gn files, hopefully we can just add
 # a few extra regexes here.
 
-if len(sys.argv) != 4:
-    sys.stderr.write('Error: wrong number of arguments.\n\n')
-    sys.stderr.write('Three arguments are required. The first argument is the path\n')
-    sys.stderr.write('of the input .gni file. The second argument is the path of\n')
-    sys.stderr.write('the output .cmake file. The third argument is a path to prepend\n')
-    sys.stderr.write('to each file name (can be the empty string).\n')
-    exit(1)
+parser = ArgumentParser(prog='gni-to-cmake', description='converts a .gni file to .cmake', usage='%(prog)s [options]')
+parser.add_argument('gni', help='the .gni file to parse')
+parser.add_argument('cmake', help='the .cmake file to output')
+parser.add_argument('--prepend', default='', help='the path to prepend to each file name')
 
-file = open(sys.argv[1], 'rb').read()
+args = parser.parse_args()
 
-# Prepend path to every string.
-file = re.sub(r'"((\\\"|[^"])+)"', '"' + sys.argv[3] + r'\1"', file)
+with open(args.gni, 'r', encoding="utf-8") as gni:
+    file = gni.read()
 
-# Remove import, assert, config, and angle_source_set statements.
-file = re.sub(r'^\s*(import|assert|config|angle_source_set)\([^)]+\)( {.*})?$', r'', file, flags=re.MULTILINE|re.DOTALL)
+    # Prepend path to every string.
+    file = re.sub(r'"((\\\"|[^"])+)"', '"' + args.prepend + r'\1"', file)
 
-# Translate gn single line list declaration:
-file = re.sub(r'\[ ((?:"[^"]*",? )*)\]$', r' \1)', file, flags=re.MULTILINE)
+    # Remove import, assert, config, and angle_source_set statements.
+    file = re.sub(r'^\s*(import|assert|config|angle_source_set)\([^)]+\)( {.*})?$', r'', file, flags=re.MULTILINE|re.DOTALL)
 
-# Translate gn single line list append:
-file = re.sub(r'^(\s*)(\w+) \+= (\w+)$', r'\1 set(\2, "${\2};${\3}")', file, flags=re.MULTILINE)
+    # Translate gn single line list declaration:
+    file = re.sub(r'\[ ((?:"[^"]*",? )*)\]$', r' \1)', file, flags=re.MULTILINE)
 
-# Translate gn list declaration:
-# variable_name = [
-#   "file/name/foo.cpp",
-# ]
-# to cmake list declaration:
-# set(variable_name
-#     "file/name/foo.cpp"
-# )
-file = re.sub(r'^(\s*)(\w+) = ?\[?', r'\1\1set(\2', file, flags=re.MULTILINE)
-file = re.sub(r'^(\s*)("[^"]+"),$', r'\1\1\2', file, flags=re.MULTILINE)
-file = re.sub(r'^(\s*)]$', r'\1\1)', file, flags=re.MULTILINE)
+    # Translate gn single line list append:
+    file = re.sub(r'^(\s*)(\w+) \+= (\w+)$', r'\1 set(\2, "${\2};${\3}")', file, flags=re.MULTILINE)
 
-# Translate list append fom gn to cmake
-file = re.sub(r'^(\s*)(\w+) \+= ?\[?', r'\1\1list(APPEND \2', file, flags=re.MULTILINE)
+    # Translate gn list declaration:
+    # variable_name = [
+    #   "file/name/foo.cpp",
+    # ]
+    # to cmake list declaration:
+    # set(variable_name
+    #     "file/name/foo.cpp"
+    # )
+    file = re.sub(r'^(\s*)(\w+) = ?\[?', r'\1\1set(\2', file, flags=re.MULTILINE)
+    file = re.sub(r'^(\s*)("[^"]+"),$', r'\1\1\2', file, flags=re.MULTILINE)
+    file = re.sub(r'^(\s*)]$', r'\1\1)', file, flags=re.MULTILINE)
 
-# Translate if statements from gn to cmake
-file = re.sub(r'^(\s*)((?:} else )?)if \((.+)\) {$', r'\1\1\2if(\3)', file, flags=re.MULTILINE)
-file = re.sub(r'^} else if$', r'elseif', file, flags=re.MULTILINE)
-file = re.sub(r'^(\s*)} else {$', r'\1\1else()', file, flags=re.MULTILINE)
-file = re.sub(r'^(\s*)}$', r'\1\1endif()', file, flags=re.MULTILINE)
+    # Translate list append fom gn to cmake
+    file = re.sub(r'^(\s*)(\w+) \+= ?\[?', r'\1\1list(APPEND \2', file, flags=re.MULTILINE)
 
-# Translate logic ops from gn to cmake
-file = re.sub(r' \|\| ', r' OR ', file, flags=re.MULTILINE)
-file = re.sub(r' \&\& ', r' AND ', file, flags=re.MULTILINE)
-file = re.sub(r' == ', r' STREQUAL ', file, flags=re.MULTILINE)
-file = re.sub(r'!', r' NOT ', file, flags=re.MULTILINE)
+    # Translate if statements from gn to cmake
+    file = re.sub(r'^(\s*)((?:} else )?)if \((.+)\) {$', r'\1\1\2if(\3)', file, flags=re.MULTILINE)
+    file = re.sub(r'^} else if$', r'elseif', file, flags=re.MULTILINE)
+    file = re.sub(r'^(\s*)} else {$', r'\1\1else()', file, flags=re.MULTILINE)
+    file = re.sub(r'^(\s*)}$', r'\1\1endif()', file, flags=re.MULTILINE)
 
-out = open(sys.argv[2], 'wb')
+    # Translate logic ops from gn to cmake
+    file = re.sub(r' \|\| ', r' OR ', file, flags=re.MULTILINE)
+    file = re.sub(r' \&\& ', r' AND ', file, flags=re.MULTILINE)
+    file = re.sub(r' == ', r' STREQUAL ', file, flags=re.MULTILINE)
+    file = re.sub(r'!', r' NOT ', file, flags=re.MULTILINE)
 
-out.write('# This file was generated with the command:\n')
-out.write('# ' + ' '.join(['"' + arg.replace('"', '\\"') + '"' for arg in sys.argv]))
-out.write('\n\n')
-out.write(file)
+    with open(args.cmake, 'w', encoding="utf-8") as cmake:
+        cmake.write('# This file was generated with the command:\n')
+        cmake.write('# ' + ' '.join(['"' + arg.replace('"', '\\"') + '"' for arg in sys.argv]))
+        cmake.write('\n\n')
+        cmake.write(file)

Modified: trunk/Tools/ChangeLog (276389 => 276390)


--- trunk/Tools/ChangeLog	2021-04-21 20:53:00 UTC (rev 276389)
+++ trunk/Tools/ChangeLog	2021-04-21 21:13:41 UTC (rev 276390)
@@ -1,3 +1,14 @@
+2021-04-21  Don Olmstead  <[email protected]>
+
+        [Python 3] Update gni-to-cmake.py
+        https://bugs.webkit.org/show_bug.cgi?id=224880
+
+        Reviewed by Kenneth Russell.
+
+        Update script to use the `--prepend` argument.
+
+        * Scripts/update-angle:
+
 2021-04-21  Chris Dumez  <[email protected]>
 
         GPUProcess launches unnecessarily when loading the amazon front page

Modified: trunk/Tools/Scripts/update-angle (276389 => 276390)


--- trunk/Tools/Scripts/update-angle	2021-04-21 20:53:00 UTC (rev 276389)
+++ trunk/Tools/Scripts/update-angle	2021-04-21 21:13:41 UTC (rev 276390)
@@ -162,9 +162,9 @@
 
 echo "Translating gni build files to cmake."
 git checkout origin/master -- src/compiler.gni src/libGLESv2.gni src/libANGLE/renderer/d3d/BUILD.gn
-./gni-to-cmake.py src/compiler.gni Compiler.cmake ''
-./gni-to-cmake.py src/libGLESv2.gni GLESv2.cmake ''
-./gni-to-cmake.py src/libANGLE/renderer/d3d/BUILD.gn D3D.cmake 'src/libANGLE/renderer/d3d/'
+./gni-to-cmake.py src/compiler.gni Compiler.cmake
+./gni-to-cmake.py src/libGLESv2.gni GLESv2.cmake
+./gni-to-cmake.py src/libANGLE/renderer/d3d/BUILD.gn D3D.cmake --prepend 'src/libANGLE/renderer/d3d/'
 git checkout src/compiler.gni src/libGLESv2.gni
 
 echo "Moving angle_commit.h into place"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to