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
|
###
# Copyright (c) 2002-2009 Kongsberg SIM
#
# 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 = Variables('custom.py')
opts.AddVariables(BoolVariable('warnings', 'compilation with -Wall', 1),
BoolVariable('debug', 'debug output and symbols', 0))
env = Environment(ENV = os.environ, options = opts)
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')
env.Repository('../../SoPyScript')
examin_env = env.Clone(CPPPATH = ['.', distutils.sysconfig.get_python_inc()])
# Use suncc on OpenSolaris
if str(Platform()) == 'sunos':
examin_env.Tool("suncc")
if str(Platform()) == 'win32':
examin_env.Append(CPPPATH = os.getenv("COINDIR") + os.sep + 'include')
examin_env.Append(CPPDEFINES = Split('COIN_DLL SOWIN_DLL'))
examin_env.Append(CPPFLAGS = Split('/MD /wd4244 /wd4049'))
examin_env.Append(LIBPATH = sys.exec_prefix + os.sep + 'libs')
examin_env.Append(LINKFLAGS = [os.getenv('COINDIR') + '\\lib\\coin4.lib ',
os.getenv('COINDIR') + '\\lib\\sowin1.lib'])
else:
examin_env.ParseConfig('soqt-config --cppflags --libs --ldflags')
examin_env.Append(LINKFLAGS = distutils.sysconfig.get_config_vars().get('LINKFORSHARED', '').split() +
distutils.sysconfig.get_config_vars().get('BLDLIBRARY', '').split())
examin_env.Depends('SoPyScript.cpp', 'swigpyrun.h')
examin_env.Command('swigpyrun.h', '',
'swig -python -external-runtime swigpyrun.h')
examin_env.Program('examin', Split((str(Platform()) == 'win32' and 'sowinexamin.cpp' or 'soqtexamin.cpp') + ' SoPyScript.cpp'))
|