Fix searching for DirectX SDK during GN build.
Before that GN just checked for DXSDK_DIR environment variable. GYP does more and checks registry, let's do the same in GN. R=kjellander@webrtc.org Review URL: https://webrtc-codereview.appspot.com/37599004 Patch from Vyacheslav Chigrin <vchigrin@yandex-team.ru>. git-svn-id: http://webrtc.googlecode.com/svn/trunk@8066 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
43
webrtc/build/find_directx_sdk.py
Normal file
43
webrtc/build/find_directx_sdk.py
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license
|
||||
# that can be found in the LICENSE file in the root of the source
|
||||
# tree. An additional intellectual property rights grant can be found
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
"""Searches for DirectX SDK installation and prints full path to it."""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
sys.stdout.write(FindDirectXInstallation())
|
||||
return 0
|
||||
|
||||
|
||||
def FindDirectXInstallation():
|
||||
"""Try to find an installation location for the DirectX SDK. Check for the
|
||||
standard environment variable, and if that doesn't exist, try to find
|
||||
via the registry. Returns empty string if not found in either location."""
|
||||
|
||||
dxsdk_dir = os.environ.get('DXSDK_DIR')
|
||||
if dxsdk_dir:
|
||||
return dxsdk_dir
|
||||
|
||||
# Setup params to pass to and attempt to launch reg.exe.
|
||||
cmd = ['reg.exe', 'query', r'HKLM\Software\Microsoft\DirectX', '/s']
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
for line in p.communicate()[0].splitlines():
|
||||
if 'InstallPath' in line:
|
||||
return line.split(' ')[3] + "\\"
|
||||
|
||||
return ''
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user