Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

python.py 2.7KB

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