| 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 |
| 34 | import os.path |
| 35 | |
| 36 | |
| 37 | def generate(env): |
| 38 | |
| 39 | # http://www.scons.org/wiki/PythonExtensions |
| 40 | #env.AppendUnique(CPPATH = [distutils.sysconfig.get_python_inc()]) |
| 41 | #distutils.sysconfig.get_config_vars('SO') |
| 42 | |
| 43 | env['SHLIBPREFIX'] = '' |
| 44 | |
| 45 | if sys.platform in ['linux2']: |
| 46 | env.ParseConfig('python-config --cflags --ldflags --libs') |
| 47 | |
| 48 | if sys.platform in ['windows']: |
| 49 | python_root = sys.prefix |
| 50 | python_version = '%u%u' % sys.version_info[:2] |
| 51 | python_include = os.path.join(python_root, 'include') |
| 52 | python_libs = os.path.join(python_root, 'libs') |
| 53 | python_lib = os.path.join(python_libs, 'python' + python_version + '.lib') |
| 54 | |
| 55 | env.Append(CPPPATH = [python_include]) |
| 56 | env.Append(LIBPATH = [python_libs]) |
| 57 | env.Append(LIBS = ['python' + python_version + '.lib']) |
| 58 | env.Replace(SHLIBSUFFIX = '.pyd') |
| 59 | |
| 60 | # XXX; python25_d.lib is not included in Python for windows, and |
| 61 | # we'll get missing symbols unless we undefine _DEBUG |
| 62 | cppdefines = env['CPPDEFINES'] |
| 63 | cppdefines = [define for define in cppdefines if define != '_DEBUG'] |
| 64 | env.Replace(CPPDEFINES = cppdefines) |
| 65 | |
| 66 | # for debugging |
| 67 | #print env.Dump() |
| 68 | |
| 69 | |
| 70 | def exists(env): |
| 71 | return 1 |