From a9cec9e5e230dbd56d62ae6dd517ae10252125ae Mon Sep 17 00:00:00 2001 From: Tom Tanner Date: Fri, 20 Mar 2015 10:34:30 +0000 Subject: Fixed Scons build for existing bits. Changed pynedit.pro to fetch from 'standard' install location Changed saveas code to use organizer report rather than uibase - this way it's not dependant on the vagaries of the include path, and works the same as the rest of the organiser directory --- src/SConscript | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/SConscript') diff --git a/src/SConscript b/src/SConscript index 2eeb869e..3dd5d450 100644 --- a/src/SConscript +++ b/src/SConscript @@ -13,20 +13,16 @@ modules = [ 'Sql', 'WebKit', 'Xml', - 'XmlPatterns' + 'XmlPatterns', + 'Declarative' ] if env['QT_MAJOR_VERSION'] > 4: modules += [ 'Widgets', 'Qml', - 'Quick', 'WebKitWidgets' ] -else: - modules += [ - 'Declarative' - ] env.EnableQtModules(*modules) @@ -34,6 +30,7 @@ env.Uic4(env.Glob('*.ui')) env.RequireLibraries('uibase', 'shared', 'bsatk', 'esptk') + env.AppendUnique(LIBS = [ 'shell32', 'user32', @@ -58,8 +55,10 @@ for file in env.Glob('*.rc'): # Doing appendunique seems to throw the moc code into a tizzy env['CPPPATH'] += [ '../archive', - '../boss_modified/boss-api', +# '../boss_modified/boss-api', + '../plugins/gamefeatures', '.', # Why is this necessary? + '${LOOTPATH}', '${BOOSTPATH}', ] @@ -69,9 +68,7 @@ env.AppendUnique(CPPDEFINES = [ '_SCL_SECURE_NO_WARNINGS', 'NOMINMAX', 'BOOST_DISABLE_ASSERTS', -# Although the .pro file says it adds this, the compile line doesn't seem to -# have it (unless it's in the annoying '@' file -# 'NDEBUG' + 'NDEBUG' ]) env.AppendUnique(CPPFLAGS = [ '-wd4100', '-wd4127', '-wd4512', '-wd4189' ]) @@ -93,6 +90,9 @@ hgid = subprocess.check_output(['hg', 'id', '-i']).rstrip() about_env.AppendUnique(CPPDEFINES = [ 'HGID=\\"%s\\"' % hgid ]) other_sources.append(about_env.StaticObject('aboutdialog.cpp')) +env.AppendUnique(LIBPATH = "${ZLIBPATH}/build") +env.AppendUnique(LIBS = 'zlibstatic') + prog = env.Program('ModOrganizer', cpp_files + env.Glob('*.qrc') + other_sources) @@ -104,6 +104,9 @@ for subdir in ('tutorials', 'stylesheets'): # FIXME Sort the translations. Except they don't exist on the 1.2 branch +res = env['QT_USED_MODULES'] +Return('res') + """ CONFIG(debug, debug|release) { } else { -- cgit v1.3.1 From ea520baf4e4a512744552a8528e3b41145796151 Mon Sep 17 00:00:00 2001 From: Tom Tanner Date: Sun, 22 Mar 2015 10:49:15 +0000 Subject: Fix a meory leak with modules that error during loading More Sconscript stuff --- src/SConscript | 4 ++-- src/plugincontainer.cpp | 4 ++-- src/savegamegamebyro.h | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/SConscript') diff --git a/src/SConscript b/src/SConscript index 3dd5d450..1d69c1d6 100644 --- a/src/SConscript +++ b/src/SConscript @@ -66,9 +66,9 @@ env.AppendUnique(CPPDEFINES = [ '_UNICODE', '_CRT_SECURE_NO_WARNINGS', '_SCL_SECURE_NO_WARNINGS', - 'NOMINMAX', 'BOOST_DISABLE_ASSERTS', - 'NDEBUG' + 'NDEBUG', + 'QT_MESSAGELOGCONTEXT' ]) env.AppendUnique(CPPFLAGS = [ '-wd4100', '-wd4127', '-wd4512', '-wd4189' ]) diff --git a/src/plugincontainer.cpp b/src/plugincontainer.cpp index 6bc9d12b..e1d9d9f0 100644 --- a/src/plugincontainer.cpp +++ b/src/plugincontainer.cpp @@ -266,7 +266,7 @@ void PluginContainer::loadPlugins() loadCheck.flush(); QString pluginName = iter.filePath(); if (QLibrary::isLibrary(pluginName)) { - QPluginLoader *pluginLoader = new QPluginLoader(pluginName, this); + std::unique_ptr pluginLoader(new QPluginLoader(pluginName, this)); if (pluginLoader->instance() == nullptr) { m_FailedPlugins.push_back(pluginName); qCritical("failed to load plugin %s: %s", @@ -274,7 +274,7 @@ void PluginContainer::loadPlugins() } else { if (registerPlugin(pluginLoader->instance(), pluginName)) { qDebug("loaded plugin \"%s\"", qPrintable(pluginName)); - m_PluginLoaders.push_back(pluginLoader); + m_PluginLoaders.push_back(pluginLoader.release()); } else { m_FailedPlugins.push_back(pluginName); qWarning("plugin \"%s\" failed to load", qPrintable(pluginName)); diff --git a/src/savegamegamebyro.h b/src/savegamegamebyro.h index eedda6c2..e08e1044 100644 --- a/src/savegamegamebyro.h +++ b/src/savegamegamebyro.h @@ -22,10 +22,9 @@ along with Mod Organizer. If not, see . #include "savegame.h" -#include + #include #include -#include #include #include -- cgit v1.3.1 From db7c6e6006d8e2607f6bfe2c86fd1247bfe09349 Mon Sep 17 00:00:00 2001 From: Tom Tanner Date: Wed, 25 Mar 2015 22:35:53 +0000 Subject: Add in all the necessary stuff for scons --- src/SConscript | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/SConscript') diff --git a/src/SConscript b/src/SConscript index 1d69c1d6..a904f25f 100644 --- a/src/SConscript +++ b/src/SConscript @@ -26,7 +26,7 @@ if env['QT_MAJOR_VERSION'] > 4: env.EnableQtModules(*modules) -env.Uic4(env.Glob('*.ui')) +env.Uic(env.Glob('*.ui')) env.RequireLibraries('uibase', 'shared', 'bsatk', 'esptk') @@ -47,6 +47,7 @@ env.AppendUnique(LIBS = [ other_sources = env.AddExtraMoc(env.Glob('*.h')) for file in env.Glob('*.rc'): + # version.rc is included in app_icon.rc. Not sure why it's a separate file. if file.name == 'version.rc': continue other_sources.append(env.RES(file)) -- cgit v1.3.1 From 04b6f2e47554357641038d79b5c23df5e0e5745c Mon Sep 17 00:00:00 2001 From: Tom Tanner Date: Sat, 28 Mar 2015 10:11:09 +0000 Subject: Added json file dependency into moc scanner --- src/SConscript | 175 ++++++++++++++++++--------------------------------------- 1 file changed, 54 insertions(+), 121 deletions(-) (limited to 'src/SConscript') diff --git a/src/SConscript b/src/SConscript index a904f25f..6f6916bf 100644 --- a/src/SConscript +++ b/src/SConscript @@ -1,123 +1,56 @@ import os -import subprocess -Import('qt_env') - -env = qt_env.Clone() - -modules = [ - 'Core', - 'Gui', - 'Network', - 'Script', - 'Sql', - 'WebKit', - 'Xml', - 'XmlPatterns', - 'Declarative' -] - -if env['QT_MAJOR_VERSION'] > 4: - modules += [ - 'Widgets', - 'Qml', - 'WebKitWidgets' - ] - -env.EnableQtModules(*modules) - -env.Uic(env.Glob('*.ui')) - -env.RequireLibraries('uibase', 'shared', 'bsatk', 'esptk') - - -env.AppendUnique(LIBS = [ - 'shell32', - 'user32', - 'ole32', - 'advapi32', - 'gdi32', - 'shlwapi', - 'Psapi', - 'Version' -]) - -# We have to 'persuade' moc to generate certain other targets and inject them -# into the list of cpps -other_sources = env.AddExtraMoc(env.Glob('*.h')) - -for file in env.Glob('*.rc'): - # version.rc is included in app_icon.rc. Not sure why it's a separate file. - if file.name == 'version.rc': - continue - other_sources.append(env.RES(file)) - -# 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'] += [ - '../archive', -# '../boss_modified/boss-api', - '../plugins/gamefeatures', - '.', # Why is this necessary? - '${LOOTPATH}', - '${BOOSTPATH}', -] - -env.AppendUnique(CPPDEFINES = [ - '_UNICODE', - '_CRT_SECURE_NO_WARNINGS', - '_SCL_SECURE_NO_WARNINGS', - 'BOOST_DISABLE_ASSERTS', - 'NDEBUG', - 'QT_MESSAGELOGCONTEXT' -]) - -env.AppendUnique(CPPFLAGS = [ '-wd4100', '-wd4127', '-wd4512', '-wd4189' ]) - -env.AppendUnique(LINKFLAGS = [ - '/SUBSYSTEM:WINDOWS', - '${EXE_MANIFEST_DEPENDENCY}' -]) - -# modeltest is optional and it doesn't compile anyway... -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')) - -env.AppendUnique(LIBPATH = "${ZLIBPATH}/build") -env.AppendUnique(LIBS = 'zlibstatic') - -prog = env.Program('ModOrganizer', - cpp_files + env.Glob('*.qrc') + other_sources) - -env.InstallModule(prog) - -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 - -res = env['QT_USED_MODULES'] -Return('res') - -""" -CONFIG(debug, debug|release) { -} else { - QMAKE_CXXFLAGS += /Zi /GL - QMAKE_LFLAGS += /DEBUG /LTCG /OPT:REF /OPT:ICF -} - -TRANSLATIONS = organizer_en.ts - - -QMAKE_POST_LINK += xcopy /y /s /I $$quote($$BASEDIR\\*.qm) $$quote($$DSTDIR)\\translations $$escape_expand(\\n) - -""" +Import('env qt_env') + +def InstallModule(self, arg, subdir = None): + install_dir = '${INSTALL_PATH}' + if subdir is not None: + install_dir = os.path.join(install_dir, subdir) + # Ensure we install this when built from here, not just from top level build + self.Pseudo('install') + self.Depends('install', + self.Install(install_dir, + filter(lambda x: x.suffix in ('.dll', '.pdb', '.exe'), + arg))) + +def RequireLibraries(self, *libraries): + # Cannot use env.AppendUnique because it confuses moc +# self['CPPPATH'] += [ + # os.path.join('..', '..', library) for library in libraries + # ] + self.AppendUnique(CPPPATH = [ + os.path.join('..', library) for library in libraries + ]) + + self.AppendUnique(LIBPATH = [ + os.path.join('..', library) for library in libraries + ]) + + libs = list(libraries) + try: + idx = libs.index('shared') + libs[idx] = 'mo_shared' + except: + pass + + self.AppendUnique(LIBS = [ library for library in libs ]) + +qt_env = qt_env.Clone() +qt_env.AddMethod(InstallModule) +qt_env.AddMethod(RequireLibraries) + +env = env.Clone() +env.AddMethod(InstallModule) +env.AddMethod(RequireLibraries) + +libs_to_install = env.SConscript(env.Glob('*/SConscript'), + exports = 'env qt_env') +dll_manifest = 'dlls.manifest' +if qt_env['CONFIG'] == 'debug': + dll_manifest += '.debug' +if qt_env['QT_MAJOR_VERSION'] > 4: + dll_manifest += '.qt%d' % qt_env['QT_MAJOR_VERSION'] +qt_env.InstallAs(os.path.join(qt_env['INSTALL_PATH'], 'DLLs', 'dlls.manifest'), + dll_manifest) + +Return('libs_to_install') -- cgit v1.3.1 From 11e67d7a6cec002fccbcf5295445e54644a1618f Mon Sep 17 00:00:00 2001 From: Tom Tanner Date: Sun, 19 Apr 2015 21:10:03 +0100 Subject: More fixing up of scons. Give up entirely with debugging python proxy --- README.txt | 17 ++---- src/SConscript | 179 ++++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 131 insertions(+), 65 deletions(-) (limited to 'src/SConscript') diff --git a/README.txt b/README.txt index c171d2b6..637d0910 100644 --- a/README.txt +++ b/README.txt @@ -227,17 +227,12 @@ Troubleshooting (thanks to Ross): Complains about 'qtwebkit4' missing. For some reason this seems to insist on living with modorganiser.exe -6) Setting up so that you can use python proxy from the debug version. This is - necessary as PYQT5 build doesn't supply debug- and non-debug versions and it - appears the debug- and non-debug versions of the QT5 dlls don't play nicely - together. - Firstly, go to your build and run configuration in QTCreator, and *remove* - the qt bin dir from your build environment's PATH. - Then, in the DLLs directory, copy QT5Cored.dll to QT5Core.dll. Similary for - QT5Guid.gll and QT5Widgetsd.dll. - If you don't do both of these, then the program will die silently (if double - clicked) or print an obscure message about complaining you called QPixmap before - calling QApplication. +6) Debugging the python proxy: I (TT) don't think this is possible unless you have a debug + build of PyQt. However, a debug build of PyQt requires a debug build of python. There doesn't + appear to be a half way house which is build wiht normal python but debug versions of QT libraries. + You can confuse pyqt by copying the debug QT DLLs to appropriate named files in the DLLs + directory, and removing QT from your project run path, which results in the python proxy + initialising succesfully, but causes mod organiser to crash in strange places. ------------------- Building with scons diff --git a/src/SConscript b/src/SConscript index 6f6916bf..6783fd8b 100644 --- a/src/SConscript +++ b/src/SConscript @@ -1,56 +1,127 @@ import os +import subprocess -Import('env qt_env') - -def InstallModule(self, arg, subdir = None): - install_dir = '${INSTALL_PATH}' - if subdir is not None: - install_dir = os.path.join(install_dir, subdir) - # Ensure we install this when built from here, not just from top level build - self.Pseudo('install') - self.Depends('install', - self.Install(install_dir, - filter(lambda x: x.suffix in ('.dll', '.pdb', '.exe'), - arg))) - -def RequireLibraries(self, *libraries): - # Cannot use env.AppendUnique because it confuses moc -# self['CPPPATH'] += [ - # os.path.join('..', '..', library) for library in libraries - # ] - self.AppendUnique(CPPPATH = [ - os.path.join('..', library) for library in libraries - ]) - - self.AppendUnique(LIBPATH = [ - os.path.join('..', library) for library in libraries - ]) - - libs = list(libraries) - try: - idx = libs.index('shared') - libs[idx] = 'mo_shared' - except: - pass - - self.AppendUnique(LIBS = [ library for library in libs ]) - -qt_env = qt_env.Clone() -qt_env.AddMethod(InstallModule) -qt_env.AddMethod(RequireLibraries) - -env = env.Clone() -env.AddMethod(InstallModule) -env.AddMethod(RequireLibraries) - -libs_to_install = env.SConscript(env.Glob('*/SConscript'), - exports = 'env qt_env') -dll_manifest = 'dlls.manifest' -if qt_env['CONFIG'] == 'debug': - dll_manifest += '.debug' -if qt_env['QT_MAJOR_VERSION'] > 4: - dll_manifest += '.qt%d' % qt_env['QT_MAJOR_VERSION'] -qt_env.InstallAs(os.path.join(qt_env['INSTALL_PATH'], 'DLLs', 'dlls.manifest'), - dll_manifest) - -Return('libs_to_install') +Import('qt_env') + +env = qt_env.Clone() + +modules = [ + 'Core', + 'Gui', + 'Network', + 'Script', + 'Sql', + 'WebKit', + 'Xml', + 'XmlPatterns', + 'Declarative' +] + +if env['QT_MAJOR_VERSION'] > 4: + modules += [ + 'Widgets', + 'Qml', + 'WebKitWidgets' + ] + +env.EnableQtModules(*modules) + +env.Uic(env.Glob('*.ui')) + +env.RequireLibraries('uibase', 'shared', 'bsatk', 'esptk') + + +env.AppendUnique(LIBS = [ + 'shell32', + 'user32', + 'ole32', + 'advapi32', + 'gdi32', + 'shlwapi', + 'Psapi', + 'Version' +]) + +# We have to 'persuade' moc to generate certain other targets and inject them +# into the list of cpps +other_sources = env.AddExtraMoc(env.Glob('*.h')) + +for file in env.Glob('*.rc'): + # version.rc is included in app_icon.rc. Not sure why it's a separate file. + if file.name == 'version.rc': + continue + other_sources.append(env.RES(file)) + +# 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'] += [ + '../archive', +# '../boss_modified/boss-api', + '../plugins/gamefeatures', + '.', # Why is this necessary? + '${LOOTPATH}', + '${BOOSTPATH}', +] + +env.AppendUnique(CPPDEFINES = [ + '_UNICODE', + '_CRT_SECURE_NO_WARNINGS', + '_SCL_SECURE_NO_WARNINGS', + 'BOOST_DISABLE_ASSERTS', + 'NDEBUG', + 'QT_MESSAGELOGCONTEXT' +]) + +env.AppendUnique(CPPFLAGS = [ '-wd4100', '-wd4127', '-wd4512', '-wd4189' ]) + +env.AppendUnique(LINKFLAGS = [ + '/SUBSYSTEM:WINDOWS', + '${EXE_MANIFEST_DEPENDENCY}' +]) + +# modeltest is optional and it doesn't compile anyway... +cpp_files = [ + x for x in Glob('*.cpp') + if x.name != 'modeltest.cpp' and x.name != 'aboutdialog.cpp' +] + +about_env = env.Clone() +try: + hgid = subprocess.check_output(['hg', 'id', '-i']).rstrip() +except: + hgid = 'Unknown version' + +# 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')) + +env.AppendUnique(LIBPATH = "${ZLIBPATH}/build") +env.AppendUnique(LIBS = 'zlibstatic') + +prog = env.Program('ModOrganizer', + cpp_files + env.Glob('*.qrc') + other_sources) + +env.InstallModule(prog) + +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 + +res = env['QT_USED_MODULES'] +Return('res') + +""" +CONFIG(debug, debug|release) { +} else { + QMAKE_CXXFLAGS += /Zi /GL + QMAKE_LFLAGS += /DEBUG /LTCG /OPT:REF /OPT:ICF +} + +TRANSLATIONS = organizer_en.ts + + +QMAKE_POST_LINK += xcopy /y /s /I $$quote($$BASEDIR\\*.qm) $$quote($$DSTDIR)\\translations $$escape_expand(\\n) + +""" -- cgit v1.3.1