Exemplo n.º 1
0
	def _get_project_type(self, project):
		converter = MsvsOptionConverter()
		project_options = project.project_options
		msvs_section_name = 'ConfigurationType'
		configuration_type = project_options.get_common_value_for_configurations(project.configurations, msvs_section_name)

		value = converter.convert(msvs_section_name, configuration_type)
		if value == None:
			return 'none'
		else:
			return value
Exemplo n.º 2
0
	def _generate_proj_msvs_configuration_attributes(self, project, configurations):
		msvs_configuration_attributes = {}
		converter = MsvsOptionConverter()

		character_set = converter.convert('CharacterSet', project.project_options.get_common_value_for_configurations(configurations, 'CharacterSet'))
		if character_set != None:
			msvs_configuration_attributes['CharacterSet'] = character_set

		if len(msvs_configuration_attributes) > 0:
			return msvs_configuration_attributes
		else:
			return None
Exemplo n.º 3
0
	def _generate_proj_msvs_settings_part(self, project, configurations, generate_options):
		section = {}
		converter = MsvsOptionConverter()

		for msvs_section_name, option in generate_options.items():
			option_source = option['option_source']
			value = option_source.get_common_value_for_configurations(configurations, msvs_section_name)
			if value != None:
				gyp_section_name = option['gyp_section_name'] if ('gyp_section_name' in option) else msvs_section_name
				converted_value = converter.convert(msvs_section_name, value)
				if converted_value != None:
					section[gyp_section_name] = converted_value

		return section
Exemplo n.º 4
0
		def generate_vcclcompilertool_section():
			generate_options = {}

			compile_options_sourced_parameters = [
				'WarningLevel',
				'Optimization',
				'PreprocessorDefinitions',
				'DebugInformationFormat',
				'RuntimeLibrary',
				'FloatingPointModel',
				'AdditionalOptions',
				'ForcedIncludeFiles',
				'SuppressStartupBanner',
				'FavorSizeOrSpeed',
				'OmitFramePointers',
				'EnableFiberSafeOptimizations',
				'UndefinePreprocessorDefinitions',
				'UndefineAllPreprocessorDefinitions',
				'IgnoreStandardIncludePath',
				'MinimalRebuild',
				'SmallerTypeCheck',
				'BasicRuntimeChecks',
				'StructMemberAlignment',
				'BufferSecurityCheck',
				'EnableEnhancedInstructionSet',
				'FloatingPointExceptions',
				'DisableLanguageExtensions',
				'TreatWChar_tAsBuiltInType',
				'ForceConformanceInForLoopScope',
				'RuntimeTypeInfo',
				'ExpandAttributedSource',
				'AssemblerOutput',
				'AssemblerListingLocation',
				'ProgramDataBaseFileName',
				'GenerateXMLDocumentationFiles',
				'XMLDocumentationFileName',
				'BrowseInformation',
				'BrowseInformationFile',
				'CallingConvention',
				'CompileAs',
				'DisableSpecificWarnings',
				'ForcedUsingFiles',
				'ShowIncludes',
				'UseFullPaths',
				'OmitDefaultLibName',
				'ErrorReporting',
			]
			compile_options = project.compile_options
			for msvs_section_name in compile_options_sourced_parameters:
				generate_options[msvs_section_name] = { 'option_source': compile_options }

			compile_options_sourced_parameters_with_gyp_section_name = {
				'PrecompiledHeader': 'UsePrecompiledHeader',
				'TreatWarningAsError': 'WarnAsError',
				'IntrinsicFunctions': 'EnableIntrinsicFunctions',
				'PreprocessKeepComments': 'KeepComments',
				'FunctionLevelLinking': 'EnableFunctionLevelLinking',
				'OpenMPSupport': 'OpenMP',
				'PrecompiledHeaderFile': 'PrecompiledHeaderThrough',
				'PrecompiledHeaderOutputFile': 'PrecompiledHeaderFile',	
				'ObjectFileName': 'ObjectFile',
			}
			for msvs_section_name, gyp_section_name in compile_options_sourced_parameters_with_gyp_section_name.items():
				generate_options[msvs_section_name] = {
					'option_source': compile_options,
					'gyp_section_name': gyp_section_name,
				}

			project_options = project.project_options
			generate_options['WholeProgramOptimization'] = { 'option_source': project_options }

			section = self._generate_proj_msvs_settings_part(project, configurations, generate_options)

			converter = MsvsOptionConverter()

			# workaround for gyp design. gyp does not recognize 'InlineFunctionExpansion' == 'Disabled', so add '/Ob0' option to 'AdditionalOptions'.
			inline_function_expansion = compile_options.get_common_value_for_configurations(configurations, 'InlineFunctionExpansion')
			if inline_function_expansion != None:
				if inline_function_expansion == 'Disabled':
					if 'AdditionalOptions' not in section:
						section['AdditionalOptions'] = ''
					section['AdditionalOptions'] = '/Ob0' if section['AdditionalOptions'] == '' else section['AdditionalOptions'] + ' /Ob0'
				else:
					section['InlineFunctionExpansion'] = converter.convert('InlineFunctionExpansion', inline_function_expansion)

			# create 'GeneratePreprocessedFile' section. The value of this option depends on two vcxprojc sections, <PreprocessToFile> and <PreprocessSuppressLineNumbers>.
			preprocess_to_file = compile_options.get_common_value_for_configurations(configurations, 'PreprocessToFile')
			preprocess_suppress_line_numbers = compile_options.get_common_value_for_configurations(configurations, 'PreprocessSuppressLineNumbers')
			generate_preprocessed_file = self._get_generate_preprocessed_file(preprocess_to_file, preprocess_suppress_line_numbers)
			if generate_preprocessed_file != None:
				section['GeneratePreprocessedFile'] = generate_preprocessed_file

			# workaround for gyp design. gyp does not recognize 'ExceptionHandling' == 'SyncCThrow', so add '/EHsc' option to 'AdditionalOptions'.
			exception_handling = compile_options.get_common_value_for_configurations(configurations, 'ExceptionHandling')
			if exception_handling != None:
				if exception_handling == 'SyncCThrow':
					if 'AdditionalOptions' not in section:
						section['AdditionalOptions'] = ''
					section['AdditionalOptions'] = '/EHsc' if section['AdditionalOptions'] == '' else section['AdditionalOptions'] + ' /EHsc'
				else:
					section['ExceptionHandling'] = converter.convert('ExceptionHandling', exception_handling)

			return section
