Skip to content

Commit

Permalink
fix some cross compiling setups
Browse files Browse the repository at this point in the history
"i686-w64-mingw32" is actually a 32 bit compiler, and using --tool directly didn't update path before
  • Loading branch information
jacob1 committed May 26, 2015
1 parent c9d5841 commit 6c725cc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions SConscript
Expand Up @@ -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"]:
Expand Down

0 comments on commit 6c725cc

Please sign in to comment.