mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
Scaffolding for generation of intrinsics files.
This CL sets up the basis for the intrinsic file generation. All of the GN and CMake pieces are setup, but they aren't hooked into the main build yet. That will be a followup which just enables the generation in order to allow easy reverting. Change-Id: Iccac59377076ed6ac66eeaf0be965be2f49bc738 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107981 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
5c5f47afbf
commit
6c5db2afa6
53
generator/tint_gen_template.py
Executable file
53
generator/tint_gen_template.py
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2022 The Dawn Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def run_generator():
|
||||
parser = argparse.ArgumentParser(
|
||||
description=
|
||||
"Tint template generator for GN build. Use tools/run gen for non-GN build.",
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
)
|
||||
parser.add_argument('--output',
|
||||
default='',
|
||||
type=str,
|
||||
help='Base output directory.')
|
||||
parser.add_argument('--template',
|
||||
default='',
|
||||
type=str,
|
||||
help='Template to generate.')
|
||||
args = parser.parse_args()
|
||||
|
||||
root = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
|
||||
go = os.path.join(root, "tools", "golang", "bin", "go")
|
||||
if sys.platform == 'win32':
|
||||
go += '.exe'
|
||||
|
||||
gen = os.path.join(root, "tools", "src", "cmd", "gen")
|
||||
subprocess.check_call(
|
||||
[go, "run", gen, "-o", args.output,
|
||||
os.path.join(root, args.template)],
|
||||
cwd=root)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(run_generator())
|
||||
Reference in New Issue
Block a user