fix some cross compiling setups

"i686-w64-mingw32" is actually a 32 bit compiler, and using --tool directly didn't update path before
This commit is contained in:
jacob1 2015-05-26 00:09:09 -04:00
parent c9d5841101
commit 6c725cc405

View File

@ -106,25 +106,27 @@ if not tool and compilePlatform == "Linux" and compilePlatform != platform:
if platform == "Darwin":
crossList = ["i686-apple-darwin9", "i686-apple-darwin10"]
elif not GetOption('64bit'):
crossList = ["mingw32", "i386-mingw32msvc", "i486-mingw32msvc", "i586-mingw32msvc", "i686-mingw32msvc"]
crossList = ["mingw32", "i686-w64-mingw32", "i386-mingw32msvc", "i486-mingw32msvc", "i586-mingw32msvc", "i686-mingw32msvc"]
else:
crossList = ["x86_64-w64-mingw32", "i686-w64-mingw32", "amd64-mingw32msvc"]
crossList = ["x86_64-w64-mingw32", "amd64-mingw32msvc"]
for i in crossList:
#found a cross compiler, set tool here, which will update everything in env later
if WhereIs("{0}-g++".format(i)):
env['ENV']['PATH'] = "/usr/{0}/bin:{1}".format(i, os.environ['PATH'])
tool = i+"-"
break
if not tool:
print("Could not automatically find cross compiler, use --tool to specify manually")
#set tool prefix
#more things may to be set (http://clam-project.org/clam/trunk/CLAM/scons/sconstools/crossmingw.py), but this works for us
#more things may need to be set (http://clam-project.org/clam/trunk/CLAM/scons/sconstools/crossmingw.py), but this works for us
if tool:
env['CC'] = tool+env['CC']
env['CXX'] = tool+env['CXX']
if platform == "Windows":
env['RC'] = tool+env['RC']
env['STRIP'] = tool+'strip'
if os.path.isdir("/usr/{0}/bin".format(tool[:-1])):
env['ENV']['PATH'] = "/usr/{0}/bin:{1}".format(tool[:-1], os.environ['PATH'])
#copy environment variables because scons doesn't do this by default
for var in ["CC","CXX","LD","LIBPATH"]: