From 39dd67f22f236d9f962657abe5b619f2b338f2fc Mon Sep 17 00:00:00 2001 From: Tom Tanner Date: Wed, 18 Mar 2015 14:16:04 +0000 Subject: Refactoring and cleanup. --- README.txt | 8 +++++--- src/SConscript | 47 +++++++++++++++++------------------------------ src/shared/SConscript | 15 ++++----------- 3 files changed, 26 insertions(+), 44 deletions(-) diff --git a/README.txt b/README.txt index cbb571c3..7eafff83 100644 --- a/README.txt +++ b/README.txt @@ -243,7 +243,8 @@ Building with scons 2) Download QT4 (and/or QT5) from https://bitbucket.org/dirkbaechle/scons_qt4 and https://bitbucket.org/dirkbaechle/scons_qt5. Install as per instructions 3) Copy scons_configure_template.py to scons_configure.py. Edit to point to your - boost/python/zlib/7zip paths as appropriate + boost/python/zlib/7zip paths as appropriate (you can create an empty one if + you set up the params in qt creator) 4) Create build kits as follows: Custom Process step: Command: \Scripts\scons.bat @@ -259,6 +260,9 @@ Building with scons If you want to do parallel builds, add -j and a number to the arguments. However you may need to install pywin32 (but it seems to work OK for me). + -j 4 did the entire build in 2m 15s. scons uses -Z7 to store debugging + information in the .obj files which removes the issues with multiple + processes attempting to access one datafile. Note. If you want to build a sub project separately, it seems to be better to open the subproject, set that up with the scons kit and build that as a @@ -267,5 +271,3 @@ Building with scons Please note: the generated (runnable) output files end up in the build directory, in the '_ModOrganizer' subdirectory (not at the top level). Named like that so you can see it! - -This isn't complete by any means but.. diff --git a/src/SConscript b/src/SConscript index cb0c1922..2eeb869e 100644 --- a/src/SConscript +++ b/src/SConscript @@ -1,4 +1,5 @@ import os +import subprocess Import('qt_env') @@ -27,23 +28,13 @@ else: 'Declarative' ] -env.EnableQt4Modules(['Qt' + n for n in modules], - debug = env['CONFIG'] == 'debug') +env.EnableQtModules(*modules) -env.Uic4(Glob('*.ui')) +env.Uic4(env.Glob('*.ui')) -env.AppendUnique(LIBPATH = [ - '..\\uibase', - '..\\shared', - '..\\bsatk', - '..\\esptk' -]) +env.RequireLibraries('uibase', 'shared', 'bsatk', 'esptk') env.AppendUnique(LIBS = [ - 'uibase', - 'mo_shared', - 'bsatk', - 'esptk', 'shell32', 'user32', 'ole32', @@ -59,20 +50,14 @@ env.AppendUnique(LIBS = [ other_sources = env.AddExtraMoc(env.Glob('*.h')) for file in env.Glob('*.rc'): - if str(file).endswith('version.rc'): + if file.name == 'version.rc': continue other_sources.append(env.RES(file)) -# FIXME Add the translate in here too - # Note the order of this is important, or you can pick up the wrong report.h... # Doing appendunique seems to throw the moc code into a tizzy env['CPPPATH'] += [ - '../shared', '../archive', - '../uibase', - '../bsatk', - '../esptk', '../boss_modified/boss-api', '.', # Why is this necessary? '${BOOSTPATH}', @@ -89,11 +74,6 @@ env.AppendUnique(CPPDEFINES = [ # 'NDEBUG' ]) -# Umf. This changes everytime you do something with your repository. -# I don't think this is necessary with scons -# hgid = subprocess.check_output(['hg', 'id', '-i']) -# env.AppendUnique(CPPDEFINES = [ 'HGID="%s"' % hgid ]) - env.AppendUnique(CPPFLAGS = [ '-wd4100', '-wd4127', '-wd4512', '-wd4189' ]) env.AppendUnique(LINKFLAGS = [ @@ -102,7 +82,16 @@ env.AppendUnique(LINKFLAGS = [ ]) # modeltest is optional and it doesn't compile anyway... -cpp_files = [ x for x in Glob('*.cpp') if not str(x).endswith('modeltest.cpp') ] +cpp_files = [ + x for x in Glob('*.cpp') + if x.name != 'modeltest.cpp' and x.name != 'aboutdialog.cpp' +] + +about_env = env.Clone() +hgid = subprocess.check_output(['hg', 'id', '-i']).rstrip() +# FIXME: It'd be much easier to stringify this in the source code +about_env.AppendUnique(CPPDEFINES = [ 'HGID=\\"%s\\"' % hgid ]) +other_sources.append(about_env.StaticObject('aboutdialog.cpp')) prog = env.Program('ModOrganizer', cpp_files + env.Glob('*.qrc') + other_sources) @@ -113,6 +102,8 @@ for subdir in ('tutorials', 'stylesheets'): env.Install(os.path.join(env['INSTALL_PATH'], subdir), env.Glob(os.path.join(subdir, '*'))) +# FIXME Sort the translations. Except they don't exist on the 1.2 branch + """ CONFIG(debug, debug|release) { } else { @@ -126,7 +117,3 @@ TRANSLATIONS = organizer_en.ts QMAKE_POST_LINK += xcopy /y /s /I $$quote($$BASEDIR\\*.qm) $$quote($$DSTDIR)\\translations $$escape_expand(\\n) """ - -""" -/IC:\Apps\Qt\4.8.6\include (twice) -""" diff --git a/src/shared/SConscript b/src/shared/SConscript index daf8f2da..35c65d73 100644 --- a/src/shared/SConscript +++ b/src/shared/SConscript @@ -1,18 +1,8 @@ -import os.path - Import('qt_env') env = qt_env.Clone() -modules = [ - 'Core', - 'Gui' -] - -env.EnableQt4Modules(['Qt' + n for n in modules], - debug = env['CONFIG'] == 'debug') - -env.StaticLibrary('mo_shared', env.Glob('*.cpp')) +env.EnableQtModules('Core', 'Gui') env.AppendUnique(CPPDEFINES = [ 'UNICODE', @@ -27,3 +17,6 @@ env.AppendUnique(CPPPATH = [ '${BOOSTPATH}', '.' # Seriously! ]) + +# Not sure if renaming this helps much as it's static +env.StaticLibrary('mo_shared', env.Glob('*.cpp')) -- cgit v1.3.1