MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / build_environment

Function build_environment

Tools/Support/PortableMSVCWrapper.py:167–214  ·  view source on GitHub ↗
(root: Path, wine_prefix: Path, wine: str, msvc_root: Path, sdk_root: Path, sdk_version: str, target_arch: str)

Source from the content-addressed store, hash-verified

165
166
167def build_environment(root: Path, wine_prefix: Path, wine: str, msvc_root: Path, sdk_root: Path, sdk_version: str, target_arch: str):
168 environment = os.environ.copy()
169 environment["WINEPREFIX"] = str(wine_prefix)
170 environment["WINEARCH"] = "win64"
171 environment["WINEDLLOVERRIDES"] = "winemenubuilder.exe=d;winedbg.exe=d;vctip.exe=d"
172 environment["WINEDEBUG"] = "-all"
173 environment["MVK_CONFIG_LOG_LEVEL"] = "0"
174
175 temp_directory = root / "tmp"
176 temp_directory.mkdir(parents=True, exist_ok=True)
177 temp_win = posix_to_windows(str(temp_directory))
178
179 msvc_root_win = posix_to_windows(str(msvc_root))
180 sdk_root_win = posix_to_windows(str(sdk_root))
181 host_bin_win = f"{msvc_root_win}\\bin\\Hostx64\\{target_arch}"
182 sdk_host_arch = resolve_sdk_tool_arch(target_arch)
183 sdk_bin_root_win = f"{sdk_root_win}\\bin\\{sdk_version}"
184
185 path_entries = [host_bin_win]
186 sdk_tool_root = sdk_root / "bin" / sdk_version / sdk_host_arch
187 if sdk_tool_root.is_dir():
188 path_entries.append(f"{sdk_bin_root_win}\\{sdk_host_arch}")
189 sdk_ucrt_root = sdk_tool_root / "ucrt"
190 if sdk_ucrt_root.is_dir():
191 path_entries.append(f"{sdk_bin_root_win}\\{sdk_host_arch}\\ucrt")
192 path_entries.append("C:\\windows\\system32")
193
194 environment["PATH"] = ";".join(path_entries)
195 environment["INCLUDE"] = ";".join(
196 (
197 f"{msvc_root_win}\\include",
198 f"{sdk_root_win}\\Include\\{sdk_version}\\ucrt",
199 f"{sdk_root_win}\\Include\\{sdk_version}\\shared",
200 f"{sdk_root_win}\\Include\\{sdk_version}\\um",
201 f"{sdk_root_win}\\Include\\{sdk_version}\\winrt",
202 f"{sdk_root_win}\\Include\\{sdk_version}\\cppwinrt",
203 )
204 )
205 environment["LIB"] = ";".join(
206 (
207 f"{msvc_root_win}\\lib\\{target_arch}",
208 f"{sdk_root_win}\\Lib\\{sdk_version}\\ucrt\\{target_arch}",
209 f"{sdk_root_win}\\Lib\\{sdk_version}\\um\\{target_arch}",
210 )
211 )
212 environment["TMP"] = temp_win
213 environment["TEMP"] = temp_win
214 return environment
215
216
217def tool_executable(msvc_root: Path, target_arch: str, tool_name: str):

Callers 1

mainFunction · 0.85

Calls 4

resolve_sdk_tool_archFunction · 0.85
posix_to_windowsFunction · 0.70
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected