Please note:The SCons wiki is now restored from the attack in March 2013. All old passwords have been invalidated. Please reset your password if you have an account. If you note missing pages, please report them to webmaster@scons.org. Also, new account creation is currently disabled due to an ongoing spam flood (2013/08/27).
Differences between revisions 26 and 27
Revision 26 as of 2013-04-04 13:43:15
Size: 842
Comment:
Revision 27 as of 2013-04-04 14:37:12
Size: 1143
Comment: accidentally deleted while despamming wiki. Restoring.
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
env = Environment(ENV=os.environ)
#Prefer
MinGW over other compilers
T
ool('mingw')(env)
#FIXME: clobbers env['TOOLS']
env = Environment(ENV=os.environ, tools=['mingw'])
Line 29: Line 28:


The page had this code instead:
{{{
#create an environment that uses mingw tools
env = Environment(ENV=os.environ)
#Prefer MinGW over other compilers
Tool('mingw')(env)
}}}

I couldn't get this to work. As of version 2.3.0, It would pass /nologo (an MSVC flag) to g++, causing the build to fail.
  • Author: JohnA
  • OS: Win2K
  • Tools: Mingw32, gcc

This is the shortest SConstruct for creating an executable

#need glob to get all the source files
import glob
import os

#create an environment that uses mingw tools
#FIXME: clobbers env['TOOLS']
env = Environment(ENV=os.environ, tools=['mingw'])

#the target will be myprogram.exe (in win32)
#the source files will be every file in the 
#current directory that matches "*.cpp"
env.Program(target='myprogram', source = glob.glob('*.cpp'))

errata: don't need the .exe in the target name

errata: don't need to Split() the glob

errata: don't forget to set the ENV argument in the call to Environment(); import os also

errata: don't set tools= in the Environment(), use Tool('mingw')(env) to avoid clobbering env['TOOLS']

The page had this code instead:

#create an environment that uses mingw tools
env = Environment(ENV=os.environ)
#Prefer MinGW over other compilers
Tool('mingw')(env)

I couldn't get this to work. As of version 2.3.0, It would pass /nologo (an MSVC flag) to g++, causing the build to fail.

SconstructShortMingwWin32 (last edited 2013-04-04 14:37:12 by GaryOberbrunner)