def __add_file_into_container(self, context, **kwargs): files_container = kwargs['files_container'] file_path = kwargs['file_path'] file_name = kwargs['file_name'] source_group = kwargs['source_group'] real_name = take_name_from_list_case_ignore(context, self.file_lists[file_path], file_name) if real_name: name_to_add = real_name else: if context.ignore_absent_sources: return None name_to_add = file_name message( context, 'Adding absent {} file into project files'.format(file_name), 'warn') files_container[file_path].append(name_to_add) file_path_name = os.path.normpath(os.path.join(file_path, name_to_add)) file_path_name = set_unix_slash(file_path_name) if source_group not in context.source_groups: context.source_groups[source_group] = [] context.source_groups[source_group].append(file_path_name) context.source_groups[source_group].sort(key=str.lower) if real_name: self.include_directive_case_check( context, file_path_name, self.file_lists_for_include_paths) context.file_contexts[file_path_name] = self.__create_file_context( context) return context.file_contexts[file_path_name]
def __set_additional_options(self, context, flag_name, flag_value): """ Set Additional options """ # for setting in context.settings: add_opts = flag_value if add_opts: add_opts = set_unix_slash(add_opts).split() ready_add_opts = [] for add_opt in add_opts: add_opt = add_opt.strip() if '/Qprof-dir' in add_opt: name_value = add_opt.split(':') prof_dir = normalize_path( context, os.path.dirname(context.vcxproj_path), name_value[1]) prof_dir = cleaning_output(context, prof_dir) add_opt = name_value[0] + ':' + prof_dir add_opt = '-' + add_opt[1:] ready_add_opts.append(add_opt) unix_option = add_opt.replace(':', ' ') if 'gen-interfaces' in unix_option: pass elif 'Qprec-div' in unix_option: unix_option = FortranFlags.__get_no_prefix( unix_option) + '-prec-div' elif unix_option == '-static': pass elif 'Qprof-dir' in unix_option: unix_option = unix_option.replace('Qprof-dir', 'prof-dir') elif 'Qprof-gen' in unix_option: unix_option = unix_option.replace('Qprof-gen', 'prof-gen') elif 'Qprof-use' in unix_option: unix_option = unix_option.replace('Qprof-use', 'prof-use') elif 'Qprec-sqrt' in unix_option: unix_option = FortranFlags.__get_no_prefix( unix_option) + '-prec-sqrt' elif 'Qopenmp-lib' in unix_option: unix_option = unix_option.replace('Qopenmp-lib', 'qopenmp-lib') unix_option = unix_option.replace('lib ', 'lib=') else: message( context, 'Unix ifort option "{0}" may be incorrect. ' 'Check it and set it with visual studio UI if possible.' .format(unix_option), 'warn') if ifort_cl_win not in self.flags[flag_name]: self.flags[flag_name][ifort_cl_win] = [] self.flags[flag_name][ifort_cl_win].append(add_opt) if ifort_cl_unix not in self.flags[flag_name]: self.flags[flag_name][ifort_cl_unix] = [] self.flags[flag_name][ifort_cl_unix].append(unix_option) message(context, 'Additional Options : {0}'.format(str(ready_add_opts)), '')
def __write_subdirectories(root_cmake, subdirectories_set, subdirectories_to_project_name): write_comment(root_cmake, 'Sub-projects') subdirectories = list(subdirectories_set) subdirectories.sort(key=str.lower) for subdirectory in subdirectories: binary_dir = '' if '.' in subdirectory[:1]: binary_dir = ' ${{CMAKE_BINARY_DIR}}/{0}'.format( subdirectories_to_project_name[subdirectory]) root_cmake.write('add_subdirectory({0}{1})\n'.format( set_unix_slash(subdirectory), binary_dir)) root_cmake.write('\n')
def __set_link_additional_options(self, context, flag_name, add_opts_node): """ Set Additional options """ add_opts = set_unix_slash(add_opts_node.text).split() ready_add_opts = [] for opt in add_opts: if opt != '%(AdditionalOptions)': ready_add_opts.append(opt) self.flags[ context.current_setting][flag_name][ln_flags] = ready_add_opts message(context, 'Link Additional Options : {}'.format(ready_add_opts), '')
def search_file_path(context, xml_file): """ Util function for checking file in path. """ xml_file = set_unix_slash(xml_file) found_xml_file = get_actual_filename(context, xml_file) if found_xml_file is None: message(context, '{0} file not exists. '.format(xml_file), 'error') return None if found_xml_file != xml_file: message(context, 'file reference probably has wrong case {0}'.format(xml_file), 'warn4') return found_xml_file