Corentin Wallez | e7ce4e5 | 2019-11-22 16:13:50 +0100 | [diff] [blame] | 1 | # Copyright 2019 The SwiftShader Authors. All Rights Reserved. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | import argparse, json, sys |
| 16 | |
| 17 | def run(): |
| 18 | parser = argparse.ArgumentParser( |
| 19 | description = "Generates the correct ICD JSON file for swiftshader in GN builds" |
| 20 | ) |
| 21 | parser.add_argument('--input', type=str, help='The template ICD JSON') |
| 22 | parser.add_argument('--output', type=str, help='The output ICD JSON in the GN build dir') |
| 23 | parser.add_argument('--library_path', type=str, help='The file containing a list of directories to check for stale files') |
| 24 | args = parser.parse_args() |
| 25 | |
| 26 | with open(args.input) as infile: |
| 27 | with open(args.output, 'wb') as outfile: |
| 28 | data = json.load(infile) |
| 29 | data['ICD']['library_path'] = args.library_path |
| 30 | json.dump(data, outfile) |
| 31 | |
| 32 | return 0 |
| 33 | |
| 34 | if __name__ == "__main__": |
| 35 | sys.exit(run()) |