Exemple #1
0
    def build(self):
        if (self.settings.build_type != "Release"):
            raise errors.ConanInvalidConfiguration(
                "Only Release builds are supported.")

        if (self.settings.arch == "x86" or self.settings.arch == "x86_64"):
            # match the arch naming convention used in AppImageKit
            appimagetool_arch_name = "i386" if self.settings.arch == "x86" else self.settings.arch

            tools.download(
                "https://github.com/AppImage/AppImageUpdate/releases/download/%s/appimageupdatetool-%s.AppImage"
                % (self.version, appimagetool_arch_name),
                "appimageupdatetool-%s.AppImage" % appimagetool_arch_name)
        else:
            raise errors.ConanInvalidConfiguration("Unsuported arch: %s" %
                                                   self.settings.arch)

        self.run(
            "chmod +x appimageupdatetool-%s.AppImage && ./appimageupdatetool-%s.AppImage --appimage-extract"
            % (appimagetool_arch_name, appimagetool_arch_name),
            run_environment=True)

        tools.download(
            "https://raw.githubusercontent.com/AppImage/AppImageUpdate/continuous/include/appimage/update.h",
            "update.h")
Exemple #2
0
    def _cmake(self):
        python = Python(self.options.python_executable, self.settings)
        if str(self.options.python_version) != python.version:
            raise errors.ConanInvalidConfiguration(
                "python_version option not compatible with python_executable:"
                "{} != {}".format(str(self.options.python_version),
                                  python.version))
        if self.options.python_debug != python.debug:
            raise errors.ConanInvalidConfiguration(
                "python_debug option not compatible with python_executable.")
        if self.settings.os == "Windows":
            if python.debug and self.settings.build_type != "Debug":
                raise errors.ConanInvalidConfiguration(
                    "Can't build non-debug Lass with debug Python on Windows.")

        cmake = CMake(self)
        defs = {
            "BUILD_TESTING":
            self.develop and not self.in_local_cache,
            "BUILD_SIMD_ALIGNED":
            bool(self.options.simd_aligned),
            "BUILD_WITHOUT_ITERATOR_DEBUGGING":
            bool(self.options.without_iterator_debugging),
            "Lass_PYTHON_VERSION":
            python.version,
            "Python_EXECUTABLE":
            python.executable,
            "Python_LIBRARY_RELEASE":
            python.library,
            "Python_LIBRARY_DEBUG":
            python.library,
        }

        cmake.configure(source_folder=".", defs=defs)
        return cmake
Exemple #3
0
    def configure(self):
        if not str(self.settings.compiler.libcxx) == "libstdc++11":
            self.output.warn("!!!compiler.libcxx is not set to libstdc++11!!!")

        if self.settings.os == "Windows":
            raise errors.ConanInvalidConfiguration(
                "swf-raspi-tutorial is only supported for Linux")
Exemple #4
0
    def __init__(self, executable, settings):
        self._executable = tools.which(str(executable))
        self._os = settings.os

        if not self._executable:
            raise errors.ConanInvalidConfiguration(
                "Python executable cannot be found: {!s}".format(
                    self._executable))
Exemple #5
0
    def build(self):
        if self.settings.os == "Windows":
            if self.settings.compiler == "Visual Studio" and self.settings.compiler.version == "15":  # and (not self.settings.compiler.toolset or self.settings.compiler.toolset == "v141"):
                pass
            elif self.settings.compiler == "Visual Studio" and self.settings.compiler.version == "16" and self.settings.compiler.toolset == "v141":
                pass
            else:
                raise errors.ConanInvalidConfiguration(
                    "Compiler is not supported.")
            with tools.chdir(
                    os.path.join("Python-%s" % self.version, "PCBuild")):
                if self.options.with_tkinter:
                    self.run("get_externals.bat --tkinter-src")
                else:
                    self.run("get_externals.bat")
            if self.options.with_tkinter:
                with tools.chdir(
                        os.path.join("Python-%s" % self.version, "externals")):
                    for filename in glob.glob(os.path.join("**", "X.h"),
                                              recursive=True):
                        tools.replace_in_file(
                            filename, '''#ifndef X_H''', '''
#ifdef _WIN32
#define None Windows_h_None
#define ControlMask  Windows_h_ControlMask
#include <windows.h>
#undef None
#undef ControlMask
#endif

#ifndef X_H''')
            env_build = VisualStudioBuildEnvironment(self)
            with tools.environment_append(env_build.vars):
                with tools.chdir(
                        os.path.join("Python-%s" % self.version, "PCBuild")):
                    with tools.vcvars(self.settings):
                        if self.options.with_tkinter:
                            self.run("prepare_tcltk.bat")
                        self.run("build.bat -p x64 -d")
                        self.run("build.bat -p x64")
        else:
            import stat
            with tools.chdir("Python-%s" % self.version):
                os.chmod(
                    "configure", stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
                    | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH
                    | stat.S_IXOTH)
                atools = AutoToolsBuildEnvironment(self)
                args = []  # ["--enable-shared"] if self.options.shared else []
                atools.configure(args=args)
                atools.make()
                atools.install()
