configure.py
Go to the documentation of this file.
00001 import os
00002 import sys
00003 import roslib
00004 import sipconfig
00005 import subprocess
00006 from PyQt4 import pyqtconfig
00007 
00008 if len(sys.argv) != 4:
00009   print 'usage: %s build-dir sip-file output_dir' % (sys.argv[0])
00010   exit(1)
00011 
00012 # The base folder of the c++ library, the SIP build folder, the SIP file and the output directory.
00013 build_dir, sip_file, output_dir = sys.argv[1:]
00014 
00015 # The name of the SIP build file generated by SIP and used by the build system.
00016 build_file = 'pyqtscripting.sbf'
00017 
00018 # Get the PyQt configuration information.
00019 config = pyqtconfig.Configuration()
00020 
00021 # Get the extra SIP flags needed by the imported qt module.  Note that
00022 # this normally only includes those flags (-x and -t) that relate to SIP's
00023 # versioning system.
00024 qt_sip_flags = config.pyqt_sip_flags
00025 
00026 try:
00027   os.makedirs(build_dir)
00028 except OSError:
00029   pass
00030 
00031 # Run SIP to generate the code.  Note that we tell SIP where to find the qt
00032 # module's specification files using the -I flag.
00033 os.system(' '.join([
00034   config.sip_bin,
00035   '-c', build_dir,
00036   '-b', os.path.join(build_dir, build_file),
00037   '-I', config.pyqt_sip_dir,
00038   '-w',
00039   qt_sip_flags,
00040   sip_file
00041 ]))
00042 
00043 # Create the Makefile.  The QtModuleMakefile class provided by the
00044 # pyqtconfig module takes care of all the extra preprocessor, compiler and
00045 # linker flags needed by the Qt library.
00046 makefile = pyqtconfig.QtGuiModuleMakefile(
00047   dir=build_dir,
00048   configuration=config,
00049   build_file=build_file
00050 )
00051 
00052 # for ros diamondback's tinyxml this specific flag is needed
00053 makefile.CXXFLAGS.append('-DTIXML_USE_STL')
00054 
00055 # add ros packages dependencies
00056 cmd = ['rospack', 'cflags-only-I', '--deps-only', 'rviz']
00057 po = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
00058 out,err = po.communicate()
00059 outlist = [x for x in out.strip().split() if x]
00060 makefile.extra_include_dirs.extend(outlist)
00061 
00062 cmd = ['rospack', 'libs-only-L', '--deps-only', 'rviz']
00063 po = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
00064 out,err = po.communicate()
00065 outlist = [x for x in out.strip().split() if x]
00066 makefile.extra_lib_dirs.extend(outlist)
00067 
00068 cmd = ['rospack', 'libs-only-l', '--deps-only', 'rviz']
00069 po = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
00070 out,err = po.communicate()
00071 outlist = [x for x in out.strip().split() if x]
00072 makefile.extra_libs.extend(outlist)
00073 
00074 cmd = ['rospack', 'libs-only-other', '--deps-only', 'rviz']
00075 po = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
00076 out,err = po.communicate()
00077 outlist = [x for x in out.strip().split() if x]
00078 makefile.LFLAGS.extend(outlist)
00079 
00080 # special case for our own code
00081 rviz_package_path = roslib.packages.get_pkg_dir('rviz')
00082 makefile.extra_include_dirs.append(os.path.join(rviz_package_path, 'src'))
00083 
00084 # redirect location of generated library
00085 makefile._target = os.path.join(output_dir, makefile._target)
00086 
00087 # Generate the Makefile itself
00088 makefile.generate()


rviz
Author(s): Dave Hershberger, Josh Faust
autogenerated on Mon Jan 6 2014 11:54:32