Blog

Portfolio CV

Using scons with gcc/mingw on windows

Published:
2009-03-04 23:48:17
Posted from:
Home
Tags:
C++, scons,

Just spent way too much time trying to get scons (an alternative to 'make' and 'makefiles') to build one of my projects on windows using gcc/g++/mingw. The scons documentation was not very helpful, but in the end it was quite easy:

#SConstruct
import platform
import os
...
if platform.system() == 'Windows':
    env = Environment(tools = ['mingw'], ENV = os.environ)
    env.PrependENVPath('PATH', 'C:\\Dev-Cpp\\bin')
    env.PrependENVPath('LIB', 'C:\\Dev-Cpp\\lib')
else:
    env = Environment(ENV = os.environ)
...
env.Program(['main.cpp'], LIBS = libs, LIBPATH=libpath, CCFLAGS=cflags)

As you can see I'm using the compilers and libraries distributed by Dev-C++, hard-coded the paths for now. Good night internets.

Comments

Spyware Blockers http://spywareblockers.ws 2009-11-12 18:52:51
I have been reading your posts lately, just want to say thanks for all informative stuff i have found here, helped me learn alot lately. Much Regards, Mark
Name
Email
Website
Text

© 2008 Markus Johnsson