示例#1
0
 def _configure_cmake(self):
     cmake = CMake(self)
     if tools.Version(self.version) < "1.1":
         cmake.definitions["ENABLE_ENCODERS"] = self.options.enable_encoders
         cmake.definitions["ENABLE_DECODERS"] = self.options.enable_decoders
     else:
         cmake.definitions["BUILD_WRITERS"] = self.options.enable_encoders
         cmake.definitions["BUILD_READERS"] = self.options.enable_decoders
         cmake.definitions["BUILD_EXAMPLES"] = False
         cmake.definitions["BUILD_BLACKBOX_TESTS"] = False
     if is_msvc(self):
         cmake.definitions["LINK_CPP_STATICALLY"] = "MT" in str(
             self.settings.compiler.runtime)
     cmake.configure(build_folder=self._build_subfolder)
     return cmake
示例#2
0
 def package(self):
     self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder)
     with tools.environment_append(
         VisualStudioBuildEnvironment(self).vars
     ) if is_msvc(self) else tools.no_op():
         meson = self._configure_meson()
         meson.install()
         self._fix_library_names()
     tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
     shutil.move(
         os.path.join(self.package_folder, "share"),
         os.path.join(self.package_folder, "res"),
     )
     for pdb_file in glob.glob(os.path.join(self.package_folder, "bin", "*.pdb")):
         os.unlink(pdb_file)
示例#3
0
 def validate(self):
     if self.settings.os != "Windows":
         raise ConanInvalidConfiguration("Only os=Windows is supported")
     # if not is_msvc(self):
     #     raise ConanInvalidConfiguration("Only the MSVC compiler is supported")
     if is_msvc(self) and not is_msvc_static_runtime(self):
         # Debug and/or dynamic runtime is undesired for a hooking library
         raise ConanInvalidConfiguration(
             "Only static runtime is supported (MT)")
     if self.settings.build_type != "Release":
         raise ConanInvalidConfiguration(
             "Detours only supports the Release build type")
     try:
         self.output.info(f"target process is {self._target_processor}")
     except KeyError:
         raise ConanInvalidConfiguration("Unsupported architecture")
示例#4
0
    def build(self):
        apply_conandata_patches(self)

        at = Autotools(self)

        build_script_folder = self._source_subfolder
        if is_msvc(self):
            self.conf["tools.gnu:make_program"] = "nmake"
            build_script_folder = os.path.join(build_script_folder, "win32")

            if "TMP" in os.environ:  # workaround for TMP in CCI containing both forward and back slashes
                os.environ["TMP"] = os.environ["TMP"].replace("/", "\\")

        with tools.vcvars(self):
            at.configure(build_script_folder=build_script_folder)
            at.make()
示例#5
0
def test_is_msvc(compiler, expected):
    settings = Settings({
        "build_type": ["Release"],
        "compiler": {
            compiler: {
                "version": ["2022"]
            }
        },
        "os": ["Windows"],
        "arch": ["x86_64"]
    })
    conanfile = ConanFile(Mock(), None)
    conanfile.settings = "os", "compiler", "build_type", "arch"
    conanfile.initialize(settings, EnvValues())
    conanfile.settings.compiler = compiler
    assert is_msvc(conanfile) == expected