Exemplo n.º 5
0
		def generate_vclinkertool_section():
			generate_options = {}

			link_options_sourced_parameters = [
				'SubSystem',
				'GenerateDebugInformation',
				'EnableCOMDATFolding',
				'OptimizeReferences',
				'OutputFile',
				'Version',
				'SuppressStartupBanner',
				'RegisterOutput',
				'PerUserRedirection',
				'AdditionalLibraryDirectories',
				'IgnoreAllDefaultLibraries',
				'ModuleDefinitionFile',
				'AddModuleNamesToAssembly',
				'EmbedManagedResourceFile',
				'ForceSymbolReferences',
				'DelayLoadDLLs',
				'AssemblyLinkResource',
				'ManifestFile',
				'AdditionalManifestDependencies',
				'AllowIsolation',
				'EnableUAC',
				'UACExecutionLevel',
				'UACUIAccess',
				'ProgramDatabaseFile',
				'StripPrivateSymbols',
				'GenerateMapFile',
				'MapFileName',
				'MapExports',
				'AssemblyDebug',
				'HeapReserveSize',
				'HeapCommitSize',
				'StackReserveSize',
				'StackCommitSize',
				'LargeAddressAware',
				'TerminalServerAware',
				'SwapRunFromCD',
				'Driver',
				'FunctionOrder',
				'ProfileGuidedDatabase',
				'LinkTimeCodeGeneration',
				'MidlCommandFile',
				'IgnoreEmbeddedIDL',
				'MergedIDLBaseFileName',
				'TypeLibraryFile',
				'TypeLibraryResourceID',
				'EntryPointSymbol',
				'SetChecksum',
				'BaseAddress',
				'RandomizedBaseAddress',
				'FixedBaseAddress',
				'DataExecutionPrevention',
				'TurnOffAssemblyGeneration',
				'SupportUnloadOfDelayLoadedDLL',
				'ImportLibrary',
				'MergeSections',
				'TargetMachine',
				'Profile',
				'CLRThreadAttribute',
				'CLRImageType',
				'KeyContainer',
				'CLRUnmanagedCodeCheck',
				'ExportNamedFunctions',
			]
			link_options = project.link_options
			for msvs_section_name in link_options_sourced_parameters:
				generate_options[msvs_section_name] = { 'option_source': link_options }

			properties_sourced_parameters = [
				'LinkIncremental',
				'IgnoreImportLibrary',
				'GenerateManifest',
			]
			properties = project.properties
			for msvs_section_name in properties_sourced_parameters:
				generate_options[msvs_section_name] = { 'option_source': properties }


			project_reference_sourced_parameters = [
				'LinkLibraryDependencies',
				'UseLibraryDependencyInputs',
			]
			project_reference = project.project_reference
			for msvs_section_name in project_reference_sourced_parameters:
				generate_options[msvs_section_name] = { 'option_source': project_reference }

			link_options_sourced_parameters_with_gyp_section_name = {
				'IgnoreSpecificDefaultLibraries': ('IgnoreSpecificDefaultLibraries' if is_static_library else 'IgnoreDefaultLibraryNames'),
				'SwapRunFromNET': 'SwapRunFromNet',
			}
			for msvs_section_name, gyp_section_name in link_options_sourced_parameters_with_gyp_section_name.items():
				generate_options[msvs_section_name] = {
					'option_source': link_options,
					'gyp_section_name': gyp_section_name,
				}

			section = self._generate_proj_msvs_settings_part(project, configurations, generate_options)

			converter = MsvsOptionConverter()

			# AdditionalDependencies
			additional_dependencies = link_options.get_common_value_for_configurations(configurations, 'AdditionalDependencies')
			if additional_dependencies == None:
				all_none = True
				for config in configurations:
					if link_options.get(config) != None:
						all_none = False
						break
				if all_none:
					section['AdditionalDependencies'] = ['%(AdditionalDependencies)']
			elif len(additional_dependencies) > 0:
				section['AdditionalDependencies'] = additional_dependencies

			# workaround for gyp design. gyp does not recognize 'ShowProgress' == 'LinkVerboseICF', 'LinkVerboseREF', 'LinkVerboseSAFESEH', or 'LinkVerboseCLR'.
			show_progress = link_options.get_common_value_for_configurations(configurations, 'ShowProgress')
			if show_progress != None:
				show_progress_gyp_value = converter.convert('ShowProgress', show_progress)
				if show_progress_gyp_value == None:
					mapping = {
						'LinkVerboseICF': '/VERBOSE:ICF',
						'LinkVerboseREF': '/VERBOSE:REF',
						'LinkVerboseSAFESEH': '/VERBOSE:SAFESEH',
						'LinkVerboseCLR': '/VERBOSE:SAFESEH',
					}
					if show_progress in mapping:
						prev = ''
						if 'AdditionalOptions' not in section:
							section['AdditionalOptions'] = ''
						else:
							prev = section['AdditionalOptions']
						prev = (' ' if len(prev) > 0 else '') + mapping[show_progress]
						section['AdditionalOptions'] = prev
				else:
					section['ShowProgress'] = show_progress_gyp_value

			# workaround for gyp design. gyp does not recognize 'LinkErrorReporting' == 'SendErrorReport'.
			link_error_reporting = link_options.get_common_value_for_configurations(configurations, 'LinkErrorReporting')
			if link_error_reporting != None:
				draft_link_error_reporting = converter.convert('LinkErrorReporting', link_error_reporting)
				if draft_link_error_reporting == None:
					if link_error_reporting == 'SendErrorReport':
						prev = ''
						if 'AdditionalOptions' not in section:
							section['AdditionalOptions'] = ''
						else:
							prev = section['AdditionalOptions']
						prev = (' ' if len(prev) > 0 else '') +  '/ERRORREPORT:SEND'
						section['AdditionalOptions'] = prev
				else:
					section['ErrorReporting'] = draft_link_error_reporting

			return section