Exemple #6
0
    def build(self):
        cmake = CMake(self)
        if self.settings.compiler == "gcc":
            cmake = CMake(self, generator="Unix Makefiles")

        conan_project_defines = [
            str('-D__APP_VERSION__=\\\"') + str(self.version) + str('\\\"')
        ]

        if float(str(self.settings.compiler.version)) >= 5:
            conan_project_defines.append("-DUSE_CPP14_FEATURES")

        cmake.definitions["CONAN_PROJECT_DEFINES"] = ";".join(
            conan_project_defines)

        # Changes required for cross compilation
        if self.settings.os == "Linux" and self.settings.arch == "armv7":
            for name in self.deps_cpp_info.deps:
                print("#########################################" + name)
            if "arm-linux-gnueabihf" in self.deps_cpp_info.deps:
                # The toolchain version 8.3.0 has to be in /opt/cross-pi-gcc, since this version not location independent.
                if self.settings.compiler.version == "8.3":
                    if not os.path.isdir(os.path.join("/opt", "cross-pi-gcc")):
                        os.mkdir(os.path.join("/opt", "cross-pi-gcc"))

                    old_cwd = os.getcwd()
                    os.chdir(os.path.join("/opt", "cross-pi-gcc"))
                    print(
                        "Installing tool chain to /opt/cross-pi-gcc/ directory..."
                    )
                    os.system(
                        "conan install arm-linux-gnueabihf/8.3.0@raspi/stable -pr swf_linux_to_arm_raspi -s compiler.version="
                        + str(self.settings.compiler.version))
                    print("Installing tool chain done!")
                    os.chdir(old_cwd)

                # Setting environment variables while will be used to get the tool chain.
                os.environ[
                    "RASPBERRYPI_TOOLCHAIN_PATH"] = self.raspberrypi_toolchain_path = os.path.join(
                        "/opt", "cross-pi-gcc"
                    ) if self.settings.compiler.version == "8.3" else str(
                        self.deps_cpp_info["arm-linux-gnueabihf"].rootpath)
                os.environ[
                    "RASPBERRYPI_TARGET_HOST"] = self.raspberrypi_target_host = "arm-linux-gnueabihf"
            else:
                raise errors.ConanInvalidConfiguration(
                    "Raspberry Pi tool chain package not found in the dependencies list, which is required to proceed with the build!"
                )

        cmake.verbose = True
        cmake.configure(source_folder=".")
        cmake.build()
Exemple #7
0
    def get_gn_option_value(self, option_name, build_dir, cwd):
        buf = StringIO()
        self.run('gn args %s --list=%s --short' % (build_dir, option_name), output=buf, cwd=cwd)
        output = buf.getvalue()
        self.output.info("output - %s" %(output))
        pattern = r'%s = (.*)' % (option_name)
        for str in re.findall(pattern,output):
            self.output.info("str - %s" %(str))
            if str == 'true':
                return True
            elif str == 'false':
                return False

        raise errors.ConanInvalidConfiguration("Could not parse gn configuration options because option {} not found in {} due to match {}".format(option_name, output, match))
Exemple #8
0
 def configure(self):
     if self.options.skia_use_metal:
         if not self.settings.os == "iOS" and not self.settings.os == "Macos":
             raise errors.ConanInvalidConfiguration("Metal is only supported on darwin platforms: %s" % self.settings.os) 
     if self.settings.os == "iOS":
         self.options.skia_use_fonthost_mac = False
         self.options.skia_use_system_expat = False
         self.options.skia_use_system_expat = False
         self.options.skia_use_system_harfbuzz = False
         self.options.skia_use_system_icu = False
         self.options.skia_use_system_libjpeg_turbo = False
         self.options.skia_use_system_libpng = False
         self.options.skia_use_system_libwebp = False
         self.options.skia_use_system_zlib = False