示例#6
0
    def package_info(self):
        self.cpp_info.set_property("cmake_file_name", "minizip")
        self.cpp_info.set_property("cmake_target_name", "MINIZIP::minizip")
        self.cpp_info.set_property("pkg_config_name", "minizip")

        # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed
        prefix = "lib" if is_msvc(self) or self._is_clang_cl else ""
        suffix = "" if tools.Version(
            self.version) < "3.0.5" or self.options.mz_compatibility else "-ng"
        self.cpp_info.components["minizip"].libs = [f"{prefix}minizip{suffix}"]
        if self.options.with_lzma:
            self.cpp_info.components["minizip"].defines.append("HAVE_LZMA")
        if tools.is_apple_os(
                self.settings.os) and self.options.get_safe("with_libcomp"):
            self.cpp_info.components["minizip"].defines.append("HAVE_LIBCOMP")
        if self.options.with_bzip2:
            self.cpp_info.components["minizip"].defines.append("HAVE_BZIP2")

        # TODO: to remove in conan v2 once cmake_find_package_* generators removed
        self.cpp_info.filenames["cmake_find_package"] = "minizip"
        self.cpp_info.filenames["cmake_find_package_multi"] = "minizip"
        self.cpp_info.names["cmake_find_package"] = "MINIZIP"
        self.cpp_info.names["cmake_find_package_multi"] = "MINIZIP"
        self.cpp_info.names["pkg_config"] = "minizip"
        self.cpp_info.components["minizip"].names[
            "cmake_find_package"] = "minizip"
        self.cpp_info.components["minizip"].names[
            "cmake_find_package_multi"] = "minizip"
        self.cpp_info.components["minizip"].set_property(
            "cmake_target_name", "MINIZIP::minizip")
        self.cpp_info.components["minizip"].set_property(
            "pkg_config_name", "minizip")
        if self.options.get_safe("with_zlib"):
            self.cpp_info.components["minizip"].requires.append("zlib::zlib")
        if self.options.with_bzip2:
            self.cpp_info.components["minizip"].requires.append("bzip2::bzip2")
        if self.options.with_lzma:
            self.cpp_info.components["minizip"].requires.append(
                "xz_utils::xz_utils")
        if self.options.with_zstd:
            self.cpp_info.components["minizip"].requires.append("zstd::zstd")
        if self.options.with_openssl:
            self.cpp_info.components["minizip"].requires.append(
                "openssl::openssl")
        if self.settings.os != "Windows" and self.options.with_iconv:
            self.cpp_info.components["minizip"].requires.append(
                "libiconv::libiconv")
示例#7
0
 def validate(self):
     if hasattr(self, 'settings_build') and tools.cross_building(
             self, skip_x64_x86=True):
         raise ConanInvalidConfiguration("Cross-building not implemented")
     if tools.Version(
             self.version) >= "2.69.0" and not self.options.with_pcre:
         raise ConanInvalidConfiguration(
             "option glib:with_pcre must be True for glib >= 2.69.0")
     if self.settings.os == "Windows" and not self.options.shared and tools.Version(
             self.version) < "2.71.1":
         raise ConanInvalidConfiguration(
             "glib < 2.71.1 can not be built as static library on Windows. "
             "see https://gitlab.gnome.org/GNOME/glib/-/issues/692")
     if tools.Version(self.version) < "2.67.0" and not is_msvc(
             self) and not self.options.with_elf:
         raise ConanInvalidConfiguration(
             "libelf dependency can't be disabled in glib < 2.67.0")
示例#8
0
 def package(self):
     self.copy("LICENSE.TXT", dst="licenses", src=self._source_subfolder)
     if is_msvc(self):
         with self._msvc_build_environment():
             self.run("nmake -f makefile.vc devinstall {}".format(" ".join(
                 self._nmake_args)))
         tools.remove_files_by_mask(
             os.path.join(self.package_folder, "lib"), "*.pdb")
     else:
         with self._autotools_build_environment():
             autotools = self._configure_autotools()
             autotools.install()
         tools.rmdir(os.path.join(self.package_folder, "lib",
                                  "gdalplugins"))
         tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
         tools.remove_files_by_mask(
             os.path.join(self.package_folder, "lib"), "*.la")
示例#9
0
    def package(self):
        self.copy("COPYING", dst="licenses", src=self._source_subfolder)
        with self._build_context():
            autotools = self._configure_autotools()
            autotools.install()
        tools.rmdir(os.path.join(self.package_folder, "share"))
        tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
        tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"),
                                   "*.la")
        tools.remove_files_by_mask(
            os.path.join(self.package_folder, "include", "gsl"), "*.c")

        os.unlink(os.path.join(self.package_folder, "bin", "gsl-config"))

        if is_msvc(self) and self.options.shared:
            pjoin = lambda p: os.path.join(self.package_folder, "lib", p)
            rename(self, pjoin("gsl.dll.lib"), pjoin("gsl.lib"))
            rename(self, pjoin("gslcblas.dll.lib"), pjoin("gslcblas.lib"))
