3 Tool-specific initialization for Microsoft Window CE SDKs.
8 # Copyright (c) 2001-2007 The SCons Foundation
9 # Copyright (c) 2008 Tungsten Graphics, Inc.
11 # Permission is hereby granted, free of charge, to any person obtaining
12 # a 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, sublicense, 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:
19 # The above copyright notice and this permission notice shall be included
20 # in all copies or substantial portions of the Software.
22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
23 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 import SCons
.Platform
.win32
47 def get_wce500_paths(env
):
48 """Return a 3-tuple of (INCLUDE, LIB, PATH) as the values
49 of those three environment variables that should be set
50 in order to execute the MSVC tools properly."""
56 # mymic the batch files located in Microsoft eMbedded C++ 4.0\EVC\WCExxx\BIN
57 os_version
= os
.environ
.get('OSVERSION', 'WCE500')
58 platform
= os
.environ
.get('PLATFORM', 'STANDARDSDK_500')
59 wce_root
= os
.environ
.get('WCEROOT', 'C:\\Program Files\\Microsoft eMbedded C++ 4.0')
60 sdk_root
= os
.environ
.get('SDKROOT', 'C:\\Windows CE Tools')
65 exe_paths
.append( os
.path
.join(wce_root
, 'COMMON', 'EVC', 'bin') )
66 exe_paths
.append( os
.path
.join(wce_root
, 'EVC', os_version
, 'bin') )
67 include_paths
.append( os
.path
.join(sdk_root
, os_version
, platform
, 'include', target_cpu
) )
68 include_paths
.append( os
.path
.join(sdk_root
, os_version
, platform
, 'MFC', 'include') )
69 include_paths
.append( os
.path
.join(sdk_root
, os_version
, platform
, 'ATL', 'include') )
70 lib_paths
.append( os
.path
.join(sdk_root
, os_version
, platform
, 'lib', target_cpu
) )
71 lib_paths
.append( os
.path
.join(sdk_root
, os_version
, platform
, 'MFC', 'lib', target_cpu
) )
72 lib_paths
.append( os
.path
.join(sdk_root
, os_version
, platform
, 'ATL', 'lib', target_cpu
) )
74 include_path
= string
.join( include_paths
, os
.pathsep
)
75 lib_path
= string
.join(lib_paths
, os
.pathsep
)
76 exe_path
= string
.join(exe_paths
, os
.pathsep
)
77 return (include_path
, lib_path
, exe_path
)
79 def get_wce600_root(env
):
81 return os
.environ
['_WINCEROOT']
85 if SCons
.Util
.can_read_reg
:
86 key
= r
'SOFTWARE\Microsoft\Platform Builder\6.00\Directories\OS Install Dir'
88 path
, t
= SCons
.Util
.RegGetValue(SCons
.Util
.HKEY_LOCAL_MACHINE
, key
)
89 except SCons
.Util
.RegError
:
94 default_path
= os
.path
.join(r
'C:\WINCE600', version
)
95 if os
.path
.exists(default_path
):
100 def get_wce600_paths(env
):
101 """Return a 3-tuple of (INCLUDE, LIB, PATH) as the values
102 of those three environment variables that should be set
103 in order to execute the MSVC tools properly."""
109 # See also C:\WINCE600\public\common\oak\misc\wince.bat
111 wince_root
= get_wce600_root(env
)
112 if wince_root
is None:
113 raise SCons
.Errors
.InternalError
, "Windows CE 6.0 SDK not found"
115 os_version
= os
.environ
.get('_WINCEOSVER', '600')
116 platform_root
= os
.environ
.get('_PLATFORMROOT', os
.path
.join(wince_root
, 'platform'))
117 sdk_root
= os
.environ
.get('_SDKROOT' ,os
.path
.join(wince_root
, 'sdk'))
119 platform_root
= os
.environ
.get('_PLATFORMROOT', os
.path
.join(wince_root
, 'platform'))
120 sdk_root
= os
.environ
.get('_SDKROOT' ,os
.path
.join(wince_root
, 'sdk'))
122 host_cpu
= os
.environ
.get('_HOSTCPUTYPE', 'i386')
123 target_cpu
= os
.environ
.get('_TGTCPU', 'x86')
131 project_root
= os
.environ
['_PROJECTROOT']
133 # No project root defined -- use the common stuff instead
134 project_root
= os
.path
.join(wince_root
, 'public', 'common')
136 exe_paths
.append( os
.path
.join(sdk_root
, 'bin', host_cpu
) )
137 exe_paths
.append( os
.path
.join(sdk_root
, 'bin', host_cpu
, target_cpu
) )
138 exe_paths
.append( os
.path
.join(wince_root
, 'common', 'oak', 'bin', host_cpu
) )
139 exe_paths
.append( os
.path
.join(wince_root
, 'common', 'oak', 'misc') )
141 include_paths
.append( os
.path
.join(project_root
, 'sdk', 'inc') )
142 include_paths
.append( os
.path
.join(project_root
, 'oak', 'inc') )
143 include_paths
.append( os
.path
.join(project_root
, 'ddk', 'inc') )
144 include_paths
.append( os
.path
.join(sdk_root
, 'CE', 'inc') )
146 lib_paths
.append( os
.path
.join(project_root
, 'sdk', 'lib', target_cpu
, build
) )
147 lib_paths
.append( os
.path
.join(project_root
, 'oak', 'lib', target_cpu
, build
) )
148 lib_paths
.append( os
.path
.join(project_root
, 'ddk', 'lib', target_cpu
, build
) )
150 include_path
= string
.join( include_paths
, os
.pathsep
)
151 lib_path
= string
.join(lib_paths
, os
.pathsep
)
152 exe_path
= string
.join(exe_paths
, os
.pathsep
)
153 return (include_path
, lib_path
, exe_path
)
157 msvc_sa
.generate(env
)
158 mslib_sa
.generate(env
)
159 mslink_sa
.generate(env
)
161 if not env
.has_key('ENV'):
165 include_path
, lib_path
, exe_path
= get_wce600_paths(env
)
167 env
.PrependENVPath('INCLUDE', include_path
)
168 env
.PrependENVPath('LIB', lib_path
)
169 env
.PrependENVPath('PATH', exe_path
)
170 except (SCons
.Util
.RegError
, SCons
.Errors
.InternalError
):
174 return get_wce600_root(env
) is not None
176 # vim:set ts=4 sw=4 et: