Initial import of libucore
This commit is contained in:
+82
@@ -0,0 +1,82 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
#version info of the library
|
||||
revision = svn_version = os.popen('svnversion').read()[:-1]
|
||||
|
||||
version_info = {
|
||||
'version_major': 1 ,
|
||||
'version_minor': 0 ,
|
||||
'version_patch': 0 ,
|
||||
'version_revision': revision,
|
||||
}
|
||||
|
||||
AddOption('--build_type',
|
||||
dest = 'build_type',
|
||||
type = 'string',
|
||||
nargs = 1,
|
||||
action='store',
|
||||
default='debug',
|
||||
metavar='TYPE',
|
||||
help = 'debug|release - Build a Debug (default) or Release variant'
|
||||
)
|
||||
AddOption('--prefix',
|
||||
dest='prefix',
|
||||
type='string',
|
||||
nargs=1,
|
||||
action='store',
|
||||
metavar='DIR',
|
||||
default='/usr',
|
||||
help='installation prefix'
|
||||
)
|
||||
|
||||
AddOption('--test_xml',
|
||||
dest='test_xml',
|
||||
action='store_true',
|
||||
help='Create a result.xml when running the testsuite'
|
||||
)
|
||||
|
||||
|
||||
build_type = GetOption('build_type')
|
||||
test_xml = GetOption('test_xml')
|
||||
prefix = GetOption('prefix')
|
||||
if not (build_type in ['debug', 'release']):
|
||||
print "Error: expected 'debug' or 'release', found: " + build_type
|
||||
Exit(1)
|
||||
|
||||
def InstallPerm(env, dest, files, perm):
|
||||
obj = env.Install(dest, files)
|
||||
for i in obj:
|
||||
env.AddPostAction(i, Chmod(str(i), perm))
|
||||
return dest
|
||||
|
||||
|
||||
env = Environment(tools = ['default', 'textfile'])
|
||||
env.AddMethod(InstallPerm)
|
||||
Export('env', 'build_type', 'prefix', 'version_info', 'test_xml')
|
||||
|
||||
env['CFLAGS'] = ['-Wall', '-Wextra', '-pipe', '-ggdb']
|
||||
env['LINKFLAGS'] = ['-O2']
|
||||
env['CPPDEFINES'] = ['_FILE_OFFSET_BITS=64']
|
||||
|
||||
if build_type == 'release':
|
||||
env['CFLAGS'] += ['-O2']
|
||||
|
||||
#this will turn off assert()
|
||||
env['CPPDEFINES'] += ['NDEBUG']
|
||||
|
||||
elif build_type == 'debug':
|
||||
env['CPPDEFINES'] += ['DEBUG']
|
||||
|
||||
#put all .sconsign files in one place
|
||||
env.SConsignFile()
|
||||
|
||||
subdirs = [
|
||||
'src',
|
||||
'test'
|
||||
]
|
||||
|
||||
for subdir in subdirs:
|
||||
SConscript(subdir + '/SConscript', variant_dir='#build/' + subdir, src_dir='#'+subdir, duplicate=0)
|
||||
|
||||
env.Default('src')
|
||||
Reference in New Issue
Block a user