示例#10
0
 def _configure_cmake(self):
     cmake = CMake(self)
     cmake.definitions[
         "SFML_DEPENDENCIES_INSTALL_PREFIX"] = self.package_folder
     cmake.definitions["SFML_MISC_INSTALL_PREFIX"] = os.path.join(
         self.package_folder, "licenses").replace("\\", "/")
     cmake.definitions["SFML_BUILD_WINDOW"] = self.options.window
     cmake.definitions["SFML_BUILD_GRAPHICS"] = self.options.graphics
     cmake.definitions["SFML_BUILD_NETWORK"] = self.options.network
     cmake.definitions["SFML_BUILD_AUDIO"] = self.options.audio
     cmake.definitions["SFML_INSTALL_PKGCONFIG_FILES"] = False
     cmake.definitions["SFML_GENERATE_PDB"] = False
     cmake.definitions["SFML_USE_SYSTEM_DEPS"] = True
     if is_msvc(self):
         cmake.definitions[
             "SFML_USE_STATIC_STD_LIBS"] = is_msvc_static_runtime(self)
     cmake.configure(build_folder=self._build_subfolder)
     return cmake
示例#11
0
    def package(self):
        self.copy("COPYING.LIB", src=self._source_subfolder, dst="licenses")
        with self._build_context():
            autotools = self._configure_autotools()
            autotools.install()

        tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"),
                                   "*.la")
        tools.rmdir(os.path.join(self.package_folder, "share"))

        if (is_msvc(self) or self._is_clang_cl) and self.options.shared:
            for import_lib in ["iconv", "charset"]:
                rename(
                    self,
                    os.path.join(self.package_folder, "lib",
                                 "{}.dll.lib".format(import_lib)),
                    os.path.join(self.package_folder, "lib",
                                 "{}.lib".format(import_lib)))
示例#12
0
 def configure(self):
     if self.options.shared:
         del self.options.fPIC
     if self.settings.arch not in ["x86", "x86_64"]:
         del self.options.simd_intrinsics
     if self.options.without_lerc:
         del self.options.with_zstd
     # if self.options.with_spatialite:
     #     del self.options.with_sqlite3
     if not self.options.get_safe("with_sqlite3", False):
         del self.options.with_pcre
         del self.options.with_pcre2
     if is_msvc(self):
         del self.options.threadsafe
         del self.options.with_null
         del self.options.with_zlib  # zlib and png are always used in nmake build,
         del self.options.with_png  # and it's not trivial to fix
     self._strict_options_requirements()
示例#13
0
    def package_info(self):
        self.cpp_info.set_property("cmake_file_name", "antlr4-runtime")
        self.cpp_info.set_property("cmake_target_name", "antlr4_shared" if self.options.shared else "antlr4_static")
        libname = "antlr4-runtime"
        if is_msvc(self) and not self.options.shared:
            libname += "-static"
        self.cpp_info.libs = [libname]
        self.cpp_info.includedirs.append(os.path.join("include", "antlr4-runtime"))
        if self.settings.os == "Windows" and not self.options.shared:
            self.cpp_info.defines.append("ANTLR4CPP_STATIC")
        if self.settings.os in ("FreeBSD", "Linux"):
            self.cpp_info.system_libs = ["pthread"]

        # TODO: to remove in conan v2 once cmake_find_package* generatores removed
        self.cpp_info.filenames["cmake_find_package"] = "antlr4-runtime"
        self.cpp_info.filenames["cmake_find_package_multi"] = "antlr4-runtime"
        self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path]
        self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path]
示例#14
0
    def _configure_cmake(self):
        cmake = CMake(self)
        cmake.definitions["THREADSAFE"] = self.options.threadsafe
        cmake.definitions["USE_SSH"] = self.options.with_libssh2

        cmake.definitions["USE_ICONV"] = self.options.get_safe("with_iconv", False)

        cmake.definitions["USE_HTTPS"] = self._cmake_https[str(self.options.with_https)]
        cmake.definitions["SHA1_BACKEND"] = self._cmake_sha1[str(self.options.with_sha1)]

        cmake.definitions["BUILD_CLAR"] = False
        cmake.definitions["BUILD_EXAMPLES"] = False

        if is_msvc(self):
            cmake.definitions["STATIC_CRT"] = is_msvc_static_runtime(self)

        cmake.configure()
        return cmake
