Esempio n. 1
0
    def make(self, target=None):
        make_program = self._conanfile.conf["tools.gnu:make_program"]
        if make_program is None:
            make_program = "mingw32-make" if use_win_mingw(self._conanfile) else "make"

        str_args = self._make_args
        jobs = ""
        if "-j" not in str_args and "nmake" not in make_program.lower():
            jobs = make_jobs_cmd_line_arg(self._conanfile) or ""
        command = join_arguments([make_program, target, str_args, jobs])
        self._conanfile.run(command, env=self.environment_files)
Esempio n. 2
0
    def _get_generator(self, recipe_generator):
        # Returns the name of the generator to be used by CMake
        conanfile = self._conanfile

        # Downstream consumer always higher priority
        generator_conf = conanfile.conf.get(
            "tools.cmake.cmaketoolchain:generator")
        if generator_conf:
            return generator_conf

        # second priority: the recipe one:
        if recipe_generator:
            return recipe_generator

        # if not defined, deduce automatically the default one
        compiler = conanfile.settings.get_safe("compiler")
        compiler_version = conanfile.settings.get_safe("compiler.version")

        cmake_years = {
            '8': '8 2005',
            '9': '9 2008',
            '10': '10 2010',
            '11': '11 2012',
            '12': '12 2013',
            '14': '14 2015',
            '15': '15 2017',
            '16': '16 2019',
            '17': '17 2022'
        }

        if compiler == "msvc":
            if compiler_version is None:
                raise ConanException("compiler.version must be defined")
            vs_version = vs_ide_version(self._conanfile)
            return "Visual Studio %s" % cmake_years[vs_version]

        compiler_base = conanfile.settings.get_safe("compiler.base")
        compiler_base_version = conanfile.settings.get_safe(
            "compiler.base.version")

        if compiler == "Visual Studio" or compiler_base == "Visual Studio":
            version = compiler_base_version or compiler_version
            major_version = version.split('.', 1)[0]
            base = "Visual Studio %s" % cmake_years[major_version]
            return base

        if use_win_mingw(conanfile):
            return "MinGW Makefiles"

        return "Unix Makefiles"
Esempio n. 3
0
def get_generator(conanfile):
    # Returns the name of the generator to be used by CMake
    if "CONAN_CMAKE_GENERATOR" in os.environ:
        return os.environ["CONAN_CMAKE_GENERATOR"]

    compiler = conanfile.settings.get_safe("compiler")
    compiler_version = conanfile.settings.get_safe("compiler.version")

    if compiler == "msvc":
        if compiler_version is None:
            raise ConanException("compiler.version must be defined")
        version = compiler_version[:
                                   4]  # Remove the latest version number 19.1X if existing
        try:
            _visuals = {
                '19.0': '14 2015',
                '19.1': '15 2017',
                '19.2': '16 2019'
            }[version]
        except KeyError:
            raise ConanException("compiler.version '{}' doesn't map "
                                 "to a known VS version".format(version))
        base = "Visual Studio %s" % _visuals
        return base

    compiler_base = conanfile.settings.get_safe("compiler.base")
    compiler_base_version = conanfile.settings.get_safe(
        "compiler.base.version")

    if compiler == "Visual Studio" or compiler_base == "Visual Studio":
        version = compiler_base_version or compiler_version
        major_version = version.split('.', 1)[0]
        _visuals = {
            '8': '8 2005',
            '9': '9 2008',
            '10': '10 2010',
            '11': '11 2012',
            '12': '12 2013',
            '14': '14 2015',
            '15': '15 2017',
            '16': '16 2019'
        }.get(major_version, "UnknownVersion %s" % version)
        base = "Visual Studio %s" % _visuals
        return base

    if use_win_mingw(conanfile):
        return "MinGW Makefiles"

    return "Unix Makefiles"
Esempio n. 4
0
    def make(self):
        """if not self._build_type:
            raise ConanException("build_type setting should be defined.")
        with environment_append(vars or self.vars):
            str_args = args_to_string(args)
            cpu_count_option = (("-j%s" % cpu_count(output=self._conanfile.output))
                                if ("-j" not in str_args and "nmake" not in make_program.lower())
                                else None)
            self._conanfile.run("%s" % join_arguments([make_program, target, str_args,
                                                       cpu_count_option]),
                                win_bash=self._win_bash, subsystem=self.subsystem)"""

        make_program = self._conanfile.conf["tools.gnu"].make_program
        if make_program is None:
            make_program = "mingw32-make" if use_win_mingw(
                self._conanfile) else "make"
        # Need to activate the buildenv if existing
        command = make_program
        self._conanfile.run(command)
Esempio n. 5
0
    def _get_generator(self):
        # Returns the name of the generator to be used by CMake
        conanfile = self._conanfile

        compiler = conanfile.settings.get_safe("compiler")
        compiler_version = conanfile.settings.get_safe("compiler.version")

        cmake_years = {
            '8': '8 2005',
            '9': '9 2008',
            '10': '10 2010',
            '11': '11 2012',
            '12': '12 2013',
            '14': '14 2015',
            '15': '15 2017',
            '16': '16 2019'
        }

        if compiler == "msvc":
            if compiler_version is None:
                raise ConanException("compiler.version must be defined")
            vs_version = vs_ide_version(self._conanfile)
            return "Visual Studio %s" % cmake_years[vs_version]

        compiler_base = conanfile.settings.get_safe("compiler.base")
        compiler_base_version = conanfile.settings.get_safe(
            "compiler.base.version")

        if compiler == "Visual Studio" or compiler_base == "Visual Studio":
            version = compiler_base_version or compiler_version
            major_version = version.split('.', 1)[0]
            base = "Visual Studio %s" % cmake_years[major_version]
            return base

        if use_win_mingw(conanfile):
            return "MinGW Makefiles"

        return "Unix Makefiles"