blob: 9e94d056e1cc6fbe8e9c00eb3fb4dd7aae791cc4 [file] [log] [blame]
José Fonseca2c4349a2008-07-15 07:56:42 +09001"""gallium
2
3Frontend-tool for Gallium3D architecture.
4
5"""
6
7#
8# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
9# All Rights Reserved.
10#
11# Permission is hereby granted, free of charge, to any person obtaining a
12# copy of this software and associated documentation files (the
13# "Software"), to deal in the Software without restriction, including
14# without limitation the rights to use, copy, modify, merge, publish,
15# distribute, sub license, and/or sell copies of the Software, and to
16# permit persons to whom the Software is furnished to do so, subject to
17# the following conditions:
18#
19# The above copyright notice and this permission notice (including the
20# next paragraph) shall be included in all copies or substantial portions
21# of the Software.
22#
23# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
26# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
27# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30#
31
32
33import sys
José Fonseca9a99b192008-07-15 12:17:35 +090034import distutils.sysconfig
José Fonseca2c4349a2008-07-15 07:56:42 +090035import os.path
36
37
38def generate(env):
José Fonseca9a99b192008-07-15 12:17:35 +090039 # See http://www.scons.org/wiki/PythonExtensions
José Fonseca2c4349a2008-07-15 07:56:42 +090040
José Fonsecaa20bae32009-03-30 12:12:20 +010041 if sys.platform in ['win32']:
José Fonseca2c4349a2008-07-15 07:56:42 +090042 python_root = sys.prefix
43 python_version = '%u%u' % sys.version_info[:2]
44 python_include = os.path.join(python_root, 'include')
45 python_libs = os.path.join(python_root, 'libs')
46 python_lib = os.path.join(python_libs, 'python' + python_version + '.lib')
47
48 env.Append(CPPPATH = [python_include])
49 env.Append(LIBPATH = [python_libs])
50 env.Append(LIBS = ['python' + python_version + '.lib'])
José Fonseca9a99b192008-07-15 12:17:35 +090051 env.Replace(SHLIBPREFIX = '')
José Fonseca2c4349a2008-07-15 07:56:42 +090052 env.Replace(SHLIBSUFFIX = '.pyd')
53
54 # XXX; python25_d.lib is not included in Python for windows, and
55 # we'll get missing symbols unless we undefine _DEBUG
56 cppdefines = env['CPPDEFINES']
57 cppdefines = [define for define in cppdefines if define != '_DEBUG']
58 env.Replace(CPPDEFINES = cppdefines)
José Fonsecaa20bae32009-03-30 12:12:20 +010059 env.AppendUnique(CPPFLAGS = ['/U_DEBUG'])
60 env.AppendUnique(LINKFLAGS = ['/nodefaultlib:python25_d.lib'])
José Fonseca9a99b192008-07-15 12:17:35 +090061 else:
62 #env.ParseConfig('python-config --cflags --ldflags --libs')
63 env.AppendUnique(CPPPATH = [distutils.sysconfig.get_python_inc()])
64 env.Replace(SHLIBPREFIX = '')
65 env.Replace(SHLIBSUFFIX = distutils.sysconfig.get_config_vars()['SO'])
José Fonseca2c4349a2008-07-15 07:56:42 +090066
67 # for debugging
68 #print env.Dump()
69
70
71def exists(env):
72 return 1