示例#15
0
 def _build_context(self):
     if is_msvc(self):
         with tools.vcvars(self.settings):
             msvc_cl_sh = os.path.join(self.build_folder,
                                       "msvc_cl.sh").replace("\\", "/")
             env = {
                 "AR": "lib",
                 "CC": msvc_cl_sh,
                 "CXX": msvc_cl_sh,
                 "LD": msvc_cl_sh,
                 "NM": "dumpbin -symbols",
                 "OBJDUMP": ":",
                 "RANLIB": ":",
                 "STRIP": ":",
             }
             with tools.environment_append(env):
                 yield
     else:
         yield
示例#16
0
    def package_info(self):
        self.cpp_info.set_property("cmake_file_name", "yaml-cpp")
        self.cpp_info.set_property("cmake_target_name", "yaml-cpp")
        self.cpp_info.set_property("pkg_config_name", "yaml-cpp")
        self.cpp_info.libs = tools.collect_libs(self)
        if self.settings.os in ("Linux", "FreeBSD"):
            self.cpp_info.system_libs.append("m")
        if is_msvc(self):
            self.cpp_info.defines.append("_NOEXCEPT=noexcept")
            if self.options.shared:
                self.cpp_info.defines.append("YAML_CPP_DLL")

        # TODO: to remove in conan v2 once cmake_find_package_* generators removed
        self.cpp_info.build_modules["cmake_find_package"] = [
            self._module_file_rel_path
        ]
        self.cpp_info.build_modules["cmake_find_package_multi"] = [
            self._module_file_rel_path
        ]
示例#17
0
 def _build_context(self):
     if is_msvc(self):
         with tools.vcvars(self):
             env = {
                 "CC":
                 "cl -nologo",
                 "CXX":
                 "cl -nologo",
                 "LD":
                 "link -nologo",
                 "AR":
                 "{} lib".format(
                     tools.unix_path(
                         self._user_info_build["automake"].ar_lib)),
             }
             with tools.environment_append(env):
                 yield
     else:
         yield
示例#18
0
    def validate(self):
        if self.settings.compiler.get_safe("cppstd"):
            tools.check_min_cppstd(self, 17)

        minimum_version = self._compiler_required_cpp17.get(
            str(self.settings.compiler), False)
        if minimum_version:
            if tools.Version(self.settings.compiler.version) < minimum_version:
                raise tools.ConanInvalidConfiguration(
                    "{} requires C++17, which your compiler does not support.".
                    format(self.name))
        else:
            self.output.warn(
                "{0} requires C++17. Your compiler is unknown. Assuming it supports C++17."
                .format(self.name))

        if is_msvc(self) and self.options.shared:
            raise tools.ConanInvalidConfiguration(
                "{} does not support shared build in MSVC".format(self.name))
示例#19
0
    def validate(self):
        # In 1.2.2, arsenalgear doesn't support Visual Studio.
        if is_msvc(self):
            raise ConanInvalidConfiguration(
                "{} doesn't support Visual Studio(yet)".format(self.name))

        if self.settings.compiler.get_safe("cppstd"):
            tools.check_min_cppstd(self, 17)

        minimum_version = self._compiler_required_cpp17.get(
            str(self.settings.compiler), False)
        if minimum_version:
            if tools.Version(self.settings.compiler.version) < minimum_version:
                raise ConanInvalidConfiguration(
                    "{} requires C++17, which your compiler does not support.".
                    format(self.name))
        else:
            self.output.warn(
                "{0} requires C++17. Your compiler is unknown. Assuming it supports C++17."
                .format(self.name))
示例#20
0
    def package_info(self):
        libname = "dime"
        if self.settings.os == "Windows" and is_msvc(self):
            libname = "{}{}{}{}".format(
                libname,
                tools.Version(self.version).major,
                "" if self.options.shared else "s",
                "d" if self.settings.build_type == "Debug" else "",
            )
        self.cpp_info.libs = [libname]

        if self.settings.os == "Windows":
            self.cpp_info.cxxflags.append(
                "-DDIME_DLL" if self.options.shared else "-DDIME_NOT_DLL")
        if self.options.fixbig:
            self.cpp_info.cxxflags.append("-DDIME_FIXBIG")

        bindir = os.path.join(self.package_folder, "bin")
        self.output.info(
            "Appending PATH environment variable: {}".format(bindir))
        self.env_info.PATH.append(bindir)
