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_paths(env
):
80 """Return a 3-tuple of (INCLUDE, LIB, PATH) as the values
81 of those three environment variables that should be set
82 in order to execute the MSVC tools properly."""
88 # See also C:\WINCE600\public\common\oak\misc\wince.bat
90 os_version
= os
.environ
.get('_winceosver', '600')
91 wince_root
= os
.environ
.get('_winceroot', r
'C:\WINCE600')
92 platform_root
= os
.environ
.get('_platformroot', os
.path
.join(wince_root
, 'platform'))
93 sdk_root
= os
.environ
.get('_sdkroot' ,os
.path
.join(wince_root
, 'sdk'))
95 platform_root
= os
.environ
.get('_platformroot', os
.path
.join(wince_root
, 'platform'))
96 sdk_root
= os
.environ
.get('_sdkroot' ,os
.path
.join(wince_root
, 'sdk'))
98 host_cpu
= os
.environ
.get('_hostcputype', 'i386')
99 target_cpu
= os
.environ
.get('_tgtcpu', 'x86')
107 project_root
= os
.environ
['_projectroot']
109 # No project root defined -- use the common stuff instead
110 project_root
= os
.path
.join(wince_root
, 'public', 'common')
112 exe_paths
.append( os
.path
.join(sdk_root
, 'bin', host_cpu
) )
113 exe_paths
.append( os
.path
.join(sdk_root
, 'bin', host_cpu
, target_cpu
) )
114 exe_paths
.append( os
.path
.join(wince_root
, 'common', 'oak', 'bin', host_cpu
) )
115 exe_paths
.append( os
.path
.join(wince_root
, 'common', 'oak', 'misc') )
117 include_paths
.append( os
.path
.join(project_root
, 'sdk', 'inc') )
118 include_paths
.append( os
.path
.join(project_root
, 'oak', 'inc') )
119 include_paths
.append( os
.path
.join(project_root
, 'ddk', 'inc') )
120 include_paths
.append( os
.path
.join(sdk_root
, 'CE', 'inc') )
122 lib_paths
.append( os
.path
.join(project_root
, 'sdk', 'lib', target_cpu
, build
) )
123 lib_paths
.append( os
.path
.join(project_root
, 'oak', 'lib', target_cpu
, build
) )
124 lib_paths
.append( os
.path
.join(project_root
, 'ddk', 'lib', target_cpu
, build
) )
126 include_path
= string
.join( include_paths
, os
.pathsep
)
127 lib_path
= string
.join(lib_paths
, os
.pathsep
)
128 exe_path
= string
.join(exe_paths
, os
.pathsep
)
129 return (include_path
, lib_path
, exe_path
)
133 msvc_sa
.generate(env
)
134 mslib_sa
.generate(env
)
135 mslink_sa
.generate(env
)
137 if not env
.has_key('ENV'):
141 include_path
, lib_path
, exe_path
= get_wce600_paths(env
)
143 env
.PrependENVPath('INCLUDE', include_path
)
144 env
.PrependENVPath('LIB', lib_path
)
145 env
.PrependENVPath('PATH', exe_path
)
146 except (SCons
.Util
.RegError
, SCons
.Errors
.InternalError
):
150 if not msvc_sa
.exits(env
):
152 if not mslib_sa
.exits(env
):
154 if not mslink_sa
.exits(env
):
158 # vim:set ts=4 sw=4 et: