Exemplo n.º 1
0
    def convert_conan_options_to_qt_options(
            self, conan_options: Options) -> List[str]:
        qt_options: List[str] = []

        def _option_enabled(options: Dict[str, Any], opt: str) -> bool:
            return opt in options and options[opt] == "yes"

        def _option_disabled(options: Dict[str, Any], opt: str) -> bool:
            return opt in options and options[opt] == "no"

        def _filter_overlapping_options(options: Dict[str, Any]) -> None:
            if _option_enabled(options, "shared") or _option_disabled(
                    options, "static"):
                del _options["static"]  # should result only into "-shared"
            if _option_enabled(options, "static") or _option_disabled(
                    options, "shared"):
                del _options["shared"]  # should result only into "-static"

        _options = {key: value for key, value in conan_options.items()}
        _filter_overlapping_options(_options)

        for option_name, option_value in _options.items():
            qt_option = self.convert_conan_option_to_qt_option(
                name=option_name, value=option_value)
            if not qt_option:
                continue
            qt_options.append(qt_option)
        return qt_options
Exemplo n.º 2
0
    def convert_conan_options_to_qt_options(self, conan_options: Options) -> List[str]:
        qt_options: List[str] = []

        def _option_enabled(opt: str) -> bool:
            return bool(conan_options.get_safe(opt))

        def _option_disabled(opt: str) -> bool:
            return not bool(conan_options.get_safe(opt))

        def _filter_overlapping_options() -> None:
            if _option_enabled("shared") or _option_disabled("static"):
                delattr(conan_options, "static")  # should result only into "-shared"
            if _option_enabled("static") or _option_disabled("shared"):
                delattr(conan_options, "shared")  # should result only into "-static"

        _filter_overlapping_options()

        for option_name, option_value in conan_options.items():
            qt_option = self.convert_conan_option_to_qt_option(
                conan_options=conan_options, name=option_name, value=option_value
            )
            if not qt_option:
                continue
            qt_options.append(qt_option)
        return qt_options
Exemplo n.º 3
0
 def get_cmake_args_for_configure(
         self, conan_options: Options) -> List[Optional[str]]:
     ret: List[Optional[str]] = []
     for option_name, option_value in conan_options.items():
         if option_name == "cmake_args_qtbase" and self.is_used_option(
                 option_value):
             ret = [ret for ret in option_value.strip(r" '\"").split()]
     return ret