示例#21
0
    def package(self):
        self.copy("COPYING", dst="licenses", src=self._source_subfolder)
        meson = self._configure_meson()
        meson.install()
        if is_msvc(self):
            tools.remove_files_by_mask(
                os.path.join(self.package_folder, "bin"), "*.pdb")
            if not self.options.shared:
                rename(
                    self,
                    os.path.join(
                        self.package_folder,
                        "lib",
                        f"libcairomm-{self._abi_version()}.a",
                    ),
                    os.path.join(self.package_folder, "lib",
                                 f"cairomm-{self._abi_version()}.lib"),
                )

        for header_file in glob.glob(
                os.path.join(
                    self.package_folder,
                    "lib",
                    f"cairomm-{self._abi_version()}",
                    "include",
                    "*.h",
                )):
            shutil.move(
                header_file,
                os.path.join(
                    self.package_folder,
                    "include",
                    f"cairomm-{self._abi_version()}",
                    os.path.basename(header_file),
                ),
            )

        for dir_to_remove in ["pkgconfig", f"cairomm-{self._abi_version()}"]:
            tools.rmdir(os.path.join(self.package_folder, "lib",
                                     dir_to_remove))
示例#22
0
    def package_info(self):
        binpath = os.path.join(self.package_folder, "bin")
        self.output.info(f"Adding to PATH: {binpath}")
        self.env_info.PATH.append(binpath)

        version = tools.Version(self.version)
        rubylib = self.cpp_info.components["rubylib"]
        config_file = glob.glob(os.path.join(self.package_folder, "include", "**", "ruby", "config.h"), recursive=True)[0]
        rubylib.includedirs = [
            os.path.join(self.package_folder, "include", f"ruby-{version}"),
            os.path.dirname(os.path.dirname(config_file))
        ]
        rubylib.libs = tools.collect_libs(self)
        if is_msvc(self):
            if self.options.shared:
                rubylib.libs = list(filter(lambda l: not l.endswith("-static"), rubylib.libs))
            else:
                rubylib.libs = list(filter(lambda l: l.endswith("-static"), rubylib.libs))
        rubylib.requires.extend(["zlib::zlib", "gmp::gmp"])
        if self.options.with_openssl:
            rubylib.requires.append("openssl::openssl")
        if self.settings.os in ("FreeBSD", "Linux"):
            rubylib.system_libs = ["dl", "pthread", "rt", "m", "crypt"]
        elif self.settings.os == "Windows":
            rubylib.system_libs = self._windows_system_libs
        if str(self.settings.compiler) in ("clang", "apple-clang"):
            rubylib.cflags = ["-fdeclspec"]
            rubylib.cxxflags = ["-fdeclspec"]
        if tools.is_apple_os(self.settings.os):
            rubylib.frameworks = ["CoreFoundation"]

        self.cpp_info.filenames["cmake_find_package"] = "Ruby"
        self.cpp_info.filenames["cmake_find_package_multi"] = "Ruby"
        self.cpp_info.set_property("cmake_file_name", "Ruby")

        self.cpp_info.names["cmake_find_package"] = "Ruby"
        self.cpp_info.names["cmake_find_package_multi"] = "Ruby"
        self.cpp_info.set_property("cmake_target_name", "Ruby::Ruby")
        self.cpp_info.set_property("pkg_config_aliases", [f"ruby-{version.major}.{version.minor}"])
示例#23
0
    def package(self):
        self.copy("COPYING", dst="licenses", src=self._source_subfolder)
        meson = self._configure_meson()
        meson.install()

        shutil.move(
            os.path.join(self.package_folder, "lib", "libxml++-2.6",
                         "include", "libxml++config.h"),
            os.path.join(self.package_folder, "include", "libxml++-2.6",
                         "libxml++config.h"))

        tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
        tools.rmdir(os.path.join(self.package_folder, "lib", "libxml++-2.6"))

        if is_msvc(self):
            tools.remove_files_by_mask(
                os.path.join(self.package_folder, "bin"), "*.pdb")
            if not self.options.shared:
                rename(
                    self,
                    os.path.join(self.package_folder, "lib", "libxml++-2.6.a"),
                    os.path.join(self.package_folder, "lib", "xml++-2.6.lib"))
