| 1 |
# - /usr/bin/env python |
| 2 |
""" |
| 3 |
Reads a list of Z3 API header files and |
| 4 |
generate a ``.def`` file to define the |
| 5 |
exported symbols of a dll. This file |
| 6 |
can be passed to the ``/DEF`` to the |
| 7 |
linker used by MSVC. |
| 8 |
""" |
| 9 |
import mk_genfile_common |
| 10 |
import argparse |
| 11 |
import logging |
| 12 |
import os |
| 13 |
import sys |
| 14 |
|
| 15 |
def main(args): |
| 16 |
logging.basicConfig(level=logging.INFO) |
| 17 |
parser = argparse.ArgumentParser(description=__doc__) |
| 18 |
parser.add_argument("output_file", help="output def file path") |
| 19 |
parser.add_argument("dllname", help="dllname to use in def file") |
| 20 |
parser.add_argument("api_files", nargs="+") |
| 21 |
pargs = parser.parse_args(args) |
| 22 |
|
| 23 |
if not mk_genfile_common.check_files_exist(pargs.api_files): |
| 24 |
logging.error('One or more api files do not exist') |
| 25 |
return 1 |
| 26 |
|
| 27 |
mk_genfile_common.mk_def_file_internal( |
| 28 |
pargs.output_file, |
| 29 |
pargs.dllname, |
| 30 |
pargs.api_files) |
| 31 |
logging.info('Generated "{}"'.format(pargs.output_file)) |
| 32 |
return 0 |
| 33 |
|
| 34 |
if __name__ == '__main__': |
| 35 |
sys.exit(main(sys.argv[1:])) |
| 36 |
|