File: SConstruct

package info (click to toggle)
tintii 2.2.3-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,024 kB
  • ctags: 633
  • sloc: cpp: 4,069; makefile: 35; python: 4
file content (129 lines) | stat: -rw-r--r-- 3,919 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import os
import os.path

NAME = 'tintii'
VERSION = '2.2.3'
DISTRO = NAME + '-' + VERSION

##
## Environment
##
env = Environment(ENV = os.environ)

# Command line options
opts = Variables('config.py')
opts.AddVariables(PathVariable('PREFIX',
                               'Installation directory', '/usr/local'),
                  BoolVariable('NDEBUG',
                               'Set to disable assertion checking', 0),
                  BoolVariable('SKIPCONFIG',
                               'Set to skip configuration', 0),
                  ('CXX', 'C++ compiler'),
                  ('CXXFLAGS', 'C++ compiler flags'),
                  ('LINKFLAGS', 'Linker flags'),
               )
opts.Update(env)
if env['NDEBUG']:
  env.Append(CPPDEFINES = 'NDEBUG')

# Help
Help(opts.GenerateHelpText(env))

##
## Configuration
##
if not env.GetOption('clean') and not env['SKIPCONFIG']:
  conf = Configure(env)

  # Check for wxWidgets
  if not conf.CheckCXXHeader(os.path.join('wx', 'wx.h')):
    print 'wxWidgets not found'
    Exit(1)

  # Check for boost ublas
  if not (conf.CheckCXXHeader(os.path.join('boost', 'numeric', 'ublas',
      'vector.hpp')) and conf.CheckCXXHeader(os.path.join('boost', 'numeric',
      'ublas', 'matrix.hpp'))):
    print 'Boost.uBLAS not found'
    Exit(1)

##
## Build
##

# Compile
objects = []
headers = []
releases = []

Export(['env', 'objects', 'headers', 'releases'])
env.SConscript(os.path.join('src', 'SConscript'))

# Build program
program = env.Program(target = NAME, source = objects)


##
## Release
##

# Add meta files to release
releases += ['README.txt',
             'LICENSE.txt',
             'VERSION.txt',
             'Doxyfile',
             'SConstruct',
             'config.py',
             os.path.join('src', 'nuvola', 'README.txt'),
             os.path.join('images', 'splash.xpm'),
             os.path.join('images', 'nuvola', 'license.txt'),
             os.path.join('images', 'nuvola', 'readme.txt'),
             os.path.join('images', 'nuvola', 'button_accept.png'),
             os.path.join('images', 'nuvola', 'button_cancel.png'),
             os.path.join('images', 'nuvola', 'decrypted.png'),
             os.path.join('images', 'nuvola', 'down.png'),
             os.path.join('images', 'nuvola', 'encrypted.png'),
             os.path.join('images', 'nuvola', 'exit.png'),
             os.path.join('images', 'nuvola', 'fileclose.png'),
             os.path.join('images', 'nuvola', 'filenew.png'),
             os.path.join('images', 'nuvola', 'fileopen.png'),
             os.path.join('images', 'nuvola', 'filesaveas.png'),
             os.path.join('images', 'nuvola', 'filesave.png'),
             os.path.join('images', 'nuvola', 'finish.png'),
             os.path.join('images', 'nuvola', 'messagebox_info.png'),
             os.path.join('images', 'nuvola', 'up.png'),
             os.path.join('images', 'nuvola', 'viewmag1.png'),
             os.path.join('images', 'nuvola', 'viewmagfit.png'),
             os.path.join('images', 'nuvola', 'viewmag-.png'),
             os.path.join('images', 'nuvola', 'viewmag.png'),
             os.path.join('images', 'nuvola', 'viewmag+.png')
             ]

# Copy files to directory
oldDir = os.getcwd()
newDir = DISTRO
for release in releases:
  # for absolute paths...
  to = release.replace(oldDir, newDir)

  # for relative paths...
  if not to.startswith(newDir):
    to = os.path.join(newDir, to)

  env.Command(to, release, Copy(to, release))

# Tar
releaseEnv = Environment(TARFLAGS = '-cz')
tar = releaseEnv.Tar(DISTRO + '.tar.gz', DISTRO)


##
## Build control
##
Alias('build', [ program ])
Alias('release', [ tar ])
Alias('releasedir', [ DISTRO ])
Alias('all', [ 'build', 'release' ])
Default('build')

Clean('release', [ Dir(DISTRO) ])