source: trunk/superstring/SConstruct @ 812

Revision 812, 3.4 KB checked in by wd, 5 years ago (diff)

WIP commit for SuperString? lib. Allocator, comparator, unit tests for all
so far.

  • Property svn:keywords set to Id Rev
Line 
1# #############################################################################
2# SConstruct: SCons build instructions
3#
4# Copyright 2006-2007 Chip Norkus
5# See the COPYING file for more information on licensing and use.
6#
7# $Id$
8#
9# #############################################################################
10
11###############################################################################
12# Initial setup (Python path tweaks etc)
13
14package_name = "superstring"
15package_version = "1.0"
16
17EnsurePythonVersion(2,2)
18EnsureSConsVersion(0,96,92)
19
20import glob, os, sys
21# let's just stick the realpath() for ./build in there at the front.  THis
22# allows us to use our custom test code in the 'tests' module there.
23sys.path.insert(0, os.path.realpath('./build'))
24import tests
25
26###############################################################################
27# Global environment setup.  Import the user's $PATH for our own sanity.
28env = Environment(ENV = {
29    'PATH': os.environ['PATH'],
30    },
31    CPPPATH = ['#/include']
32)
33
34###############################################################################
35# Options
36
37opts = Options(None, ARGUMENTS)
38opts.AddOptions(
39# Other path options are handled below
40    PathOption('prefix', 'Installation prefix', '/usr/local',
41        tests.PathIsDirCreateAccess),
42)
43opts.Update(env)
44
45# Okay, let's make some dumb guesses:  If the name already contains
46# 'package' in it let's go ahead and not add that again.  If the name is
47# standard (/usr, /usr/local, /opt) let's add it there.  Other than that we
48# aren't too smart. :)
49if env['prefix'] == '/usr' or env['prefix'] == '/opt':
50    # /usr and /opt need special handling to stuff things in /etc
51    sysconfdir = '/etc'
52else:
53    sysconfdir = env['prefix'] + '/etc'
54
55dir_suffix = ''
56if not package_name in env['prefix']:
57    dir_suffix = '/' + package_name
58
59opts.AddOptions(
60    BoolOption('debug', 'Enable creation of debugging symbols', 0),
61    BoolOption('warnings', 'Compile with aggressive warning checks', 1),
62    PathOption('libdir', "Library installation directory",
63        env['prefix'] + '/lib' + dir_suffix, tests.PathIsDirCreateAccess),
64    PathOption('includedir', 'C header installation directory',
65        env['prefix'] + '/include', tests.PathIsDirCreateAccess),
66)
67opts.Update(env)
68
69env.Help(opts.GenerateHelpText(env))
70
71###############################################################################
72# Configuration tests
73conf = env.Configure(config_h = 'include/config.h',
74    custom_tests = tests.tests)
75
76conf.CheckCCompiler()
77conf.CheckCVersion()
78
79# Set compiler options
80if env['CC'] == 'gcc':
81    if env['debug']:
82        env.AppendUnique(CCFLAGS = ['-O', '-g3'])
83    if env['warnings']:
84        env.AppendUnique(CCFLAGS = Split('''
85            -Wall -Wshadow -Wmissing-declarations -Wpointer-arith -Wcast-align
86            -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
87            -Wredundant-decls -Winline -Wbad-function-cast
88            '''))
89
90conf.Finish()
91
92###############################################################################
93# Build options and subsidiary code
94
95env.Export(['env', 'tests'])
96
97env.Install(env['includedir'] + '/superstring',
98    glob.glob('include/superstring/*.h'))
99
100# dummy install target with our various prefixes.
101env.Alias('install', env['libdir'], env['includedir'])
102
103# and call our sub-scripts.
104env.SConscript('source/SConscript')
105
106# vi:set ts=8 sts=4 sw=4 tw=76 et syntax=python:
Note: See TracBrowser for help on using the repository browser.