José Fonseca | 2c4349a | 2008-07-15 07:56:42 +0900 | [diff] [blame] | 1 | """gallium |
| 2 | |
| 3 | Frontend-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 | |
| 33 | import sys |
José Fonseca | 9a99b19 | 2008-07-15 12:17:35 +0900 | [diff] [blame] | 34 | import distutils.sysconfig |
José Fonseca | 2c4349a | 2008-07-15 07:56:42 +0900 | [diff] [blame] | 35 | import os.path |
| 36 | |
| 37 | |
| 38 | def generate(env): |
José Fonseca | 9a99b19 | 2008-07-15 12:17:35 +0900 | [diff] [blame] | 39 | # See http://www.scons.org/wiki/PythonExtensions |
José Fonseca | 2c4349a | 2008-07-15 07:56:42 +0900 | [diff] [blame] | 40 | |
José Fonseca | a20bae3 | 2009-03-30 12:12:20 +0100 | [diff] [blame] | 41 | if sys.platform in ['win32']: |
José Fonseca | 2c4349a | 2008-07-15 07:56:42 +0900 | [diff] [blame] | 42 | 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é Fonseca | 9a99b19 | 2008-07-15 12:17:35 +0900 | [diff] [blame] | 51 | env.Replace(SHLIBPREFIX = '') |
José Fonseca | 2c4349a | 2008-07-15 07:56:42 +0900 | [diff] [blame] | 52 | 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é Fonseca | a20bae3 | 2009-03-30 12:12:20 +0100 | [diff] [blame] | 59 | env.AppendUnique(CPPFLAGS = ['/U_DEBUG']) |
| 60 | env.AppendUnique(LINKFLAGS = ['/nodefaultlib:python25_d.lib']) |
José Fonseca | 9a99b19 | 2008-07-15 12:17:35 +0900 | [diff] [blame] | 61 | 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é Fonseca | 2c4349a | 2008-07-15 07:56:42 +0900 | [diff] [blame] | 66 | |
| 67 | # for debugging |
| 68 | #print env.Dump() |
| 69 | |
| 70 | |
| 71 | def exists(env): |
| 72 | return 1 |