sip_configure.py
Go to the documentation of this file.
00001 import os
00002 import sys
00003 import roslib
00004 import sipconfig
00005 from PyQt4 import pyqtconfig
00006 
00007 if len(sys.argv) != 8:
00008   print 'usage: %s build-dir sip-file output_dir include_dirs libs lib_dirs ldflags' % (sys.argv[0])
00009   exit(1)
00010 
00011 # The SIP build folder, the SIP file, the output directory, the include directories, the libraries, the library directories and the linker flags.
00012 build_dir, sip_file, output_dir, include_dirs, libs, lib_dirs, ldflags = sys.argv[1:]
00013 
00014 # The name of the SIP build file generated by SIP and used by the build system.
00015 build_file = 'pyqtscripting.sbf'
00016 
00017 # Get the PyQt configuration information.
00018 config = pyqtconfig.Configuration()
00019 
00020 # Get the extra SIP flags needed by the imported qt module.  Note that
00021 # this normally only includes those flags (-x and -t) that relate to SIP's
00022 # versioning system.
00023 qt_sip_flags = config.pyqt_sip_flags
00024 
00025 try:
00026   os.makedirs(build_dir)
00027 except OSError:
00028   pass
00029 
00030 # Run SIP to generate the code.  Note that we tell SIP where to find the qt
00031 # module's specification files using the -I flag.
00032 os.system(' '.join([
00033   config.sip_bin,
00034   '-c', build_dir,
00035   '-b', os.path.join(build_dir, build_file),
00036   '-I', config.pyqt_sip_dir,
00037   '-w',
00038   qt_sip_flags,
00039   sip_file
00040 ]))
00041 
00042 # Create the Makefile.  The QtModuleMakefile class provided by the
00043 # pyqtconfig module takes care of all the extra preprocessor, compiler and
00044 # linker flags needed by the Qt library.
00045 makefile = pyqtconfig.QtGuiModuleMakefile(
00046   dir=build_dir,
00047   configuration=config,
00048   build_file=build_file
00049 )
00050 
00051 for include_dir in include_dirs.split(' '):
00052     makefile.extra_include_dirs.append(include_dir)
00053 for lib in libs.split(' '):
00054     makefile.extra_libs.append(lib)
00055 for lib_dir in lib_dirs.split(' '):
00056     makefile.extra_lib_dirs.append(lib_dir)
00057 for ldflag in ldflags.split('\\ '):
00058     makefile.LFLAGS.append(ldflag)
00059 
00060 # redirect location of generated library
00061 makefile._target = os.path.join(output_dir, makefile._target)
00062 
00063 # Generate the Makefile itself
00064 makefile.generate()


python_qt_binding
Author(s): Dave Hershberger, Dirk Thomas
autogenerated on Fri Jan 3 2014 11:44:20