示例#24
0
    def _configure_autotools(self):
        if self._autotools:
            return self._autotools
        self._autotools = AutoToolsBuildEnvironment(
            self, win_bash=tools.os_info.is_windows)

        self._autotools.libs = []
        yes_no = lambda v: "yes" if v else "no"
        args = [
            "--enable-shared={}".format(yes_no(self.options.shared)),
            "--enable-static={}".format(yes_no(not self.options.shared)),
            "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True)))
        ]

        if is_msvc(self):
            self._autotools.defines.append("__WOE__")
            if self.settings.compiler == "Visual Studio" and \
               tools.Version(self.settings.compiler.version) >= "12":
                self._autotools.flags.append("-FS")
        self._autotools.configure(args=args,
                                  configure_dir=self._source_subfolder)
        return self._autotools
示例#25
0
 def requirements(self):
     self.requires("boost/1.78.0")
     self.requires("bzip2/1.0.8")
     self.requires("double-conversion/3.2.0")
     self.requires("gflags/2.2.2")
     self.requires("glog/0.4.0")
     self.requires("libevent/2.1.12")
     self.requires("openssl/1.1.1n")
     self.requires("lz4/1.9.3")
     self.requires("snappy/1.1.9")
     self.requires("zlib/1.2.12")
     self.requires("zstd/1.5.2")
     if not is_msvc(self):
         self.requires("libdwarf/20191104")
     self.requires("libsodium/1.0.18")
     self.requires("xz_utils/5.2.5")
     # FIXME: Causing compilation issues on clang: self.requires("jemalloc/5.2.1")
     if self.settings.os == "Linux":
         self.requires("libiberty/9.1.0")
         self.requires("libunwind/1.5.0")
     if tools.Version(self.version) >= "2020.08.10.00":
         self.requires("fmt/7.0.3")
示例#26
0
    def validate(self):
        if self.settings.compiler.cppstd:
            tools.check_min_cppstd(self, 17)
        minimum_version = self._compilers_minimum_version.get(
            str(self.settings.compiler), False)
        if minimum_version:
            if Version(self.settings.compiler.version) < minimum_version:
                raise ConanInvalidConfiguration(
                    "{} requires C++17, which your compiler does not support.".
                    format(self.name))
        else:
            self.output.warn(
                "{} requires C++17. Your compiler is unknown. Assuming it supports C++17."
                .format(self.name))

        if self.settings.arch not in ["x86", "x86_64"]:
            raise ConanInvalidConfiguration(
                "Hexl only supports x86 architecture")

        if self.options.shared and is_msvc(self):
            raise ConanInvalidConfiguration(
                "Hexl only supports static linking with msvc")
示例#27
0
    def package(self):
        self.copy("COPYING", src=self._source_subfolder, dst="licenses")
        with self._build_context():
            autotools = self._configure_autotools()
            autotools.install()

        if is_msvc(self) and not self.options.shared:
            rename(self,
                   os.path.join(self.package_folder, "lib", "libxapian.lib"),
                   os.path.join(self.package_folder, "lib", "xapian.lib"))

        os.unlink(
            os.path.join(
                os.path.join(self.package_folder, "bin", "xapian-config")))
        os.unlink(
            os.path.join(
                os.path.join(self.package_folder, "lib", "libxapian.la")))
        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
        tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
        tools.rmdir(os.path.join(self._datarootdir, "doc"))
        tools.rmdir(os.path.join(self._datarootdir, "man"))
        self._create_cmake_module_variables(
            os.path.join(self.package_folder, self._module_file_rel_path))
示例#28
0
    def validate(self):
        compiler = self.settings.compiler
        compiler_version = tools.Version(self.settings.compiler.version)
        ctre_version = tools.Version(self.version)

        min_gcc = "7.4" if ctre_version < "3" else "8"
        if self.settings.compiler.get_safe("cppstd"):
            tools.check_min_cppstd(self, "17")
        if is_msvc(self):
            if compiler_version < "15":
                raise ConanInvalidConfiguration(
                    "{}/{} doesn't support MSVC < 15".format(
                        self.name, self.version))
            if ctre_version >= "3.7" and compiler_version < 16:
                raise ConanInvalidConfiguration(
                    "{}/{} doesn't support MSVC < 16".format(
                        self.name, self.version))
        elif compiler == "gcc" and compiler_version < min_gcc:
            raise ConanInvalidConfiguration(
                "{}/{} doesn't support gcc < {}".format(
                    self.name, self.version, min_gcc))
        elif compiler == "clang" and compiler_version < "6.0":
            raise ConanInvalidConfiguration(
                "{}/{} doesn't support clang < 6.0".format(
                    self.name, self.version))
        elif compiler == "apple-clang":
            if compiler_version < "10.0":
                raise ConanInvalidConfiguration(
                    "{}/{} doesn't support Apple clang < 10.0".format(
                        self.name, self.version))
            # "library does not compile with (at least) Xcode 12.0-12.4"
            # https://github.com/hanickadot/compile-time-regular-expressions/issues/188
            # it's also occurred in Xcode 13.
            if ctre_version.major == "3" and ctre_version.minor == "4" and compiler_version >= "12":
                raise ConanInvalidConfiguration(
                    "{}/{} doesn't support Apple clang".format(
                        self.name, self.version))
