Improved SConstruct build script to allow 'development' and 'release' builds

This commit is contained in:
Ingo Ruhnke 2011-01-22 03:11:10 +01:00
parent 95a7f6029c
commit 81cd362568
2 changed files with 42 additions and 41 deletions

12
.gitignore vendored
View file

@ -1,19 +1,11 @@
*~
*.o
xboxdrv
.sconsign.dblite
usb.txt
xpad.c
xpad.h
publish.sh
usbcat
macosx
windows
inputdrv
xboxdrv
old
.sconf_temp/
arg_parser_test
config.log
doc/xboxdrv-daemon.html/
doc/xboxdrv.html/
doc/xboxdrv.ent
custom.py

View file

@ -1,26 +1,44 @@
# -*- python -*-
if False:
env = Environment(CPPFLAGS=['-g', '-O2', '-Wall', '-ansi', '-pedantic'],
CPPPATH=["src/"])
env = Environment()
opts = Variables(['custom.py'], ARGUMENTS)
opts.Add('CPPPATH', 'Additional preprocessor paths')
opts.Add('CPPFLAGS', 'Additional preprocessor flags')
opts.Add('CPPDEFINES', 'defined constants')
opts.Add('LIBPATH', 'Additional library paths')
opts.Add('LIBS', 'Additional libraries')
opts.Add('CCFLAGS', 'C Compiler flags')
opts.Add('CXXFLAGS', 'C++ Compiler flags')
opts.Add('LINKFLAGS', 'Linker Compiler flags')
opts.Add('CC', 'C Compiler')
opts.Add('CXX', 'C++ Compiler')
opts.Add('BUILD', 'Build type: release, development')
opts.Update(env)
Help(opts.GenerateHelpText(env))
env.Append(CPPPATH=["src/"])
if 'BUILD' in env and env['BUILD'] == 'development':
env.Append(CXXFLAGS = [ "-O3",
"-g3",
"-ansi",
"-pedantic",
"-Wall",
"-Wextra",
"-Werror",
"-Wnon-virtual-dtor",
"-Weffc++",
# "-Wconversion",
"-Wold-style-cast",
"-Wshadow",
"-Wcast-qual",
"-Winit-self", # only works with >= -O1
"-Wno-unused-parameter"])
else:
env = Environment(CXX="g++-4.5",
CXXFLAGS= [ "-O3", "-g3",
"-ansi",
"-pedantic",
"-Wall",
"-Wextra",
"-Wnon-virtual-dtor",
#"-Weffc++",
#"-Wconversion",
"-Wold-style-cast",
# "-Werror",
"-Wshadow",
"-Wcast-qual",
"-Winit-self", # only works with >= -O1
"-Wno-unused-parameter",
],
CPPPATH=["src/"])
env.Append(CPPFLAGS = ['-g', '-O3', '-Wall', '-ansi', '-pedantic'])
env.ParseConfig("pkg-config --cflags --libs libusb-1.0 | sed 's/-I/-isystem/g'")
env.ParseConfig("pkg-config --cflags --libs libudev | sed 's/-I/-isystem/g'")
@ -29,7 +47,7 @@ f = open("VERSION")
package_version = f.read()
f.close()
env.Append(CPPDEFINES={ 'PACKAGE_VERSION': "'\"%s\"'" % package_version})
env.Append(CPPDEFINES = { 'PACKAGE_VERSION': "'\"%s\"'" % package_version })
conf = Configure(env)
@ -42,11 +60,6 @@ if not conf.CheckLibWithHeader('X11', 'X11/Xlib.h', 'C++'):
print 'libx11-dev must be installed!'
Exit(1)
# libusb Checks
if not conf.CheckLibWithHeader('usb', 'usb.h', 'C++'):
print 'libusb must be installed!'
Exit(1)
# boost-thread checks
if not conf.CheckCXXHeader('boost/thread/thread.hpp'):
print 'libboost-thread-dev must be installed!'
@ -58,13 +71,9 @@ if not conf.CheckLib('boost_thread-mt', language='C++'):
Exit(1)
env = conf.Finish()
env.Program('xboxdrv',
Glob('src/*.cpp') +
Glob('src/modifier/*.cpp'))
if False:
env.Program('inputdrv', Glob('src/inputdrv/*.cpp'),
LIBS=['boost_signals', 'usb', 'pthread'])
# EOF #