parameters: (conf, target, arch)
docstring: Loads the MSVC compiler for the given target/arch tuple into the current environment
docstring_summary: Loads the MSVC compiler for the given target/arch tuple into the current environment
docstring_tokens: Loads the MSVC compiler for the given target / arch tuple into the current environment
function: def load_msvc_compiler(conf, target, arch):
  	"""
  	Loads the MSVC compiler for the given target/arch tuple into the current environment
  	"""
  	v = conf.env
  
  	# Check if we already have diagnosed problem output for this target/arch tuple
  	# Note: Even if we diagnose a potential problem, this is no longer a fatal error
  	# Any fatal errors will already have occurred during the detect function call above
  	global HAS_DIAGNOSED
  	has_diagnosed = True
  	if not target + '_' + arch in HAS_DIAGNOSED:
  		HAS_DIAGNOSED += [ target + '_' + arch ]
  		has_diagnosed = False
  	verbose = conf.is_option_true('auto_detect_verbose') and not has_diagnosed
  
  	# Get the compiler and SDK to use
  	if  conf.is_option_true('auto_detect_compiler'):
  		sdk, compiler = conf.auto_detect_msvc_compiler(target, arch, verbose, has_diagnosed)
  		type = 'auto-detected'
  	else:
  		sdk, compiler = conf.detect_bootstrapped_msvc_compiler(target, arch, verbose)
  		type = 'bootstrapped'
  		if verbose:
  			Logs.info('[NOTE] Ignoring --auto-detect-verbose when --auto-detect-compiler is disabled')
  		
  	if not has_diagnosed:
  		# Show diagnostics for this target/arch pair
  		Logs.info('[NOTE] Using %s MSVC %s (%s) with Windows SDK %s' % (type, compiler['version'], os.path.split(compiler['bin'])[1], sdk['version']))
  
  	# Apply general paths
  	v['PATH'] = compiler['path'] + sdk['path'] + [sdk['bin']]
  	v['INCLUDES'] = compiler['include'] + sdk['include']
  	v['LIBPATH'] = compiler['lib'] + sdk['lib']
  
  	# Apply programs to use for build
  	v['AR'] = os.path.join(compiler['bin'], 'lib.exe')
  	v['CC'] = v['CXX'] = os.path.join(compiler['bin'], 'cl.exe')
  	v['LINK'] = v['LINK_CC'] = v['LINK_CXX'] = os.path.join(compiler['bin'], 'link.exe')
  	v['MT'] = os.path.join(sdk['bin'], 'mt.exe')
  	v['WINRC'] = os.path.join(sdk['bin'], 'rc.exe')
  	
  	# Verify the tools exist
  	if not os.path.isfile(v['AR']):
  		conf.fatal('C/C++ archiver not found at ' + v['AR'])
  	if not os.path.isfile(v['CC']):
  		conf.fatal('C/C++ compiler not found at ' + v['CC'])
  	if not os.path.isfile(v['LINK']):
  		conf.fatal('C/C++ linker not found at ' + v['LINK'])
  	if not os.path.isfile(v['MT']):
  		conf.fatal('Windows Manifest tool not found at ' + v['MT'])
  	if not os.path.isfile(v['WINRC']):
  		conf.fatal('Windows Resource Compiler tool not found at ' + v['WINRC'])
  
  	# Apply MSVC paths (for later use by MSVC specific build steps)
  	v['MSVC_PATH'] = compiler['root']
  	v['MSVC_VERSION'] = compiler['version']
  	v['MSVC_COMPILER'] = v['CC_NAME'] = v['CXX_NAME'] = 'msvc'
  	v['MSVC_TARGETS'] = [ target ]
  
  	# Apply WINSDK paths (for later use by Windows specific build steps)
  	v['WINSDK_PATH'] = sdk['root']
  	v['WINSDK_VERSION'] = sdk['version']
  	
  	# Apply merged redist path dictionaries
  	v['REDIST_PATH'] = {}
  	v['REDIST_PATH'].update(compiler['redist'])
  	v['REDIST_PATH'].update(sdk['redist'])
  
  	# Add MSVC required path to global path
  	v.env = os.environ.copy()
  	if not 'PATH' in v.env:
  		v.env['PATH'] = ''
  	v.env['PATH'] = ';'.join(v['PATH']) + ';' + v.env['PATH']
  
  	# Strip duplicate paths
  	v.env['PATH'] =';'.join(_preserved_order_remove_duplicates(v.env['PATH'].split(';')))