示例#29
0
    def environment(self):
        env = Environment()

        apple_flags = [
            self.apple_isysroot_flag, self.apple_arch_flag,
            self.apple_min_version_flag
        ]
        fpic = "-fPIC" if self.fpic else None
        extra_flags = self._get_extra_flags()

        self.cxxflags.extend([
            self.libcxx, self.cppstd, self.arch_flag, fpic,
            self.msvc_runtime_flag, self.sysroot_flag
        ] + self.build_type_flags + apple_flags + extra_flags["cxxflags"])
        self.cflags.extend(
            [self.arch_flag, fpic, self.msvc_runtime_flag, self.sysroot_flag] +
            self.build_type_flags + apple_flags + extra_flags["cflags"])
        self.ldflags.extend([self.arch_flag, self.sysroot_flag] +
                            self.build_type_link_flags + apple_flags +
                            extra_flags["ldflags"])
        self.defines.extend([self.ndebug, self.gcc_cxx11_abi] +
                            extra_flags["defines"])

        if is_msvc(self._conanfile):
            env.define("CXX", "cl")
            env.define("CC", "cl")

        env.append("CPPFLAGS", [
            "-D{}".format(d)
            for d in self._filter_list_empty_fields(self.defines)
        ])
        env.append("CXXFLAGS", self._filter_list_empty_fields(self.cxxflags))
        env.append("CFLAGS", self._filter_list_empty_fields(self.cflags))
        env.append("LDFLAGS", self._filter_list_empty_fields(self.ldflags))
        env.prepend_path("PKG_CONFIG_PATH", self._conanfile.generators_folder)

        return env
示例#30
0
    def _configure_cmake(self):
        cmake = CMake(self, set_cmake_flags=True)
        cmake.definitions["ENABLE_STATIC"] = not self.options.shared
        cmake.definitions["ENABLE_SHARED"] = self.options.shared
        cmake.definitions["WITH_SIMD"] = self.options.get_safe("SIMD", False)
        cmake.definitions[
            "WITH_ARITH_ENC"] = self._is_arithmetic_encoding_enabled
        cmake.definitions[
            "WITH_ARITH_DEC"] = self._is_arithmetic_decoding_enabled
        cmake.definitions["WITH_JPEG7"] = self.options.libjpeg7_compatibility
        cmake.definitions["WITH_JPEG8"] = self.options.libjpeg8_compatibility
        cmake.definitions["WITH_MEM_SRCDST"] = self.options.get_safe(
            "mem_src_dst", False)
        cmake.definitions["WITH_TURBOJPEG"] = self.options.get_safe(
            "turbojpeg", False)
        cmake.definitions["WITH_JAVA"] = self.options.get_safe("java", False)
        cmake.definitions["WITH_12BIT"] = self.options.enable12bit
        if is_msvc(self):
            cmake.definitions[
                "WITH_CRT_DLL"] = True  # avoid replacing /MD by /MT in compiler flags

        if tools.Version(self.version) <= "2.1.0":
            cmake.definitions[
                "CMAKE_MACOSX_BUNDLE"] = False  # avoid configuration error if building for iOS/tvOS/watchOS

        if tools.cross_building(self):
            # TODO: too specific and error prone, should be delegated to a conan helper function
            cmake_system_processor = {
                "armv8": "aarch64",
                "armv8.3": "aarch64",
            }.get(str(self.settings.arch), str(self.settings.arch))
            cmake.definitions[
                "CONAN_LIBJPEG_SYSTEM_PROCESSOR"] = cmake_system_processor

        cmake.configure()
        return cmake