Пример #1
0
def _generate_aggregated_env(conanfile):
    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 = []
        ps1s = []
        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))
            elif env_script.endswith(".ps1"):
                ps1s.append(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)))
        if ps1s:

            def ps1_content(files):
                return "\r\n".join(['& "{}"'.format(b) for b in files])

            filename = "conan{}.ps1".format(group)
            save(os.path.join(conanfile.generators_folder, filename),
                 ps1_content(ps1s))
            save(
                os.path.join(conanfile.generators_folder,
                             "deactivate_{}".format(filename)),
                ps1_content(deactivates(ps1s)))
Пример #2
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)
Пример #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_frameworks(cpp_info.frameworkdirs,
                                                       is_path=True)

        # 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 = self._format_libraries(cpp_info.system_libs)
Пример #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)
Пример #5
0
def unix_path(conanfile, path):
    if not conanfile.win_bash:
        return path
    subsystem = deduce_subsystem(conanfile, scope="build")
    return subsystem_path(subsystem, path)