Exemple #9
0
    def get_skia_option_value(self, option_name):
        buf = StringIO()
        self.run('bin/gn args out/conan-build --list=%s --short' % (option_name), output=buf, cwd='skia')
        output = buf.getvalue()

        pattern = r'%s = (.*)' % (option_name)
        match = re.match(pattern, output)
        if match:
            if match.group(1) == 'true':
                return True
            elif match.group(1) == 'false':
                return False

        raise errors.ConanInvalidConfiguration("Could not parse gn comfiguration options")
Exemple #10
0
 def validate(self):
     if self.settings.compiler.get_safe("cppstd"):
         tools.check_min_cppstd(self, self._minimum_cpp_standard)
     min_version = self._minimum_compilers_version.get(
         str(self.settings.compiler))
     if not min_version:
         self.output.warn(
             "{} recipe lacks information about the {} compiler support.".
             format(self.name, self.settings.compiler))
     else:
         if tools.Version(self.settings.compiler.version) < min_version:
             raise errors.ConanInvalidConfiguration(
                 "{} requires C++{} support. The current compiler {} {} does not support it."
                 .format(self.name, self._minimum_cpp_standard,
                         self.settings.compiler,
                         self.settings.compiler.version))
Exemple #11
0
    def build(self):
        flags = []
        for k,v in self.deps_cpp_info.dependencies:
            self.output.info("Adding dependency: %s - %s" %(k, v.rootpath))
            flags += ['\\"-I%s/include\\"' % (v.rootpath), '\\"-I%s/include/%s\\"' % (v.rootpath, k)]

        flag_str = 'extra_cflags_cc=[%s]' % ",".join(flags)

        opts = [flag_str]

        for k,v in self.options.items():
            if k in self.skia_options:
                opts += [("%s=%s" % (k,v)).lower()]

        if self.settings.build_type == "Debug":
            opts += ["is_debug=true"]
        else:
            opts += ["is_debug=false"]

        if self.settings.os == "iOS":
            opts += ['target_os=\\"ios\\"']
            if self.settings.arch == "armv8":
                opts += ['target_cpu=\\"arm64\\"']
            else:
                opts += ['target_cpu=\\"x86_64\\"']

        if len(opts) > 0:
            opts = '"--args=%s"' % " ".join(opts)
        else:
            opts = ""

        self.output.info("gn options: %s" % (opts))

        self.run('bin/gn gen out/conan-build %s ' %(opts), cwd="skia")
        failed = False
        for k,v in self.options.items():
            if k in self.skia_options:       
                actual = self.get_skia_option_value(k)
                if not ("%s" % actual) == ("%s" % v):
                    failed = True
                    self.output.warn("Mismatch in %s: %s => %s" % ( k, v, actual ))
        if failed:
            raise errors.ConanInvalidConfiguration("Final gn configuration did not match requested config")
    
        self.run('ninja -C out/conan-build', cwd="skia")
Exemple #12
0
    def configure(self):
        if self.settings.compiler.get_safe("cppstd"):
            tools.check_min_cppstd(self, "14")

        minimum_version = {
            "clang": "3.9",
            "gcc": "6",
            "Visual Studio": "15.0",
        }.get(str(self.settings.compiler))

        if not minimum_version:
            self.output.warn(
                "Unknown compiler {} {}. Assuming compiler supports C++14."
                .format(self.settings.compiler, self.settings.compiler.version))
        else:
            version = tools.Version(self.settings.compiler.version)
            if version < minimum_version:
                raise errors.ConanInvalidConfiguration(
                    "The compiler {} {} does not support C++14."
                    .format(self.settings.compiler, self.settings.compiler.version))
