PyQt compatible Python wrapping using SIP
[mussa.git] / sip / configure.py
1 #!/usr/bin/python
2 import os
3 import sipconfig
4 from PyQt4 import pyqtconfig
5
6 # The name of the SIP build file generated by SIP and used by the build
7 # system.
8 build_file = "mussamod.sbf"
9
10 # Get the PyQt configuration information.
11 config = pyqtconfig.Configuration()
12
13 # Get the extra SIP flags needed by the imported qt module.  Note that
14 # this normally only includes those flags (-x and -t) that relate to SIP's
15 # versioning system.
16 qt_sip_flags = config.pyqt_sip_flags
17
18 # Run SIP to generate the code.  Note that we tell SIP where to find the qt
19 # module's specification files using the -I flag.
20 os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "-I", config.pyqt_sip_dir, qt_sip_flags, "mussamod.sip"]))
21
22 # We are going to install the SIP specification file for this module and
23 # its configuration module.
24 installs = []
25
26 installs.append(["mussamod.sip", os.path.join(config.default_sip_dir, "mussa")])
27
28 #installs.append(["mussaconfig.py", config.default_mod_dir])
29
30 # Create the Makefile.  The QtModuleMakefile class provided by the
31 # pyqtconfig module takes care of all the extra preprocessor, compiler and
32 # linker flags needed by the Qt library.
33 makefile = pyqtconfig.QtGuiModuleMakefile(
34           configuration=config,
35           build_file=build_file,
36           installs=installs
37       )
38
39 # Add the library we are wrapping.  The name doesn't include any platform
40 # specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
41 # ".dll" extension on Windows).
42 makefile.LFLAGS.append("-L../build/qui")
43 makefile.LFLAGS.append("-L../build/alg")
44 makefile.extra_include_dirs.append("..")
45 makefile.extra_libs = ["mussa_qui", "mussa_core",
46                        "boost_filesystem",
47                        "boost_serialization",
48                        "boost_program_options"]
49
50 # Generate the Makefile itself.
51 makefile.generate()
52
53 # Now we create the configuration module.  This is done by merging a Python
54 # dictionary (whose values are normally determined dynamically) with a
55 # (static) template.
56 #content = {
57 #      # Publish where the SIP specifications for this module will be
58 #      # installed.
59 #  "mussa_sip_dir":    config.default_sip_dir,
60 #
61 #      # Publish the set of SIP flags needed by this module.  As these are the
62 #      # same flags needed by the qt module we could leave it out, but this
63 #      # allows us to change the flags at a later date without breaking
64 #      # scripts that import the configuration module.
65 #  "mussa_sip_flags":  qt_sip_flags
66 #  }
67
68 # This creates the quit_buttonconfig.py module from the quit_buttonconfig.py.in
69 # template and the dictionary.
70 #sipconfig.create_config_module("mussaconfig.py", "mussaconfig.py.in", content)