function_tokens: def load_msvc_compiler ( conf , target , arch ) : v = conf . env # Check if we already have diagnosed problem output for this target/arch tuple # Note: Even if we diagnose a potential problem, this is no longer a fatal error # Any fatal errors will already have occurred during the detect function call above global HAS_DIAGNOSED has_diagnosed = True if not target + '_' + arch in HAS_DIAGNOSED : HAS_DIAGNOSED += [ target + '_' + arch ] has_diagnosed = False verbose = conf . is_option_true ( 'auto_detect_verbose' ) and not has_diagnosed # Get the compiler and SDK to use if conf . is_option_true ( 'auto_detect_compiler' ) : sdk , compiler = conf . auto_detect_msvc_compiler ( target , arch , verbose , has_diagnosed ) type = 'auto-detected' else : sdk , compiler = conf . detect_bootstrapped_msvc_compiler ( target , arch , verbose ) type = 'bootstrapped' if verbose : Logs . info ( '[NOTE] Ignoring --auto-detect-verbose when --auto-detect-compiler is disabled' ) if not has_diagnosed : # Show diagnostics for this target/arch pair Logs . info ( '[NOTE] Using %s MSVC %s (%s) with Windows SDK %s' % ( type , compiler [ 'version' ] , os . path . split ( compiler [ 'bin' ] ) [ 1 ] , sdk [ 'version' ] ) ) # Apply general paths v [ 'PATH' ] = compiler [ 'path' ] + sdk [ 'path' ] + [ sdk [ 'bin' ] ] v [ 'INCLUDES' ] = compiler [ 'include' ] + sdk [ 'include' ] v [ 'LIBPATH' ] = compiler [ 'lib' ] + sdk [ 'lib' ] # Apply programs to use for build v [ 'AR' ] = os . path . join ( compiler [ 'bin' ] , 'lib.exe' ) v [ 'CC' ] = v [ 'CXX' ] = os . path . join ( compiler [ 'bin' ] , 'cl.exe' ) v [ 'LINK' ] = v [ 'LINK_CC' ] = v [ 'LINK_CXX' ] = os . path . join ( compiler [ 'bin' ] , 'link.exe' ) v [ 'MT' ] = os . path . join ( sdk [ 'bin' ] , 'mt.exe' ) v [ 'WINRC' ] = os . path . join ( sdk [ 'bin' ] , 'rc.exe' ) # Verify the tools exist if not os . path . isfile ( v [ 'AR' ] ) : conf . fatal ( 'C/C++ archiver not found at ' + v [ 'AR' ] ) if not os . path . isfile ( v [ 'CC' ] ) : conf . fatal ( 'C/C++ compiler not found at ' + v [ 'CC' ] ) if not os . path . isfile ( v [ 'LINK' ] ) : conf . fatal ( 'C/C++ linker not found at ' + v [ 'LINK' ] ) if not os . path . isfile ( v [ 'MT' ] ) : conf . fatal ( 'Windows Manifest tool not found at ' + v [ 'MT' ] ) if not os . path . isfile ( v [ 'WINRC' ] ) : conf . fatal ( 'Windows Resource Compiler tool not found at ' + v [ 'WINRC' ] ) # Apply MSVC paths (for later use by MSVC specific build steps) v [ 'MSVC_PATH' ] = compiler [ 'root' ] v [ 'MSVC_VERSION' ] = compiler [ 'version' ] v [ 'MSVC_COMPILER' ] = v [ 'CC_NAME' ] = v [ 'CXX_NAME' ] = 'msvc' v [ 'MSVC_TARGETS' ] = [ target ] # Apply WINSDK paths (for later use by Windows specific build steps) v [ 'WINSDK_PATH' ] = sdk [ 'root' ] v [ 'WINSDK_VERSION' ] = sdk [ 'version' ] # Apply merged redist path dictionaries v [ 'REDIST_PATH' ] = { } v [ 'REDIST_PATH' ] . update ( compiler [ 'redist' ] ) v [ 'REDIST_PATH' ] . update ( sdk [ 'redist' ] ) # Add MSVC required path to global path v . env = os . environ . copy ( ) if not 'PATH' in v . env : v . env [ 'PATH' ] = '' v . env [ 'PATH' ] = ';' . join ( v [ 'PATH' ] ) + ';' + v . env [ 'PATH' ] # Strip duplicate paths v . env [ 'PATH' ] = ';' . join ( _preserved_order_remove_duplicates ( v . env [ 'PATH' ] . split ( ';' ) ) )