File: SConstruct

package info (click to toggle)
pivy 0.6.10-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,216 kB
  • sloc: python: 36,331; cpp: 787; ansic: 733; makefile: 30; sh: 27; objc: 5
file content (69 lines) | stat: -rw-r--r-- 2,859 bytes parent folder | download | duplicates (10)
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
###
# Copyright (c) 2002-2007 Systems in Motion
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

import os, sys
import distutils.sysconfig

SetOption('implicit_cache', 1)

opts = Options('custom.py')
opts.AddOptions(BoolOption('warnings', 'compilation with -Wall', 0),
                BoolOption('debug', 'debug output and symbols', 0))

env = Environment(ENV = os.environ,
                  options = opts,
                  tools=['default'])

Help(opts.GenerateHelpText(env))

if env['debug']:
    env.Append(CCFLAGS = (str(Platform()) == 'win32') and ['/Zi'] or ['-g'])
else:
    env.Append(CCFLAGS = (str(Platform()) == 'win32') and ['/O2'] or ['-O2'])

if str(Platform()) != 'win32' and env['warnings']:
    env.Append(CCFLAGS = '-Wall')


if str(Platform()) == 'win32':
    env.Append(CPPPATH = os.getenv("COINDIR") + os.sep + 'include')
    env.Append(CPPDEFINES = 'COIN_DLL')
    env.Append(CPPFLAGS = Split('/wd4244 /wd4049'))
    env.Append(LIBPATH = (sys.exec_prefix + os.sep + 'libs').split())
    env.Append(LIBPATH = os.getenv('COINDIR') + '\\lib' )
    env.Append(LIBS = 'coin2.lib')
    INCLUDE_DIR = os.getenv("COINDIR") + os.sep + 'include'
else:
    env.ParseConfig('coin-config --cppflags --libs --ldflags')
    INCLUDE_DIR = os.popen('coin-config --includedir').read()

PIVY_ROOT = '../..'

env.Append(CPPPATH = ['.', PIVY_ROOT + '/interfaces', distutils.sysconfig.get_python_inc()])
env.Append(LIBPATH = [PIVY_ROOT, distutils.sysconfig.get_python_lib()])
env.Append(LINKFLAGS = distutils.sysconfig.get_config_vars().get('LINKFORSHARED', '').split())

SWIG_SUPPRESS_WARNINGS = '-w302,306,307,312,389,361,362,467,503,509,510'
env.Append(SWIGFLAGS = '-c++ -python -includeall -modern -D__PIVY__ ' +
           '-I. -I%s/interfaces -I%s/fake_headers -I/usr/local/include -I%s %s' %
           (PIVY_ROOT, PIVY_ROOT, INCLUDE_DIR, SWIG_SUPPRESS_WARNINGS))

lib = env.SharedLibrary('_shapescale', Split('shapescale.i ShapeScale.cpp'),
                        SHLIBPREFIX = '',
                        SHLIBSUFFIX = distutils.sysconfig.get_config_vars()['SO'],
                        SWIGCXXFILESUFFIX = '_wrap.cpp')

env.Clean(lib, Split('shapescale.py shapescale.pyc'))