make the game buildable on linux (#283)

- Scons -> python3
- include issues
This commit is contained in:
x-qq
2022-03-13 21:38:22 +02:00
committed by GitHub
parent af8f30aaf2
commit 55a105a0f6
8 changed files with 39 additions and 29 deletions

View File

@@ -1,4 +1,3 @@
import os.path as path import os.path as path
import os import os
import subprocess import subprocess
@@ -34,14 +33,14 @@ env.Replace(tools=[toolset])
# Check for platform support # Check for platform support
if platform not in ("darwin", "win32", "posix"): if platform not in ("darwin", "win32", "posix"):
print "Sorry, your platform is not supported." print("Sorry, your platform is not supported.")
print "Platform is:", platform print("Platform is:", platform)
print "Specify OS=<your-platform> if you believe this is incorrect." print("Specify OS=<your-platform> if you believe this is incorrect.")
print "(Supported platforms are: darwin, win32, posix)" print("(Supported platforms are: darwin, win32, posix)")
Exit(1) Exit(1)
print 'Building for:', platform print('Building for:', platform)
print 'Using toolchain:', toolset print('Using toolchain:', toolset)
print 'C++ compiler:', env['CXX'] print('C++ compiler:', env['CXX'])
env.VariantDir('#build/obj', 'src') env.VariantDir('#build/obj', 'src')
env.VariantDir('#build/obj/test', 'test') env.VariantDir('#build/obj/test', 'test')
@@ -51,15 +50,15 @@ if env['debug']:
# This command generates the header with git revision information # This command generates the header with git revision information
def gen_gitrev(env, target, source): def gen_gitrev(env, target, source):
revid = subprocess.check_output(["git", "rev-parse", "HEAD"]); revid = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True);
fulltag = subprocess.check_output(["git", "tag", "--sort=v:refname"]).split('\n')[-1] fulltag = subprocess.check_output(["git", "tag", "--sort=v:refname"], text=True).split('\n')[-1]
tagrev = subprocess.check_output(["git", "rev-parse", fulltag]) if fulltag else "" tagrev = subprocess.check_output(["git", "rev-parse", fulltag], text=True) if fulltag else ""
with open(target[0].path, 'w') as gitrev_hpp: with open(target[0].path, 'w') as gitrev_hpp:
print >>gitrev_hpp print(file=gitrev_hpp)
print >>gitrev_hpp, '#define GIT_REVISION "' + revid[0:7] + '"' print('#define GIT_REVISION "' + revid[0:7] + '"', file=gitrev_hpp)
print >>gitrev_hpp, '#define GIT_TAG "' + fulltag + '"' print('#define GIT_TAG "' + fulltag + '"', file=gitrev_hpp)
print >>gitrev_hpp, '#define GIT_TAG_REVISION "' + tagrev[0:7] + '"' print('#define GIT_TAG_REVISION "' + tagrev[0:7] + '"', file=gitrev_hpp)
print >>gitrev_hpp print(file=gitrev_hpp)
if path.exists(".git"): if path.exists(".git"):
git_refs = ['.git/HEAD'] git_refs = ['.git/HEAD']
with open('.git/HEAD') as 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) return all(not lib.startswith(x) for x in system_prefixes)
def get_deps_for(source): def get_deps_for(source):
deps = subprocess.check_output(['otool', '-L', source]).splitlines()[1:] deps = subprocess.check_output(['otool', '-L', source]).splitlines()[1:]
deps = map(str.strip, deps) deps = list(map(str.strip, deps))
deps = filter(is_user_lib, deps) deps = list(filter(is_user_lib, deps))
deps = [x.split()[0] for x in deps] deps = [x.split()[0] for x in deps]
return deps return deps
def check_deps(source): def check_deps(source):
direct_deps = get_deps_for(source) direct_deps = get_deps_for(source)
deps = set() deps = set()
for i in xrange(len(direct_deps)): for i in range(len(direct_deps)):
dep = direct_deps[i] dep = direct_deps[i]
if dep.startswith('@rpath/'): if dep.startswith('@rpath/'):
direct_deps[i] = dep = dep.split('/', 1)[1] direct_deps[i] = dep = dep.split('/', 1)[1]
@@ -227,6 +226,7 @@ if path.exists('deps/include'):
# Include directories # Include directories
env.Append(CPPPATH=Split(""" env.Append(CPPPATH=Split("""
#src/ #src/
#src/classes/ #src/classes/
@@ -236,6 +236,7 @@ env.Append(CPPPATH=Split("""
#src/fileio/resmgr/ #src/fileio/resmgr/
#src/fileio/xml-parser/ #src/fileio/xml-parser/
#src/gfx/ #src/gfx/
#src/dialogxml/
#src/dialogxml/dialogs/ #src/dialogxml/dialogs/
#src/dialogxml/widgets/ #src/dialogxml/widgets/
#src/scenario/ #src/scenario/
@@ -248,11 +249,11 @@ if not env.GetOption('clean'):
conf = Configure(env) conf = Configure(env)
if not conf.CheckCC() or not conf.CheckCXX(): 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) Exit(1)
if not conf.CheckLib('zlib' if (platform == "win32" and 'mingw' not in env["TOOLS"]) else 'z'): 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) Exit(1)
def check_lib(lib, disp, suffixes=[], versions=[]): def check_lib(lib, disp, suffixes=[], versions=[]):
@@ -266,7 +267,7 @@ if not env.GetOption('clean'):
vc_suffix = '-vc' + env['MSVC_VERSION'].replace('.','') vc_suffix = '-vc' + env['MSVC_VERSION'].replace('.','')
possible_names.append(lib + vc_suffix) possible_names.append(lib + vc_suffix)
n = len(possible_names) n = len(possible_names)
for i in xrange(n): for i in range(n):
for suff in suffixes: for suff in suffixes:
possible_names.append(possible_names[i] + suff) possible_names.append(possible_names[i] + suff)
for test in possible_names: for test in possible_names:
@@ -277,19 +278,20 @@ if not env.GetOption('clean'):
if conf.CheckLib(test + ver, language='C++'): if conf.CheckLib(test + ver, language='C++'):
bundled_libs.append(test + ver) bundled_libs.append(test + ver)
return # Success! return # Success!
print disp, 'must be installed!' print(disp, 'must be installed!')
print " If you're sure it's installed, try passing LIBPATH=..." print(" If you're sure it's installed, try passing LIBPATH=...")
Exit(1) Exit(1)
def check_header(header, disp): def check_header(header, disp):
if not conf.CheckCXXHeader(header, '<>'): if not conf.CheckCXXHeader(header, '<>'):
print disp, 'must be installed!' print(disp, 'must be installed!')
print " If you're sure it's installed, try passing INCLUDEPATH=..." print(" If you're sure it's installed, try passing INCLUDEPATH=...")
Exit(1) Exit(1)
boost_versions = ['-1_54', '-1_55', '-1_56', '-1_57', '-1_58'] # This is a bit of a hack. :( boost_versions = ['-1_54', '-1_55', '-1_56', '-1_57', '-1_58'] # This is a bit of a hack. :(
bundled_libs = [] bundled_libs = []
check_header('boost/lexical_cast.hpp', 'Boost.LexicalCast') check_header('boost/lexical_cast.hpp', 'Boost.LexicalCast')
check_header('boost/optional.hpp', 'Boost.Optional') check_header('boost/optional.hpp', 'Boost.Optional')
check_header('boost/ptr_container/ptr_container.hpp', 'Boost.PointerContainer') check_header('boost/ptr_container/ptr_container.hpp', 'Boost.PointerContainer')
@@ -403,9 +405,9 @@ elif platform == "win32":
if path.exists("dep/VCRedistInstall.exe"): if path.exists("dep/VCRedistInstall.exe"):
env.Install("build/Blades of Exile/", "dep/VCRedistInstall.exe") env.Install("build/Blades of Exile/", "dep/VCRedistInstall.exe")
else: else:
print "WARNING: Cannot find installer for the MSVC redistributable libraries for your version of Visual Studio." 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("Please download it from Microsoft's website and place it at:")
print " dep/VCRedistInstall.exe" print(" dep/VCRedistInstall.exe")
# Create it so its lack doesn't cause makensis to break # Create it so its lack doesn't cause makensis to break
# (Because the installer is an optional component.) # (Because the installer is an optional component.)
open("build/Blades of Exile/VCRedistInstall.exe", 'w').close() open("build/Blades of Exile/VCRedistInstall.exe", 'w').close()

View File

@@ -7,6 +7,8 @@
* *
*/ */
#include <climits>
#include "ledgroup.hpp" #include "ledgroup.hpp"
#include "dialog.hpp" #include "dialog.hpp"

View File

@@ -16,6 +16,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <memory>
#include "control.hpp" #include "control.hpp"
#include "pictypes.hpp" #include "pictypes.hpp"

View File

@@ -12,6 +12,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <string> #include <string>
#include <limits>
#include "container.hpp" #include "container.hpp"
/// A stack groups several controls that represent an array of data. /// A stack groups several controls that represent an array of data.

View File

@@ -5,6 +5,7 @@
#include "scen.global.hpp" #include "scen.global.hpp"
#include <array> #include <array>
#include <string> #include <string>
#include <memory>
#include "scen.graphics.hpp" #include "scen.graphics.hpp"
#include <cmath> #include <cmath>
#include "scen.btnmg.hpp" #include "scen.btnmg.hpp"

View File

@@ -9,6 +9,8 @@
#ifndef BoE_SKILLS_TRAITS_HPP #ifndef BoE_SKILLS_TRAITS_HPP
#define BoE_SKILLS_TRAITS_HPP #define BoE_SKILLS_TRAITS_HPP
#include <iosfwd>
enum class eSkill { enum class eSkill {
INVALID = -1, INVALID = -1,
STRENGTH = 0, STRENGTH = 0,

View File

@@ -15,6 +15,7 @@
#include <array> #include <array>
#include <bitset> #include <bitset>
#include <cstdint> #include <cstdint>
#include <limits>
#include "item.hpp" #include "item.hpp"
#include "pictypes.hpp" #include "pictypes.hpp"