make the game buildable on linux (#283)
- Scons -> python3 - include issues
This commit is contained in:
60
SConstruct
60
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=<your-platform> 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=<your-platform> 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()
|
||||
|
||||
Reference in New Issue
Block a user