diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
commit | 48d4a26399959121f33d2bc3bfe51c7827b654fc (patch) | |
tree | 5ae5e6e00d3ba330b7b8be9bc097154b6bc739e8 /parts/appwizard/common/scons/admin/kde.py | |
parent | 7e701ace6592d09e1f2c0cf28c7d6d872d78f4f5 (diff) | |
download | tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.tar.gz tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.zip |
TQt4 port kdevelop
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1236710 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/appwizard/common/scons/admin/kde.py')
-rw-r--r-- | parts/appwizard/common/scons/admin/kde.py | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/parts/appwizard/common/scons/admin/kde.py b/parts/appwizard/common/scons/admin/kde.py index bea63d4e..b0e51997 100644 --- a/parts/appwizard/common/scons/admin/kde.py +++ b/parts/appwizard/common/scons/admin/kde.py @@ -81,7 +81,7 @@ def detect_kde(env): env.Exit(1) env['QTDIR'] = qtdir.strip() - ## Find the necessary programs uic and moc + ## Find the necessary programs uic and tqmoc print "Checking for uic : ", uic = qtdir + "/bin/uic" if os.path.isfile(uic): @@ -99,33 +99,33 @@ def detect_kde(env): env.Exit(1) env['QT_UIC'] = uic - print "Checking for moc : ", - moc = qtdir + "/bin/moc" - if os.path.isfile(moc): - print GREEN + "moc was found as " + moc + NORMAL + print "Checking for tqmoc : ", + tqmoc = qtdir + "/bin/tqmoc" + if os.path.isfile(tqmoc): + print GREEN + "tqmoc was found as " + tqmoc + NORMAL else: - moc = os.popen("which moc 2>/dev/null").read().strip() - if len(moc): - print YELLOW + "moc was found as " + moc + NORMAL - elif os.path.isfile("/usr/share/qt3/bin/moc"): - moc = "/usr/share/qt3/bin/moc" - print YELLOW + "moc was found as " + moc + NORMAL + tqmoc = os.popen("which tqmoc 2>/dev/null").read().strip() + if len(tqmoc): + print YELLOW + "tqmoc was found as " + tqmoc + NORMAL + elif os.path.isfile("/usr/share/qt3/bin/tqmoc"): + tqmoc = "/usr/share/qt3/bin/tqmoc" + print YELLOW + "tqmoc was found as " + tqmoc + NORMAL else: - print RED + "moc was not found - set QTDIR or put it in your PATH ?" + NORMAL + print RED + "tqmoc was not found - set QTDIR or put it in your PATH ?" + NORMAL env.Exit(1) - env['QT_MOC'] = moc + env['QT_TQMOC'] = tqmoc ## check for the qt and kde includes print "Checking for the qt includes : ", - if qtincludes and os.path.isfile(qtincludes + "/qlayout.h"): + if qtincludes and os.path.isfile(qtincludes + "/qtqlayout.h"): # The user told where to look for and it looks valid print GREEN + "ok " + qtincludes + NORMAL else: - if os.path.isfile(qtdir + "/include/qlayout.h"): + if os.path.isfile(qtdir + "/include/qtqlayout.h"): # Automatic detection print GREEN + "ok " + qtdir + "/include/ " + NORMAL qtincludes = qtdir + "/include/" - elif os.path.isfile("/usr/include/qt3/qlayout.h"): + elif os.path.isfile("/usr/include/qt3/qtqlayout.h"): # Debian probably print YELLOW + "the qt headers were found in /usr/include/qt3/ " + NORMAL qtincludes = "/usr/include/qt3" @@ -157,8 +157,8 @@ def detect_kde(env): if not libdir: libdir=execprefix+"/lib"+libsuffix - subst_vars = lambda x: x.replace('${exec_prefix}', execprefix).replace('${datadir}',datadir).replace('${libdir}', libdir) - debian_fix = lambda x: x.replace('/usr/share', '${datadir}') + subst_vars = lambda x: x.tqreplace('${exec_prefix}', execprefix).tqreplace('${datadir}',datadir).tqreplace('${libdir}', libdir) + debian_fix = lambda x: x.tqreplace('/usr/share', '${datadir}') env['KDEBIN'] = subst_vars(os.popen('kde-config --install exe').read().strip()) env['KDEAPPS'] = subst_vars(os.popen('kde-config --install apps').read().strip()) env['KDEDATA'] = subst_vars(os.popen('kde-config --install data').read().strip()) @@ -204,7 +204,7 @@ def detect_kde(env): env['QTLIBPATH']=qtlibs def generate(env): - """"Set up the qt and kde environment and builders - the moc part is difficult to understand """ + """"Set up the qt and kde environment and builders - the tqmoc part is difficult to understand """ if env['HELP']: print """ """+BOLD+"""*** KDE options *** @@ -270,7 +270,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt # The following is kind of hacky to get builders working properly (FIXME) ?? objBuilderEnv = objBuilder.env objBuilder.env = env - mocBuilderEnv = env.Moc.env + tqmocBuilderEnv = env.Moc.env env.Moc.env = env # make a deep copy for the result; MocH objects will be appended @@ -323,22 +323,22 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt if not h and qtdebug: print "scons: qt: no header for '%s'." % (str(cpp)) if h and q_object_search.search(h_contents): - # h file with the Q_OBJECT macro found -> add .moc or _moc.cpp file - moc_cpp = None + # h file with the Q_OBJECT macro found -> add .tqmoc or _tqmoc.cpp file + tqmoc_cpp = None - if env.has_key('NOMOCSCAN'): - moc_cpp = env.Moc(h) + if env.has_key('NOTQMOCSCAN'): + tqmoc_cpp = env.Moc(h) else: - reg = '\n\s*#include\s*("|<)'+splitext(cpp.name)[0]+'.moc("|>)' + reg = '\n\s*#include\s*("|<)'+splitext(cpp.name)[0]+'.tqmoc("|>)' meta_object_search = re.compile(reg) if meta_object_search.search(cpp_contents): - moc_cpp = env.Moc(h) + tqmoc_cpp = env.Moc(h) else: - moc_cpp = env.Moccpp(h) - moc_o = objBuilder(moc_cpp) - out_sources.append(moc_o) + tqmoc_cpp = env.Moccpp(h) + tqmoc_o = objBuilder(tqmoc_cpp) + out_sources.append(tqmoc_o) if qtdebug: - print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp[0])) + print "scons: qt: found Q_OBJECT macro in '%s', tqmoc'ing to '%s'" % (str(h), str(tqmoc_cpp[0])) if cpp and q_object_search.search(cpp_contents): print "error, bksys cannot handle cpp files with Q_OBJECT classes" @@ -347,7 +347,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt # restore the original env attributes (FIXME) objBuilder.env = objBuilderEnv - env.Moc.env = mocBuilderEnv + env.Moc.env = tqmocBuilderEnv return (target, out_sources) @@ -368,8 +368,8 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt ('QTDIR', 'root of qt directory'), ('QTLIBPATH', 'path to the qt libraries'), ('QTINCLUDEPATH', 'path to the qt includes'), - ('QT_UIC', 'moc directory'), - ('QT_MOC', 'moc executable command'), + ('QT_UIC', 'tqmoc directory'), + ('QT_TQMOC', 'tqmoc executable command'), ('QTPLUGINS', 'uic executable command'), ('KDEDIR', 'root of kde directory'), ('KDELIBPATH', 'path to the kde libs'), @@ -412,8 +412,8 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt env['QT_UICIMPLPREFIX'] = '' env['QT_UICIMPLSUFFIX'] = '.cpp' - env['QT_MOCHPREFIX'] = '' - env['QT_MOCHSUFFIX'] = '.moc' + env['QT_TQMOCHPREFIX'] = '' + env['QT_TQMOCHSUFFIX'] = '.tqmoc' env['KDE_KCFG_IMPLPREFIX'] = '' env['KDE_KCFG_IMPL_HSUFFIX'] = '.h' env['KDE_KCFG_IMPL_CSUFFIX'] = '.cpp' @@ -424,10 +424,10 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt ## ui file processing def uic_processing(target, source, env): inc_kde = '#include <klocale.h>\n#include <kdialog.h>\n' - inc_moc = '#include "%s"\n' % target[2].name + inc_tqmoc = '#include "%s"\n' % target[2].name comp_h = '$QT_UIC $QT_UIC_HFLAGS -o %s %s' % (target[0].path, source[0].path) comp_c = '$QT_UIC $QT_UIC_CFLAGS -impl %s %s' % (target[0].path, source[0].path) - comp_moc = '$QT_MOC -o %s %s' % (target[2].path, target[0].path) + comp_tqmoc = '$QT_TQMOC -o %s %s' % (target[2].path, target[0].path) ret = env.Execute(comp_h) if ret: @@ -442,10 +442,10 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt return ret dest = open( target[1].path, "a" ) - dest.write(inc_moc) + dest.write(inc_tqmoc) dest.close() - ret = env.Execute( comp_moc ) + ret = env.Execute( comp_tqmoc ) return ret def uicEmitter(target, source, env): @@ -459,10 +459,10 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt env.subst('$QT_UICIMPLPREFIX'), env.subst('$QT_UICIMPLSUFFIX'))) if len(target) < 3: - # third target is .moc file + # third target is .tqmoc file target.append(adjustixes(bs, - env.subst('$QT_MOCHPREFIX'), - env.subst('$QT_MOCHSUFFIX'))) + env.subst('$QT_TQMOCHPREFIX'), + env.subst('$QT_TQMOCHSUFFIX'))) return target, source UIC_BUILDER = Builder( @@ -471,17 +471,17 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt suffix = '.h', src_suffix = '.ui') - ## moc file processing - env['QT_MOCCOM'] = ('$QT_MOC -o ${TARGETS[0]} $SOURCE') + ## tqmoc file processing + env['QT_TQMOCCOM'] = ('$QT_TQMOC -o ${TARGETS[0]} $SOURCE') - MOC_BUILDER = Builder( - action = '$QT_MOCCOM', - suffix = '.moc', + TQMOC_BUILDER = Builder( + action = '$QT_TQMOCCOM', + suffix = '.tqmoc', src_suffix = '.h') - MOCCPP_BUILDER = Builder( - action = '$QT_MOCCOM', - suffix = '_moc.cpp', + TQMOCCPP_BUILDER = Builder( + action = '$QT_TQMOCCOM', + suffix = '_tqmoc.cpp', src_suffix = '.h') ## kcfg file processing @@ -523,7 +523,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt def dcopGenerator(target, source, env, for_signature): act=[] act.append('dcopidl '+source[0].path+' > '+target[1].path+'|| ( rm -f '+target[1].path+' ; false)') - act.append('dcopidl2cpp --c++-suffix cpp --no-signals --no-stub '+target[1].path) + act.append('dcopidl2cpp --c++-suffix cpp --no-Q_SIGNALS --no-stub '+target[1].path) return act def dcopEmitter(target, source, env): @@ -576,8 +576,8 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt ## register the builders env['BUILDERS']['Uic'] = UIC_BUILDER - env['BUILDERS']['Moc'] = MOC_BUILDER - env['BUILDERS']['Moccpp'] = MOCCPP_BUILDER + env['BUILDERS']['Moc'] = TQMOC_BUILDER + env['BUILDERS']['Moccpp'] = TQMOCCPP_BUILDER env['BUILDERS']['Dcop'] = DCOP_BUILDER env['BUILDERS']['Kcfg'] = KCFG_BUILDER env['BUILDERS']['LaFile'] = LA_BUILDER @@ -596,7 +596,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt static_obj.src_builder.append('Transfiles') shared_obj.src_builder.append('Transfiles') - ## Find the files to moc, dcop, and link against kde and qt + ## Find the files to tqmoc, dcop, and link against kde and qt env.AppendUnique(PROGEMITTER = [MetasourcesStatic], SHLIBEMITTER=[MetasourcesShared], LIBEMITTER =[MetasourcesStatic]) ## Handy helpers for building kde programs @@ -631,9 +631,9 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt if ext in skel_ext: lenv.Dcop(bs+'.h') src.append(bs+'_skel.cpp') - elif ext == ".moch": + elif ext == ".tqmoch": lenv.Moccpp(bs+'.h') - src.append(bs+'_moc.cpp') + src.append(bs+'_tqmoc.cpp') else: src.append(file) |