3 Tool-specific initialization for Microsoft Windows SDK.
8 # Copyright (c) 2001-2007 The SCons Foundation
9 # Copyright (c) 2008 Tungsten Graphics, Inc.
10 # Copyright (c) 2009 VMware, Inc.
12 # Permission is hereby granted, free of charge, to any person obtaining
13 # a copy of this software and associated documentation files (the
14 # "Software"), to deal in the Software without restriction, including
15 # without limitation the rights to use, copy, modify, merge, publish,
16 # distribute, sublicense, and/or sell copies of the Software, and to
17 # permit persons to whom the Software is furnished to do so, subject to
18 # the following conditions:
20 # The above copyright notice and this permission notice shall be included
21 # in all copies or substantial portions of the Software.
23 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
24 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
25 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44 # TODO: Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7
45 path = os.path.join(os.getenv('ProgramFiles', r'C:\Program Files'), 'Microsoft Visual Studio 9.0')
48 def get_vs_paths(env):
49 vs_root = get_vs_root(env)
51 raise SCons.Errors.InternalError, "WINSDK compiler not found"
53 tool_path = os.path.join(vs_root, 'Common7', 'IDE')
55 env.PrependENVPath('PATH', tool_path)
58 # TODO: Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VC7
59 path = os.path.join(os.getenv('ProgramFiles', r'C:\Program Files'), 'Microsoft Visual Studio 9.0', 'VC')
62 def get_vc_paths(env):
63 vc_root = get_vc_root(env)
65 raise SCons.Errors.InternalError, "WINSDK compiler not found"
67 target_cpu = env['machine']
69 if target_cpu in ('generic', 'x86'):
72 elif target_cpu == 'x86_64':
73 # TODO: take in consideration the host cpu
74 bin_dir = r'bin\x86_amd64'
75 lib_dir = r'lib\amd64'
77 raise SCons.Errors.InternalError, "Unsupported target machine"
78 include_dir = 'include'
80 env.PrependENVPath('PATH', os.path.join(vc_root, bin_dir))
81 env.PrependENVPath('INCLUDE', os.path.join(vc_root, include_dir))
82 env.PrependENVPath('LIB', os.path.join(vc_root, lib_dir))
84 def get_sdk_root(env):
85 if SCons.Util.can_read_reg:
86 key = r'SOFTWARE\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder'
88 path, t = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key)
89 except SCons.Util.RegError:
96 def get_sdk_paths(env):
97 sdk_root = get_sdk_root(env)
99 raise SCons.Errors.InternalError, "WINSDK not found"
101 target_cpu = env['machine']
104 if target_cpu in ('generic', 'x86'):
106 elif target_cpu == 'x86_64':
109 raise SCons.Errors.InternalError, "Unsupported target machine"
110 include_dir = 'Include'
112 env.PrependENVPath('PATH', os.path.join(sdk_root, bin_dir))
113 env.PrependENVPath('INCLUDE', os.path.join(sdk_root, include_dir))
114 env.PrependENVPath('LIB', os.path.join(sdk_root, lib_dir))
117 if not env.has_key('ENV'):
124 msvc_sa.generate(env)
125 mslib_sa.generate(env)
126 mslink_sa.generate(env)
129 return get_vc_root(env) is not None and get_sdk_root(env) is not None
131 # vim:set ts=4 sw=4 et: