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.

dxsdk.py 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. """dxsdk
  2. Tool-specific initialization for Microsoft DirectX SDK
  3. """
  4. #
  5. # Copyright (c) 2009 VMware, Inc.
  6. #
  7. # Permission is hereby granted, free of charge, to any person obtaining
  8. # a copy of this software and associated documentation files (the
  9. # "Software"), to deal in the Software without restriction, including
  10. # without limitation the rights to use, copy, modify, merge, publish,
  11. # distribute, sublicense, and/or sell copies of the Software, and to
  12. # permit persons to whom the Software is furnished to do so, subject to
  13. # the following conditions:
  14. #
  15. # The above copyright notice and this permission notice shall be included
  16. # in all copies or substantial portions of the Software.
  17. #
  18. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  19. # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  20. # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  21. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  22. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  23. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  24. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. #
  26. import os
  27. import os.path
  28. import SCons.Errors
  29. import SCons.Util
  30. def get_dxsdk_root(env):
  31. try:
  32. return os.environ['DXSDK_DIR']
  33. except KeyError:
  34. return None
  35. def generate(env):
  36. dxsdk_root = get_dxsdk_root(env)
  37. if dxsdk_root is None:
  38. # DirectX SDK not found
  39. return
  40. if env['machine'] in ('generic', 'x86'):
  41. target_cpu = 'x86'
  42. elif env['machine'] == 'x86_64':
  43. target_cpu = 'x64'
  44. else:
  45. raise SCons.Errors.InternalError, "Unsupported target machine"
  46. include_dir = os.path.join(dxsdk_root, 'Include')
  47. lib_dir = os.path.join(dxsdk_root, 'Lib', target_cpu)
  48. env.Append(CPPDEFINES = [('HAVE_DXSDK', '1')])
  49. gcc = 'gcc' in os.path.basename(env['CC']).split('-')
  50. if gcc:
  51. # Make GCC more forgiving towards Microsoft's headers
  52. env.Prepend(CPPFLAGS = ['-isystem', include_dir])
  53. else:
  54. env.Prepend(CPPPATH = [include_dir])
  55. env.Prepend(LIBPATH = [lib_dir])
  56. def exists(env):
  57. return get_dxsdk_root(env) is not None
  58. # vim:set ts=4 sw=4 et: