2009-05-02 18:26:40 -04:00
|
|
|
import optparse
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import string
|
2009-07-17 14:39:26 -04:00
|
|
|
import types
|
|
|
|
|
|
|
|
import c_tools
|
|
|
|
import doxymlparser
|
2009-05-02 19:07:51 -04:00
|
|
|
import sip_tools
|
|
|
|
import swig_tools
|
2009-05-02 18:26:40 -04:00
|
|
|
|
2009-05-02 19:07:51 -04:00
|
|
|
from common import *
|
|
|
|
|
2009-07-17 14:39:26 -04:00
|
|
|
if __name__ == "__main__":
|
|
|
|
option_dict = {
|
|
|
|
"output_dir" : ("output", "Directory to output bindings to"),
|
|
|
|
"sip" : (True, "Produce SIP bindings"),
|
|
|
|
"swig" : (True, "Produce SWIG bindings."),
|
|
|
|
"c" : (True, "Produce C wrappers."),
|
|
|
|
|
|
|
|
}
|
2009-05-02 18:26:40 -04:00
|
|
|
|
2009-07-17 14:39:26 -04:00
|
|
|
parser = optparse.OptionParser(usage="usage: %prog <doxyml files to parse>\n" , version="%prog 1.0")
|
|
|
|
|
|
|
|
for opt in option_dict:
|
|
|
|
default = option_dict[opt][0]
|
|
|
|
|
|
|
|
action = "store"
|
|
|
|
if type(default) == types.BooleanType:
|
|
|
|
action = "store_true"
|
|
|
|
parser.add_option("--" + opt, default=default, action=action, dest=opt, help=option_dict[opt][1])
|
|
|
|
|
|
|
|
options, arguments = parser.parse_args()
|
2009-05-02 18:26:40 -04:00
|
|
|
|
|
|
|
if len(arguments) < 1:
|
|
|
|
parser.print_usage()
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
doxyparse = doxymlparser.DoxyMLParser()
|
|
|
|
for arg in arguments:
|
|
|
|
doxyparse.parse(arg)
|
|
|
|
|
|
|
|
if options.sip:
|
2009-05-02 19:07:51 -04:00
|
|
|
builder = sip_tools.SIPBuilder(doxyparse, options.output_dir)
|
2009-05-02 18:26:40 -04:00
|
|
|
builder.make_bindings()
|
|
|
|
|
|
|
|
if options.swig:
|
2009-05-02 19:07:51 -04:00
|
|
|
builder = swig_tools.SWIGBuilder(doxyparse, options.output_dir)
|
2009-05-02 18:26:40 -04:00
|
|
|
builder.make_bindings()
|
2009-07-17 14:39:26 -04:00
|
|
|
|
|
|
|
if options.c:
|
|
|
|
builder = c_tools.CBuilder(doxyparse, options.output_dir)
|
|
|
|
builder.make_bindings()
|