Exemple #1
0
 def parse_option(self, macros: dict, option_block: QPCBlock) -> None:
     if option_block.key in {"options", "libraries", "ignore_libraries"}:
         for item in option_block.get_items_cond(macros):
             if option_block.key == "libraries":
                 if item.key == "-":
                     self.remove_lib(macros, item)
                 else:
                     self.add_lib(macros, item)
             else:
                 self.__dict__[option_block.key].extend(replace_macros_list(macros, *item.get_list()))
                 
     elif not option_block.values:
         return
         
     elif option_block.key in {"output_file", "debug_file"}:
         # TODO: maybe split the extension for output_file, debug_file, or import_library?
         self.__dict__[option_block.key] = clean_path(option_block.values[0], macros)
         
     elif option_block.key in {"import_library", "entry_point"}:
         # TODO: maybe split the extension for output_file, debug_file, or import_library?
         self.__dict__[option_block.key] = replace_macros(option_block.values[0], macros)
         
     elif option_block.key == "ignore_import_library":
         self.ignore_import_library = convert_bool_option(self.ignore_import_library, option_block)
 
     else:
         option_block.error("Unknown Linker Option: ")
Exemple #2
0
 def parse_option(self, macros: dict, option_block: QPCBlock) -> None:
     if option_block.key in ("preprocessor_definitions", "options"):
         for item in option_block.get_items_cond(macros):
             self.__dict__[option_block.key].extend(replace_macros_list(macros, *item.get_list()))
 
     elif option_block.key == "precompiled_header":
         if option_block.values:
             self.precompiled_header = convert_enum_option(self.precompiled_header, option_block, PrecompiledHeader)
 
     elif option_block.key in {"precompiled_header_file", "precompiled_header_output_file"}:
         self.__dict__[option_block.key] = replace_macros(option_block.values[0], macros)
 
     else:
         option_block.error("Unknown Compiler Option: ")
Exemple #3
0
    def parse_option(self, macros: dict, option_block: QPCBlock) -> None:
        # multiple path options
        if option_block.key in {"include_directories", "library_directories", "options"}:
            for item in option_block.get_items_cond(macros):
                self.__dict__[option_block.key].extend(replace_macros_list(macros, *item.get_list()))

        elif option_block.key == "options":
            for item in option_block.get_items_cond(macros):
                self.options.extend(item.get_list())

        if not option_block.values:
            return
        
        if option_block.key in {"out_dir", "int_dir", "build_dir"}:
            value = clean_path(option_block.values[0], macros)
            if option_block.key in {"build_dir", "int_dir"}:
                self.build_dir = value
            else:
                self.out_dir = value
            
        elif option_block.key == "out_name":
            self.out_name = replace_macros(option_block.values[0], macros)
        
        elif option_block.key in {"default_include_directories", "default_library_directories"}:
            self.__dict__[option_block.key] = convert_bool_option(self.__dict__[option_block.key], option_block)
            
        elif option_block.key == "configuration_type":
            self.set_type(option_block)
        elif option_block.key == "language":
            self.set_language(option_block)
        elif option_block.key in {"toolset_version", "compiler"}:
            if option_block.key == "toolset_version":
                if not args.hide_warnings:
                    option_block.warning("toolset_version is now compiler")
            self.compiler = replace_macros(option_block.values[0], macros)
            
        else:
            option_block.error("Unknown General Option: ")