Exemple #13
0
    def build(self):
        flags = []

        # TODO
        #for k,v in self.deps_cpp_info.dependencies:
        #    self.output.info("Adding dependency: %s - %s" %(k, v.rootpath))
        #    flags += ['\\"-I%s/include\\"' % (v.rootpath), '\\"-I%s/include/%s\\"' % (v.rootpath, k)]
        
        # FIX: buildtools/android-unwinding/libunwindstack/DwarfOp.cpp:1439:5: error: array designators are a C99 extension [-Werror,-Wc99-designator]
        cflags = 'extra_cflags=\\"-Wno-c99-designator -Wno-error %s\\"' % (os.environ["CFLAGS"] if "CFLAGS" in os.environ else "")
        cxxflags = 'extra_cxxflags=\\"%s\\"' % (os.environ["CXXFLAGS"] if "CXXFLAGS" in os.environ else "")
        ldflags = 'extra_ldflags=\\"%s\\"' % (os.environ["LDFLAGS"] if "LDFLAGS" in os.environ else "")

        opts = []
        for k,v in self.options.items():
            if k in self.perfetto_options:
                opts += [("%s=%s" % (k,v)).lower()]

        # TODO
        #compiler_command = os.environ.get('CXX', None)
        #cc = "gcc"
        #cxx = "g++"

        if self.settings.build_type == "Debug":
            opts += ["is_debug=true"]
        else:
            opts += ["is_debug=false"]

        self.output.info("self.settings.compiler: %s" % (self.settings.compiler))

        if not self.options.use_bundled_compiler:
            if self.settings.compiler == "apple-clang" or self.settings.compiler == "clang" or self.settings.compiler == "clang-cl":
                opts += ["is_clang=true"]
            else:
                opts += ["is_clang=false"]

        self.output.info("self.settings.os: %s" % (self.settings.os))

        if self.settings.os == "Linux":
            opts += ['target_os=\\"linux\\"']
            if self.settings.arch == "x86_64":
                opts += ['target_cpu=\\"x64\\"']
            else:
                opts += ['target_cpu=\\"x86\\"']

        # NOTE: requires patch with PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN
        if self.settings.os == "Windows":
            opts += ['target_os=\\"windows\\"']
            if self.settings.arch == "x86_64":
                opts += ['target_cpu=\\"x64\\"']
            else:
                opts += ['target_cpu=\\"x86\\"']

        if self.settings.os == "Macos":
            opts += ['target_os=\\"mac\\"']
            if self.settings.arch == "x86_64":
                opts += ['target_cpu=\\"x64\\"']
            else:
                opts += ['target_cpu=\\"x86\\"']

        # NOTE: requires patch with PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM
        if self.settings.os == "Emscripten" or self.settings.arch == "wasm":
            opts += ['target_os=\\"wasm\\"']
            if self.settings.arch == "x86_64":
                opts += ['target_cpu=\\"x64\\"']
            else:
                opts += ['target_cpu=\\"x86\\"']

        if self.settings.os == "iOS":
            opts += ['target_os=\\"ios\\"']
            if self.settings.arch == "armv8":
                opts += ['target_cpu=\\"arm64\\"']
            else:
                opts += ['target_cpu=\\"x64\\"']

        if self.settings.os == "Android":
            opts += ['target_os=\\"android\\"']
            if self.settings.arch == "armv8":
                opts += ['target_cpu=\\"arm64\\"']
            else:
                opts += ['target_cpu=\\"x64\\"']

        opts = '"--args=%s %s %s %s"' % (cflags, cxxflags, ldflags, " ".join(opts))

        self.output.info("gn options: %s" % (opts))

        # Checks that conan options match gn options
        self.run('gn gen out/conan-build %s ' %(opts), cwd=self._source_subfolder)
        failed = False
        failed_options = []
        for k,v in self.options.items():
            if k in self.perfetto_options:       
                actual = self.get_gn_option_value(option_name=k, build_dir="out/conan-build", cwd=self._source_subfolder)
                if not ("%s" % actual) == ("%s" % v):
                    failed = True
                    failed_options.append("in %s: %s => %s" % ( k, v, actual ))
                    self.output.warn("Mismatch in %s: %s => %s" % ( k, v, actual ))
        if failed:
            raise errors.ConanInvalidConfiguration("Final gn configuration did not match requested config for options {}".format(str(failed_options)))
    
        self.run('ninja -C out/conan-build', cwd=self._source_subfolder)
        # ProtoZero is a zero-copy zero-alloc zero-syscall protobuf serialization libary purposefully built for Perfetto's tracing use cases.
        self.run('ninja -C out/conan-build protozero_plugin protoc', cwd=self._source_subfolder)
Exemple #14
0
 def validate(self):
     if self.settings.compiler.value in {"gcc", "clang"}:
         if self.settings.compiler.libcxx in {"libstdc++"}:
             raise errors.ConanInvalidConfiguration(
                 "gcc and clang require C++11 compatible libcxx")