Beispiel #1
0
    def configure(self, build_script_folder=None):
        """
        http://jingfenghanmax.blogspot.com.es/2010/09/configure-with-host-target-and-build.html
        https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html
        """
        source = self._conanfile.source_folder
        if build_script_folder:
            source = os.path.join(self._conanfile.source_folder,
                                  build_script_folder)

        configure_cmd = "{}/configure".format(source)
        subsystem = deduce_subsystem(self._conanfile, scope="build")
        configure_cmd = subsystem_path(subsystem, configure_cmd)
        cmd = "{} {}".format(configure_cmd, self._configure_args)
        self._conanfile.output.info("Calling:\n > %s" % cmd)
        self._conanfile.run(cmd)
Beispiel #2
0
def _generate_aggregated_env(conanfile):
    from conan.tools.microsoft.subsystems import subsystem_path

    def deactivates(filenames):
        # FIXME: Probably the order needs to be reversed
        result = []
        for s in filenames:
            folder, f = os.path.split(s)
            result.append(os.path.join(folder, "deactivate_{}".format(f)))
        return result

    for group, env_scripts in conanfile.env_scripts.items():
        subsystem = deduce_subsystem(conanfile, group)
        bats = []
        shs = []
        for env_script in env_scripts:
            path = os.path.join(conanfile.generators_folder, env_script)
            if env_script.endswith(".bat"):
                bats.append(path)
            elif env_script.endswith(".sh"):
                shs.append(subsystem_path(subsystem, path))
        if shs:

            def sh_content(files):
                return ". " + " && . ".join('"{}"'.format(s) for s in files)

            filename = "conan{}.sh".format(group)
            save(os.path.join(conanfile.generators_folder, filename),
                 sh_content(shs))
            save(
                os.path.join(conanfile.generators_folder,
                             "deactivate_{}".format(filename)),
                sh_content(deactivates(shs)))
        if bats:

            def bat_content(files):
                return "\r\n".join(["@echo off"] +
                                   ['call "{}"'.format(b) for b in files])

            filename = "conan{}.bat".format(group)
            save(os.path.join(conanfile.generators_folder, filename),
                 bat_content(bats))
            save(
                os.path.join(conanfile.generators_folder,
                             "deactivate_{}".format(filename)),
                bat_content(deactivates(bats)))
Beispiel #3
0
    def __init__(self, conanfile, cpp_info):
        self._conanfile = conanfile
        self._subsystem = deduce_subsystem(conanfile, scope="build")

        # From cppinfo, calculated flags
        self.include_paths = self._format_include_paths(cpp_info.includedirs)
        self.lib_paths = self._format_library_paths(cpp_info.libdirs)
        self.defines = self._format_defines(cpp_info.defines)
        self.libs = self._format_libraries(cpp_info.libs)
        self.frameworks = self._format_frameworks(cpp_info.frameworks)
        self.framework_paths = self._format_framework_paths(
            cpp_info.frameworkdirs)
        self.sysroot = self._sysroot_flag(cpp_info.sysroot)

        # Direct flags
        self.cxxflags = cpp_info.cxxflags or []
        self.cflags = cpp_info.cflags or []
        self.sharedlinkflags = cpp_info.sharedlinkflags or []
        self.exelinkflags = cpp_info.exelinkflags or []
        self.system_libs = cpp_info.system_libs or []
Beispiel #4
0
 def __init__(self, conanfile, env, scope):
     self._values = env._values  # {var_name: _EnvValue}, just a reference to the Environment
     self._conanfile = conanfile
     self._scope = scope
     self._subsystem = deduce_subsystem(conanfile, scope)