[0fa325b] | 1 | #! /usr/bin/env python |
---|
| 2 | # encoding: utf-8 |
---|
| 3 | # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file |
---|
| 4 | |
---|
| 5 | try: |
---|
| 6 | from xml.sax import make_parser |
---|
| 7 | from xml.sax.handler import ContentHandler |
---|
| 8 | except ImportError: |
---|
| 9 | has_xml=False |
---|
| 10 | ContentHandler=object |
---|
| 11 | else: |
---|
| 12 | has_xml=True |
---|
| 13 | import os,sys |
---|
| 14 | from waflib.Tools import c_preproc,cxx |
---|
| 15 | from waflib import Task,Utils,Options,Errors |
---|
| 16 | from waflib.TaskGen import feature,after_method,extension |
---|
| 17 | from waflib.Configure import conf |
---|
| 18 | from waflib import Logs |
---|
| 19 | MOC_H=['.h','.hpp','.hxx','.hh'] |
---|
| 20 | EXT_RCC=['.qrc'] |
---|
| 21 | EXT_UI=['.ui'] |
---|
| 22 | EXT_QT4=['.cpp','.cc','.cxx','.C'] |
---|
| 23 | QT4_LIBS="QtCore QtGui QtUiTools QtNetwork QtOpenGL QtSql QtSvg QtTest QtXml QtXmlPatterns QtWebKit Qt3Support QtHelp QtScript QtDeclarative" |
---|
| 24 | class qxx(cxx.cxx): |
---|
| 25 | def __init__(self,*k,**kw): |
---|
| 26 | Task.Task.__init__(self,*k,**kw) |
---|
| 27 | self.moc_done=0 |
---|
| 28 | def scan(self): |
---|
| 29 | (nodes,names)=c_preproc.scan(self) |
---|
| 30 | for x in nodes: |
---|
| 31 | if x.name.endswith('.moc'): |
---|
| 32 | nodes.remove(x) |
---|
| 33 | names.append(x.path_from(self.inputs[0].parent.get_bld())) |
---|
| 34 | return(nodes,names) |
---|
| 35 | def runnable_status(self): |
---|
| 36 | if self.moc_done: |
---|
| 37 | return Task.Task.runnable_status(self) |
---|
| 38 | else: |
---|
| 39 | for t in self.run_after: |
---|
| 40 | if not t.hasrun: |
---|
| 41 | return Task.ASK_LATER |
---|
| 42 | self.add_moc_tasks() |
---|
| 43 | return Task.Task.runnable_status(self) |
---|
| 44 | def add_moc_tasks(self): |
---|
| 45 | node=self.inputs[0] |
---|
| 46 | bld=self.generator.bld |
---|
| 47 | try: |
---|
| 48 | self.signature() |
---|
| 49 | except KeyError: |
---|
| 50 | pass |
---|
| 51 | else: |
---|
| 52 | delattr(self,'cache_sig') |
---|
| 53 | moctasks=[] |
---|
| 54 | mocfiles=[] |
---|
| 55 | try: |
---|
| 56 | tmp_lst=bld.raw_deps[self.uid()] |
---|
| 57 | bld.raw_deps[self.uid()]=[] |
---|
| 58 | except KeyError: |
---|
| 59 | tmp_lst=[] |
---|
| 60 | for d in tmp_lst: |
---|
| 61 | if not d.endswith('.moc'): |
---|
| 62 | continue |
---|
| 63 | if d in mocfiles: |
---|
| 64 | Logs.error("paranoia owns") |
---|
| 65 | continue |
---|
| 66 | mocfiles.append(d) |
---|
| 67 | h_node=None |
---|
| 68 | try:ext=Options.options.qt_header_ext.split() |
---|
| 69 | except AttributeError:pass |
---|
| 70 | if not ext:ext=MOC_H |
---|
| 71 | base2=d[:-4] |
---|
| 72 | for x in[node.parent]+self.generator.includes_nodes: |
---|
| 73 | for e in ext: |
---|
| 74 | h_node=x.find_node(base2+e) |
---|
| 75 | if h_node: |
---|
| 76 | break |
---|
| 77 | if h_node: |
---|
| 78 | m_node=h_node.change_ext('.moc') |
---|
| 79 | break |
---|
| 80 | else: |
---|
| 81 | for k in EXT_QT4: |
---|
| 82 | if base2.endswith(k): |
---|
| 83 | for x in[node.parent]+self.generator.includes_nodes: |
---|
| 84 | h_node=x.find_node(base2) |
---|
| 85 | if h_node: |
---|
| 86 | break |
---|
| 87 | if h_node: |
---|
| 88 | m_node=h_node.change_ext(k+'.moc') |
---|
| 89 | break |
---|
| 90 | if not h_node: |
---|
| 91 | raise Errors.WafError('no header found for %r which is a moc file'%d) |
---|
| 92 | bld.node_deps[(self.inputs[0].parent.abspath(),m_node.name)]=h_node |
---|
| 93 | task=Task.classes['moc'](env=self.env,generator=self.generator) |
---|
| 94 | task.set_inputs(h_node) |
---|
| 95 | task.set_outputs(m_node) |
---|
| 96 | gen=bld.producer |
---|
| 97 | gen.outstanding.insert(0,task) |
---|
| 98 | gen.total+=1 |
---|
| 99 | moctasks.append(task) |
---|
| 100 | tmp_lst=bld.raw_deps[self.uid()]=mocfiles |
---|
| 101 | lst=bld.node_deps.get(self.uid(),()) |
---|
| 102 | for d in lst: |
---|
| 103 | name=d.name |
---|
| 104 | if name.endswith('.moc'): |
---|
| 105 | task=Task.classes['moc'](env=self.env,generator=self.generator) |
---|
| 106 | task.set_inputs(bld.node_deps[(self.inputs[0].parent.abspath(),name)]) |
---|
| 107 | task.set_outputs(d) |
---|
| 108 | gen=bld.producer |
---|
| 109 | gen.outstanding.insert(0,task) |
---|
| 110 | gen.total+=1 |
---|
| 111 | moctasks.append(task) |
---|
| 112 | self.run_after.update(set(moctasks)) |
---|
| 113 | self.moc_done=1 |
---|
| 114 | run=Task.classes['cxx'].__dict__['run'] |
---|
| 115 | class trans_update(Task.Task): |
---|
| 116 | run_str='${QT_LUPDATE} ${SRC} -ts ${TGT}' |
---|
| 117 | color='BLUE' |
---|
| 118 | Task.update_outputs(trans_update) |
---|
| 119 | class XMLHandler(ContentHandler): |
---|
| 120 | def __init__(self): |
---|
| 121 | self.buf=[] |
---|
| 122 | self.files=[] |
---|
| 123 | def startElement(self,name,attrs): |
---|
| 124 | if name=='file': |
---|
| 125 | self.buf=[] |
---|
| 126 | def endElement(self,name): |
---|
| 127 | if name=='file': |
---|
| 128 | self.files.append(str(''.join(self.buf))) |
---|
| 129 | def characters(self,cars): |
---|
| 130 | self.buf.append(cars) |
---|
| 131 | @extension(*EXT_RCC) |
---|
| 132 | def create_rcc_task(self,node): |
---|
| 133 | rcnode=node.change_ext('_rc.cpp') |
---|
| 134 | rcctask=self.create_task('rcc',node,rcnode) |
---|
| 135 | cpptask=self.create_task('cxx',rcnode,rcnode.change_ext('.o')) |
---|
| 136 | try: |
---|
| 137 | self.compiled_tasks.append(cpptask) |
---|
| 138 | except AttributeError: |
---|
| 139 | self.compiled_tasks=[cpptask] |
---|
| 140 | return cpptask |
---|
| 141 | @extension(*EXT_UI) |
---|
| 142 | def create_uic_task(self,node): |
---|
| 143 | uictask=self.create_task('ui4',node) |
---|
| 144 | uictask.outputs=[self.path.find_or_declare(self.env['ui_PATTERN']%node.name[:-3])] |
---|
| 145 | @extension('.ts') |
---|
| 146 | def add_lang(self,node): |
---|
| 147 | self.lang=self.to_list(getattr(self,'lang',[]))+[node] |
---|
| 148 | @feature('qt4') |
---|
| 149 | @after_method('apply_link') |
---|
| 150 | def apply_qt4(self): |
---|
| 151 | if getattr(self,'lang',None): |
---|
| 152 | qmtasks=[] |
---|
| 153 | for x in self.to_list(self.lang): |
---|
| 154 | if isinstance(x,str): |
---|
| 155 | x=self.path.find_resource(x+'.ts') |
---|
| 156 | qmtasks.append(self.create_task('ts2qm',x,x.change_ext('.qm'))) |
---|
| 157 | if getattr(self,'update',None)and Options.options.trans_qt4: |
---|
| 158 | cxxnodes=[a.inputs[0]for a in self.compiled_tasks]+[a.inputs[0]for a in self.tasks if getattr(a,'inputs',None)and a.inputs[0].name.endswith('.ui')] |
---|
| 159 | for x in qmtasks: |
---|
| 160 | self.create_task('trans_update',cxxnodes,x.inputs) |
---|
| 161 | if getattr(self,'langname',None): |
---|
| 162 | qmnodes=[x.outputs[0]for x in qmtasks] |
---|
| 163 | rcnode=self.langname |
---|
| 164 | if isinstance(rcnode,str): |
---|
| 165 | rcnode=self.path.find_or_declare(rcnode+'.qrc') |
---|
| 166 | t=self.create_task('qm2rcc',qmnodes,rcnode) |
---|
| 167 | k=create_rcc_task(self,t.outputs[0]) |
---|
| 168 | self.link_task.inputs.append(k.outputs[0]) |
---|
| 169 | lst=[] |
---|
| 170 | for flag in self.to_list(self.env['CXXFLAGS']): |
---|
| 171 | if len(flag)<2:continue |
---|
| 172 | f=flag[0:2] |
---|
| 173 | if f in['-D','-I','/D','/I']: |
---|
| 174 | if(f[0]=='/'): |
---|
| 175 | lst.append('-'+flag[1:]) |
---|
| 176 | else: |
---|
| 177 | lst.append(flag) |
---|
| 178 | self.env['MOC_FLAGS']=lst |
---|
| 179 | @extension(*EXT_QT4) |
---|
| 180 | def cxx_hook(self,node): |
---|
| 181 | return self.create_compiled_task('qxx',node) |
---|
| 182 | class rcc(Task.Task): |
---|
| 183 | color='BLUE' |
---|
| 184 | run_str='${QT_RCC} -name ${SRC[0].name} ${SRC[0].abspath()} ${RCC_ST} -o ${TGT}' |
---|
| 185 | ext_out=['.h'] |
---|
| 186 | def scan(self): |
---|
| 187 | node=self.inputs[0] |
---|
| 188 | if not has_xml: |
---|
| 189 | Logs.error('no xml support was found, the rcc dependencies will be incomplete!') |
---|
| 190 | return([],[]) |
---|
| 191 | parser=make_parser() |
---|
| 192 | curHandler=XMLHandler() |
---|
| 193 | parser.setContentHandler(curHandler) |
---|
| 194 | fi=open(self.inputs[0].abspath(),'r') |
---|
| 195 | try: |
---|
| 196 | parser.parse(fi) |
---|
| 197 | finally: |
---|
| 198 | fi.close() |
---|
| 199 | nodes=[] |
---|
| 200 | names=[] |
---|
| 201 | root=self.inputs[0].parent |
---|
| 202 | for x in curHandler.files: |
---|
| 203 | nd=root.find_resource(x) |
---|
| 204 | if nd:nodes.append(nd) |
---|
| 205 | else:names.append(x) |
---|
| 206 | return(nodes,names) |
---|
| 207 | class moc(Task.Task): |
---|
| 208 | color='BLUE' |
---|
| 209 | run_str='${QT_MOC} ${MOC_FLAGS} ${MOCCPPPATH_ST:INCPATHS} ${MOCDEFINES_ST:DEFINES} ${SRC} ${MOC_ST} ${TGT}' |
---|
| 210 | class ui4(Task.Task): |
---|
| 211 | color='BLUE' |
---|
| 212 | run_str='${QT_UIC} ${SRC} -o ${TGT}' |
---|
| 213 | ext_out=['.h'] |
---|
| 214 | class ts2qm(Task.Task): |
---|
| 215 | color='BLUE' |
---|
| 216 | run_str='${QT_LRELEASE} ${QT_LRELEASE_FLAGS} ${SRC} -qm ${TGT}' |
---|
| 217 | class qm2rcc(Task.Task): |
---|
| 218 | color='BLUE' |
---|
| 219 | after='ts2qm' |
---|
| 220 | def run(self): |
---|
| 221 | txt='\n'.join(['<file>%s</file>'%k.path_from(self.outputs[0].parent)for k in self.inputs]) |
---|
| 222 | code='<!DOCTYPE RCC><RCC version="1.0">\n<qresource>\n%s\n</qresource>\n</RCC>'%txt |
---|
| 223 | self.outputs[0].write(code) |
---|
| 224 | def configure(self): |
---|
| 225 | self.find_qt4_binaries() |
---|
| 226 | self.set_qt4_libs_to_check() |
---|
| 227 | self.find_qt4_libraries() |
---|
| 228 | self.add_qt4_rpath() |
---|
| 229 | self.simplify_qt4_libs() |
---|
| 230 | @conf |
---|
| 231 | def find_qt4_binaries(self): |
---|
| 232 | env=self.env |
---|
| 233 | opt=Options.options |
---|
| 234 | qtdir=getattr(opt,'qtdir','') |
---|
| 235 | qtbin=getattr(opt,'qtbin','') |
---|
| 236 | paths=[] |
---|
| 237 | if qtdir: |
---|
| 238 | qtbin=os.path.join(qtdir,'bin') |
---|
| 239 | if not qtdir: |
---|
| 240 | qtdir=os.environ.get('QT4_ROOT','') |
---|
| 241 | qtbin=os.environ.get('QT4_BIN',None)or os.path.join(qtdir,'bin') |
---|
| 242 | if qtbin: |
---|
| 243 | paths=[qtbin] |
---|
| 244 | if not qtdir: |
---|
| 245 | paths=os.environ.get('PATH','').split(os.pathsep) |
---|
| 246 | paths.append('/usr/share/qt4/bin/') |
---|
| 247 | try: |
---|
| 248 | lst=Utils.listdir('/usr/local/Trolltech/') |
---|
| 249 | except OSError: |
---|
| 250 | pass |
---|
| 251 | else: |
---|
| 252 | if lst: |
---|
| 253 | lst.sort() |
---|
| 254 | lst.reverse() |
---|
| 255 | qtdir='/usr/local/Trolltech/%s/'%lst[0] |
---|
| 256 | qtbin=os.path.join(qtdir,'bin') |
---|
| 257 | paths.append(qtbin) |
---|
| 258 | cand=None |
---|
| 259 | prev_ver=['4','0','0'] |
---|
| 260 | for qmk in['qmake-qt4','qmake4','qmake']: |
---|
| 261 | try: |
---|
| 262 | qmake=self.find_program(qmk,path_list=paths) |
---|
| 263 | except self.errors.ConfigurationError: |
---|
| 264 | pass |
---|
| 265 | else: |
---|
| 266 | try: |
---|
| 267 | version=self.cmd_and_log([qmake,'-query','QT_VERSION']).strip() |
---|
| 268 | except self.errors.WafError: |
---|
| 269 | pass |
---|
| 270 | else: |
---|
| 271 | if version: |
---|
| 272 | new_ver=version.split('.') |
---|
| 273 | if new_ver>prev_ver: |
---|
| 274 | cand=qmake |
---|
| 275 | prev_ver=new_ver |
---|
| 276 | if cand: |
---|
| 277 | self.env.QMAKE=cand |
---|
| 278 | else: |
---|
| 279 | self.fatal('Could not find qmake for qt4') |
---|
| 280 | qtbin=self.cmd_and_log([self.env.QMAKE,'-query','QT_INSTALL_BINS']).strip()+os.sep |
---|
| 281 | def find_bin(lst,var): |
---|
| 282 | if var in env: |
---|
| 283 | return |
---|
| 284 | for f in lst: |
---|
| 285 | try: |
---|
| 286 | ret=self.find_program(f,path_list=paths) |
---|
| 287 | except self.errors.ConfigurationError: |
---|
| 288 | pass |
---|
| 289 | else: |
---|
| 290 | env[var]=ret |
---|
| 291 | break |
---|
| 292 | find_bin(['uic-qt3','uic3'],'QT_UIC3') |
---|
| 293 | find_bin(['uic-qt4','uic'],'QT_UIC') |
---|
| 294 | if not env['QT_UIC']: |
---|
| 295 | self.fatal('cannot find the uic compiler for qt4') |
---|
| 296 | try: |
---|
| 297 | uicver=self.cmd_and_log(env['QT_UIC']+" -version 2>&1").strip() |
---|
| 298 | except self.errors.ConfigurationError: |
---|
| 299 | self.fatal('this uic compiler is for qt3, add uic for qt4 to your path') |
---|
| 300 | uicver=uicver.replace('Qt User Interface Compiler ','').replace('User Interface Compiler for Qt','') |
---|
| 301 | self.msg('Checking for uic version','%s'%uicver) |
---|
| 302 | if uicver.find(' 3.')!=-1: |
---|
| 303 | self.fatal('this uic compiler is for qt3, add uic for qt4 to your path') |
---|
| 304 | find_bin(['moc-qt4','moc'],'QT_MOC') |
---|
| 305 | find_bin(['rcc'],'QT_RCC') |
---|
| 306 | find_bin(['lrelease-qt4','lrelease'],'QT_LRELEASE') |
---|
| 307 | find_bin(['lupdate-qt4','lupdate'],'QT_LUPDATE') |
---|
| 308 | env['UIC3_ST']='%s -o %s' |
---|
| 309 | env['UIC_ST']='%s -o %s' |
---|
| 310 | env['MOC_ST']='-o' |
---|
| 311 | env['ui_PATTERN']='ui_%s.h' |
---|
| 312 | env['QT_LRELEASE_FLAGS']=['-silent'] |
---|
| 313 | env.MOCCPPPATH_ST='-I%s' |
---|
| 314 | env.MOCDEFINES_ST='-D%s' |
---|
| 315 | @conf |
---|
| 316 | def find_qt4_libraries(self): |
---|
| 317 | qtlibs=getattr(Options.options,'qtlibs',None)or os.environ.get("QT4_LIBDIR",None) |
---|
| 318 | if not qtlibs: |
---|
| 319 | try: |
---|
| 320 | qtlibs=self.cmd_and_log([self.env.QMAKE,'-query','QT_INSTALL_LIBS']).strip() |
---|
| 321 | except Errors.WafError: |
---|
| 322 | qtdir=self.cmd_and_log([self.env.QMAKE,'-query','QT_INSTALL_PREFIX']).strip()+os.sep |
---|
| 323 | qtlibs=os.path.join(qtdir,'lib') |
---|
| 324 | self.msg('Found the Qt4 libraries in',qtlibs) |
---|
| 325 | qtincludes=os.environ.get("QT4_INCLUDES",None)or self.cmd_and_log([self.env.QMAKE,'-query','QT_INSTALL_HEADERS']).strip() |
---|
| 326 | env=self.env |
---|
| 327 | if not'PKG_CONFIG_PATH'in os.environ: |
---|
| 328 | os.environ['PKG_CONFIG_PATH']='%s:%s/pkgconfig:/usr/lib/qt4/lib/pkgconfig:/opt/qt4/lib/pkgconfig:/usr/lib/qt4/lib:/opt/qt4/lib'%(qtlibs,qtlibs) |
---|
| 329 | try: |
---|
| 330 | if os.environ.get("QT4_XCOMPILE",None): |
---|
| 331 | raise self.errors.ConfigurationError() |
---|
| 332 | self.check_cfg(atleast_pkgconfig_version='0.1') |
---|
| 333 | except self.errors.ConfigurationError: |
---|
| 334 | for i in self.qt4_vars: |
---|
| 335 | uselib=i.upper() |
---|
| 336 | if Utils.unversioned_sys_platform()=="darwin": |
---|
| 337 | frameworkName=i+".framework" |
---|
| 338 | qtDynamicLib=os.path.join(qtlibs,frameworkName,i) |
---|
| 339 | if os.path.exists(qtDynamicLib): |
---|
| 340 | env.append_unique('FRAMEWORK_'+uselib,i) |
---|
| 341 | self.msg('Checking for %s'%i,qtDynamicLib,'GREEN') |
---|
| 342 | else: |
---|
| 343 | self.msg('Checking for %s'%i,False,'YELLOW') |
---|
| 344 | env.append_unique('INCLUDES_'+uselib,os.path.join(qtlibs,frameworkName,'Headers')) |
---|
| 345 | elif env.DEST_OS!="win32": |
---|
| 346 | qtDynamicLib=os.path.join(qtlibs,"lib"+i+".so") |
---|
| 347 | qtStaticLib=os.path.join(qtlibs,"lib"+i+".a") |
---|
| 348 | if os.path.exists(qtDynamicLib): |
---|
| 349 | env.append_unique('LIB_'+uselib,i) |
---|
| 350 | self.msg('Checking for %s'%i,qtDynamicLib,'GREEN') |
---|
| 351 | elif os.path.exists(qtStaticLib): |
---|
| 352 | env.append_unique('LIB_'+uselib,i) |
---|
| 353 | self.msg('Checking for %s'%i,qtStaticLib,'GREEN') |
---|
| 354 | else: |
---|
| 355 | self.msg('Checking for %s'%i,False,'YELLOW') |
---|
| 356 | env.append_unique('LIBPATH_'+uselib,qtlibs) |
---|
| 357 | env.append_unique('INCLUDES_'+uselib,qtincludes) |
---|
| 358 | env.append_unique('INCLUDES_'+uselib,os.path.join(qtincludes,i)) |
---|
| 359 | else: |
---|
| 360 | for k in("lib%s.a","lib%s4.a","%s.lib","%s4.lib"): |
---|
| 361 | lib=os.path.join(qtlibs,k%i) |
---|
| 362 | if os.path.exists(lib): |
---|
| 363 | env.append_unique('LIB_'+uselib,i+k[k.find("%s")+2:k.find('.')]) |
---|
| 364 | self.msg('Checking for %s'%i,lib,'GREEN') |
---|
| 365 | break |
---|
| 366 | else: |
---|
| 367 | self.msg('Checking for %s'%i,False,'YELLOW') |
---|
| 368 | env.append_unique('LIBPATH_'+uselib,qtlibs) |
---|
| 369 | env.append_unique('INCLUDES_'+uselib,qtincludes) |
---|
| 370 | env.append_unique('INCLUDES_'+uselib,os.path.join(qtincludes,i)) |
---|
| 371 | uselib=i.upper()+"_debug" |
---|
| 372 | for k in("lib%sd.a","lib%sd4.a","%sd.lib","%sd4.lib"): |
---|
| 373 | lib=os.path.join(qtlibs,k%i) |
---|
| 374 | if os.path.exists(lib): |
---|
| 375 | env.append_unique('LIB_'+uselib,i+k[k.find("%s")+2:k.find('.')]) |
---|
| 376 | self.msg('Checking for %s'%i,lib,'GREEN') |
---|
| 377 | break |
---|
| 378 | else: |
---|
| 379 | self.msg('Checking for %s'%i,False,'YELLOW') |
---|
| 380 | env.append_unique('LIBPATH_'+uselib,qtlibs) |
---|
| 381 | env.append_unique('INCLUDES_'+uselib,qtincludes) |
---|
| 382 | env.append_unique('INCLUDES_'+uselib,os.path.join(qtincludes,i)) |
---|
| 383 | else: |
---|
| 384 | for i in self.qt4_vars_debug+self.qt4_vars: |
---|
| 385 | self.check_cfg(package=i,args='--cflags --libs',mandatory=False) |
---|
| 386 | @conf |
---|
| 387 | def simplify_qt4_libs(self): |
---|
| 388 | env=self.env |
---|
| 389 | def process_lib(vars_,coreval): |
---|
| 390 | for d in vars_: |
---|
| 391 | var=d.upper() |
---|
| 392 | if var=='QTCORE': |
---|
| 393 | continue |
---|
| 394 | value=env['LIBPATH_'+var] |
---|
| 395 | if value: |
---|
| 396 | core=env[coreval] |
---|
| 397 | accu=[] |
---|
| 398 | for lib in value: |
---|
| 399 | if lib in core: |
---|
| 400 | continue |
---|
| 401 | accu.append(lib) |
---|
| 402 | env['LIBPATH_'+var]=accu |
---|
| 403 | process_lib(self.qt4_vars,'LIBPATH_QTCORE') |
---|
| 404 | process_lib(self.qt4_vars_debug,'LIBPATH_QTCORE_DEBUG') |
---|
| 405 | @conf |
---|
| 406 | def add_qt4_rpath(self): |
---|
| 407 | env=self.env |
---|
| 408 | if Options.options.want_rpath: |
---|
| 409 | def process_rpath(vars_,coreval): |
---|
| 410 | for d in vars_: |
---|
| 411 | var=d.upper() |
---|
| 412 | value=env['LIBPATH_'+var] |
---|
| 413 | if value: |
---|
| 414 | core=env[coreval] |
---|
| 415 | accu=[] |
---|
| 416 | for lib in value: |
---|
| 417 | if var!='QTCORE': |
---|
| 418 | if lib in core: |
---|
| 419 | continue |
---|
| 420 | accu.append('-Wl,--rpath='+lib) |
---|
| 421 | env['RPATH_'+var]=accu |
---|
| 422 | process_rpath(self.qt4_vars,'LIBPATH_QTCORE') |
---|
| 423 | process_rpath(self.qt4_vars_debug,'LIBPATH_QTCORE_DEBUG') |
---|
| 424 | @conf |
---|
| 425 | def set_qt4_libs_to_check(self): |
---|
| 426 | if not hasattr(self,'qt4_vars'): |
---|
| 427 | self.qt4_vars=QT4_LIBS |
---|
| 428 | self.qt4_vars=Utils.to_list(self.qt4_vars) |
---|
| 429 | if not hasattr(self,'qt4_vars_debug'): |
---|
| 430 | self.qt4_vars_debug=[a+'_debug'for a in self.qt4_vars] |
---|
| 431 | self.qt4_vars_debug=Utils.to_list(self.qt4_vars_debug) |
---|
| 432 | def options(opt): |
---|
| 433 | opt.add_option('--want-rpath',action='store_true',default=False,dest='want_rpath',help='enable the rpath for qt libraries') |
---|
| 434 | opt.add_option('--header-ext',type='string',default='',help='header extension for moc files',dest='qt_header_ext') |
---|
| 435 | for i in'qtdir qtbin qtlibs'.split(): |
---|
| 436 | opt.add_option('--'+i,type='string',default='',dest=i) |
---|
| 437 | opt.add_option('--translate',action="store_true",help="collect translation strings",dest="trans_qt4",default=False) |
---|