Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 1 | # Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. |
| 2 | # |
| 3 | # Use of this source code is governed by a BSD-style license |
| 4 | # that can be found in the LICENSE file in the root of the source |
| 5 | # tree. An additional intellectual property rights grant can be found |
| 6 | # in the file PATENTS. All contributing project authors may |
| 7 | # be found in the AUTHORS file in the root of the source tree. |
| 8 | |
| 9 | import argparse |
| 10 | import sys |
| 11 | |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 12 | |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 13 | def GenerateModulemap(): |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 14 | parser = argparse.ArgumentParser(description='Generate modulemap') |
| 15 | parser.add_argument("-o", "--out", type=str, help="Output file.") |
| 16 | parser.add_argument("-n", "--name", type=str, help="Name of binary.") |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 17 | |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 18 | args = parser.parse_args() |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 19 | |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 20 | with open(args.out, "w") as outfile: |
| 21 | module_template = 'framework module %s {\n' \ |
| 22 | ' umbrella header "%s.h"\n' \ |
| 23 | '\n' \ |
| 24 | ' export *\n' \ |
| 25 | ' module * { export * }\n' \ |
| 26 | '}\n' % (args.name, args.name) |
| 27 | outfile.write(module_template) |
| 28 | return 0 |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 29 | |
| 30 | |
| 31 | if __name__ == '__main__': |
Mirko Bonadei | 8cc6695 | 2020-10-30 10:13:45 +0100 | [diff] [blame] | 32 | sys.exit(GenerateModulemap()) |