diff --git a/SConstruct b/SConstruct index 12637e50..7a98beb6 100644 --- a/SConstruct +++ b/SConstruct @@ -1,4 +1,3 @@ - import os.path as path import os import subprocess @@ -34,14 +33,14 @@ env.Replace(tools=[toolset]) # Check for platform support if platform not in ("darwin", "win32", "posix"): - print "Sorry, your platform is not supported." - print "Platform is:", platform - print "Specify OS= if you believe this is incorrect." - print "(Supported platforms are: darwin, win32, posix)" + print("Sorry, your platform is not supported.") + print("Platform is:", platform) + print("Specify OS= if you believe this is incorrect.") + print("(Supported platforms are: darwin, win32, posix)") Exit(1) -print 'Building for:', platform -print 'Using toolchain:', toolset -print 'C++ compiler:', env['CXX'] +print('Building for:', platform) +print('Using toolchain:', toolset) +print('C++ compiler:', env['CXX']) env.VariantDir('#build/obj', 'src') env.VariantDir('#build/obj/test', 'test') @@ -51,15 +50,15 @@ if env['debug']: # This command generates the header with git revision information def gen_gitrev(env, target, source): - revid = subprocess.check_output(["git", "rev-parse", "HEAD"]); - fulltag = subprocess.check_output(["git", "tag", "--sort=v:refname"]).split('\n')[-1] - tagrev = subprocess.check_output(["git", "rev-parse", fulltag]) if fulltag else "" + revid = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True); + fulltag = subprocess.check_output(["git", "tag", "--sort=v:refname"], text=True).split('\n')[-1] + tagrev = subprocess.check_output(["git", "rev-parse", fulltag], text=True) if fulltag else "" with open(target[0].path, 'w') as gitrev_hpp: - print >>gitrev_hpp - print >>gitrev_hpp, '#define GIT_REVISION "' + revid[0:7] + '"' - print >>gitrev_hpp, '#define GIT_TAG "' + fulltag + '"' - print >>gitrev_hpp, '#define GIT_TAG_REVISION "' + tagrev[0:7] + '"' - print >>gitrev_hpp + print(file=gitrev_hpp) + print('#define GIT_REVISION "' + revid[0:7] + '"', file=gitrev_hpp) + print('#define GIT_TAG "' + fulltag + '"', file=gitrev_hpp) + print('#define GIT_TAG_REVISION "' + tagrev[0:7] + '"', file=gitrev_hpp) + print(file=gitrev_hpp) if path.exists(".git"): git_refs = ['.git/HEAD'] with open('.git/HEAD') as git_head: @@ -111,14 +110,14 @@ if platform == "darwin": return all(not lib.startswith(x) for x in system_prefixes) def get_deps_for(source): deps = subprocess.check_output(['otool', '-L', source]).splitlines()[1:] - deps = map(str.strip, deps) - deps = filter(is_user_lib, deps) + deps = list(map(str.strip, deps)) + deps = list(filter(is_user_lib, deps)) deps = [x.split()[0] for x in deps] return deps def check_deps(source): direct_deps = get_deps_for(source) deps = set() - for i in xrange(len(direct_deps)): + for i in range(len(direct_deps)): dep = direct_deps[i] if dep.startswith('@rpath/'): direct_deps[i] = dep = dep.split('/', 1)[1] @@ -227,6 +226,7 @@ if path.exists('deps/include'): # Include directories + env.Append(CPPPATH=Split(""" #src/ #src/classes/ @@ -236,6 +236,7 @@ env.Append(CPPPATH=Split(""" #src/fileio/resmgr/ #src/fileio/xml-parser/ #src/gfx/ + #src/dialogxml/ #src/dialogxml/dialogs/ #src/dialogxml/widgets/ #src/scenario/ @@ -248,11 +249,11 @@ if not env.GetOption('clean'): conf = Configure(env) if not conf.CheckCC() or not conf.CheckCXX(): - print "There's a problem with your compiler!" + print("There's a problem with your compiler!") Exit(1) if not conf.CheckLib('zlib' if (platform == "win32" and 'mingw' not in env["TOOLS"]) else 'z'): - print 'zlib must be installed!' + print('zlib must be installed!') Exit(1) def check_lib(lib, disp, suffixes=[], versions=[]): @@ -266,7 +267,7 @@ if not env.GetOption('clean'): vc_suffix = '-vc' + env['MSVC_VERSION'].replace('.','') possible_names.append(lib + vc_suffix) n = len(possible_names) - for i in xrange(n): + for i in range(n): for suff in suffixes: possible_names.append(possible_names[i] + suff) for test in possible_names: @@ -277,19 +278,20 @@ if not env.GetOption('clean'): if conf.CheckLib(test + ver, language='C++'): bundled_libs.append(test + ver) return # Success! - print disp, 'must be installed!' - print " If you're sure it's installed, try passing LIBPATH=..." + print(disp, 'must be installed!') + print(" If you're sure it's installed, try passing LIBPATH=...") Exit(1) def check_header(header, disp): if not conf.CheckCXXHeader(header, '<>'): - print disp, 'must be installed!' - print " If you're sure it's installed, try passing INCLUDEPATH=..." + print(disp, 'must be installed!') + print(" If you're sure it's installed, try passing INCLUDEPATH=...") Exit(1) boost_versions = ['-1_54', '-1_55', '-1_56', '-1_57', '-1_58'] # This is a bit of a hack. :( bundled_libs = [] + check_header('boost/lexical_cast.hpp', 'Boost.LexicalCast') check_header('boost/optional.hpp', 'Boost.Optional') check_header('boost/ptr_container/ptr_container.hpp', 'Boost.PointerContainer') @@ -403,9 +405,9 @@ elif platform == "win32": if path.exists("dep/VCRedistInstall.exe"): env.Install("build/Blades of Exile/", "dep/VCRedistInstall.exe") else: - print "WARNING: Cannot find installer for the MSVC redistributable libraries for your version of Visual Studio." - print "Please download it from Microsoft's website and place it at:" - print " dep/VCRedistInstall.exe" + print("WARNING: Cannot find installer for the MSVC redistributable libraries for your version of Visual Studio.") + print("Please download it from Microsoft's website and place it at:") + print(" dep/VCRedistInstall.exe") # Create it so its lack doesn't cause makensis to break # (Because the installer is an optional component.) open("build/Blades of Exile/VCRedistInstall.exe", 'w').close() diff --git a/src/dialogxml/widgets/ledgroup.cpp b/src/dialogxml/widgets/ledgroup.cpp index 1184c1ee..0ceee34c 100644 --- a/src/dialogxml/widgets/ledgroup.cpp +++ b/src/dialogxml/widgets/ledgroup.cpp @@ -7,6 +7,8 @@ * */ +#include + #include "ledgroup.hpp" #include "dialog.hpp" diff --git a/src/dialogxml/widgets/pict.hpp b/src/dialogxml/widgets/pict.hpp index 5843b9c8..f5c97cfd 100644 --- a/src/dialogxml/widgets/pict.hpp +++ b/src/dialogxml/widgets/pict.hpp @@ -16,6 +16,7 @@ #include #include +#include #include "control.hpp" #include "pictypes.hpp" diff --git a/src/dialogxml/widgets/stack.hpp b/src/dialogxml/widgets/stack.hpp index b7f2590c..2aded01b 100644 --- a/src/dialogxml/widgets/stack.hpp +++ b/src/dialogxml/widgets/stack.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "container.hpp" /// A stack groups several controls that represent an array of data. diff --git a/src/fileio/gzstream/version b/src/fileio/gzstream/version.txt similarity index 100% rename from src/fileio/gzstream/version rename to src/fileio/gzstream/version.txt diff --git a/src/scenedit/scen.btnmg.cpp b/src/scenedit/scen.btnmg.cpp index 5cbce1b8..552526ac 100644 --- a/src/scenedit/scen.btnmg.cpp +++ b/src/scenedit/scen.btnmg.cpp @@ -5,6 +5,7 @@ #include "scen.global.hpp" #include #include +#include #include "scen.graphics.hpp" #include #include "scen.btnmg.hpp" diff --git a/src/skills_traits.hpp b/src/skills_traits.hpp index 2f2009c3..f7d74900 100644 --- a/src/skills_traits.hpp +++ b/src/skills_traits.hpp @@ -9,6 +9,8 @@ #ifndef BoE_SKILLS_TRAITS_HPP #define BoE_SKILLS_TRAITS_HPP +#include + enum class eSkill { INVALID = -1, STRENGTH = 0, diff --git a/src/universe/pc.hpp b/src/universe/pc.hpp index 378c3532..9ef6e63c 100644 --- a/src/universe/pc.hpp +++ b/src/universe/pc.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "item.hpp" #include "pictypes.hpp"