Beispiel #1
0
    def _configure_cmake(self):
        cmake = CMake(self)
        for option, value in self.options.items():
            if option.startswith("with_"):
                cmake.definitions[option.upper()] = value

        cmake.definitions["BOOST_ROOT"] = self.deps_cpp_info["boost"].rootpath
        cmake.definitions["BUILD_TESTING"] = False
        cmake.definitions["BUILD_COMPILER"] = True
        cmake.definitions["BUILD_LIBRARIES"] = True
        cmake.definitions["BUILD_TUTORIALS"] = False

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

        # Make optional libs "findable"
        if self.options.with_openssl:
            cmake.definitions["OPENSSL_ROOT_DIR"] = self.deps_cpp_info[
                "openssl"].rootpath
        if self.options.with_zlib:
            cmake.definitions["ZLIB_ROOT"] = self.deps_cpp_info[
                "zlib"].rootpath
        cmake.definitions["WITH_LIBEVENT"] = self.options.with_libevent
        if self.options.with_libevent:
            cmake.definitions["LIBEVENT_ROOT"] = self.deps_cpp_info[
                "libevent"].rootpath

        cmake.configure(build_folder=self._build_subfolder)
        return cmake
    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["USE_SHA1"] = self._cmake_sha1[str(
            self.options.with_sha1)]

        if tools.Version(self.version) >= "1.4.0":
            cmake.definitions["BUILD_TESTS"] = False
        cmake.definitions["BUILD_CLAR"] = False
        cmake.definitions["BUILD_EXAMPLES"] = False
        cmake.definitions["USE_HTTP_PARSER"] = "system"

        cmake.definitions["REGEX_BACKEND"] = self.options.with_regex

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

        cmake.configure()
        return cmake
Beispiel #3
0
 def validate(self):
     if self.settings.compiler.get_safe("cppstd"):
         tools.check_min_cppstd(self, "11")
     if self.options.shared and is_msvc(self) and is_msvc_static_runtime(
             self):
         raise ConanInvalidConfiguration(
             "Visual Studio build for {} shared library with MT runtime is not supported"
             .format(self.name))
Beispiel #4
0
 def _configure_cmake(self):
     cmake = CMake(self)
     cmake.definitions["ANTLR4_INSTALL"] = True
     cmake.definitions["WITH_LIBCXX"] = self.settings.compiler.get_safe("libcxx") == "libc++"
     cmake.definitions["ANTLR_BUILD_CPP_TESTS"] = False
     if is_msvc(self):
         cmake.definitions["WITH_STATIC_CRT"] = is_msvc_static_runtime(self)
     cmake.definitions["WITH_DEMO"] = False
     cmake.configure(build_folder=self._build_subfolder)
     return cmake
Beispiel #5
0
 def validate(self):
     if self.settings.compiler.get_safe("cppstd"):
         if tools.Version(
                 self.version) >= "2.3.0.0" or self.options.with_openvdb:
             tools.check_min_cppstd(self, 14)
         else:
             tools.check_min_cppstd(self, 11)
     if is_msvc(self) and is_msvc_static_runtime(
             self) and self.options.shared:
         raise ConanInvalidConfiguration(
             "Building shared library with static runtime is not supported!"
         )
Beispiel #6
0
    def _configure_cmake(self):
        cmake = CMake(self)
        cmake.definitions["YAML_CPP_BUILD_TESTS"] = False
        cmake.definitions["YAML_CPP_BUILD_CONTRIB"] = True
        cmake.definitions["YAML_CPP_BUILD_TOOLS"] = False
        cmake.definitions["YAML_CPP_INSTALL"] = True
        cmake.definitions["YAML_BUILD_SHARED_LIBS"] = self.options.shared
        if is_msvc(self):
            cmake.definitions[
                "YAML_MSVC_SHARED_RT"] = not is_msvc_static_runtime(self)

        cmake.configure()
        return cmake
Beispiel #7
0
def test_is_msvc_static_runtime(compiler, shared, runtime, build_type,
                                expected):
    options = MockOptions({"shared": shared})
    settings = MockSettings({
        "build_type": build_type,
        "arch": "x86_64",
        "compiler": compiler,
        "compiler.runtime": runtime,
        "compiler.version": "17",
        "cppstd": "17"
    })
    conanfile = MockConanfile(settings, options)
    assert is_msvc_static_runtime(conanfile) == expected
Beispiel #8
0
 def _configure_cmake(self):
     cmake = CMake(self)
     cmake.definitions["skyr_BUILD_TESTS"] = False
     cmake.definitions["skyr_FULL_WARNINGS"] = False
     cmake.definitions["skyr_WARNINGS_AS_ERRORS"] = False
     cmake.definitions[
         "skyr_ENABLE_JSON_FUNCTIONS"] = self.options.with_json
     cmake.definitions[
         "skyr_ENABLE_FILESYSTEM_FUNCTIONS"] = self.options.with_fs
     if is_msvc(self):
         cmake.definitions["skyr_USE_STATIC_CRT"] = is_msvc_static_runtime(
             self)
     cmake.configure(build_folder=self._build_subfolder)
     return cmake
    def _configure_cmake(self):
        cmake = CMake(self)
        if not self.options.shared:
            cmake.definitions["PX_STATIC_LIBRARIES"] = 1
        cmake.definitions["STATIC_WINCRT"] = is_msvc_static_runtime(self)

        cmake.definitions["NV_CLOTH_ENABLE_CUDA"] = self.options.use_cuda
        cmake.definitions["NV_CLOTH_ENABLE_DX11"] = self.options.use_dx11

        cmake.definitions[
            "TARGET_BUILD_PLATFORM"] = self._get_target_build_platform()

        cmake.configure(build_folder=os.path.join(self.build_folder,
                                                  self._build_subfolder))
        return cmake
 def validate(self):
     if self.settings.compiler.get_safe("cppstd"):
         tools.check_min_cppstd(self, 14)
     min_version = self._compiler_cpp14_support.get(
         str(self.settings.compiler))
     if min_version and tools.Version(
             self.settings.compiler.version) < min_version:
         raise ConanInvalidConfiguration(
             "This compiler is too old. {} needs a compiler with c++14 support"
             .format(self.name))
     # FIXME: This is a workaround for "The system cannot execute the specified program."
     if tools.Version(self.version) == "1.3.0" and is_msvc_static_runtime(
             self) and self.settings.build_type == "Debug":
         raise ConanInvalidConfiguration(
             "{}/{} doesn't support MT + Debug.".format(
                 self.name, self.version))
Beispiel #11
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")
    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
Beispiel #13
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
Beispiel #14
0
    def package_info(self):
        self.cpp_info.set_property("cmake_file_name", "Thrift")
        # unofficial, for conan internal purpose, it avoids conflict with libthrift component
        self.cpp_info.set_property("cmake_target_name",
                                   "thrift::thrift-conan-do-not-use")
        self.cpp_info.set_property("pkg_config_name",
                                   "thrift_conan_do_not_use")

        libsuffix = "{}{}".format(
            ("mt" if is_msvc_static_runtime(self) else "md")
            if is_msvc(self) else "",
            "d" if self.settings.build_type == "Debug" else "",
        )

        self.cpp_info.components["libthrift"].set_property(
            "cmake_target_name", "thrift::thrift")
        self.cpp_info.components["libthrift"].set_property(
            "pkg_config_name", "thrift")
        self.cpp_info.components["libthrift"].libs = ["thrift" + libsuffix]
        if self.settings.os == "Windows":
            self.cpp_info.components["libthrift"].defines.append("NOMINMAX")
            if tools.Version(self.version) >= "0.15.0":
                self.cpp_info.components["libthrift"].system_libs.append(
                    "shlwapi")
        elif self.settings.os in ["Linux", "FreeBSD"]:
            self.cpp_info.components["libthrift"].system_libs.extend(
                ["m", "pthread"])
        self.cpp_info.components["libthrift"].requires.append("boost::headers")
        if self.options.with_openssl:
            self.cpp_info.components["libthrift"].requires.append(
                "openssl::openssl")
        self.cpp_info.components["libthrift"].builddirs = [
            os.path.join("lib", "cmake")
        ]

        if self.options.with_zlib:
            self.cpp_info.components["libthrift_z"].set_property(
                "cmake_target_name", "thriftz::thriftz")
            self.cpp_info.components["libthrift_z"].set_property(
                "pkg_config_name", "thrift-z")
            self.cpp_info.components["libthrift_z"].libs = [
                "thriftz" + libsuffix
            ]
            self.cpp_info.components["libthrift_z"].requires = [
                "libthrift", "zlib::zlib"
            ]

        if self.options.with_libevent:
            self.cpp_info.components["libthrift_nb"].set_property(
                "cmake_target_name", "thriftnb::thriftnb")
            self.cpp_info.components["libthrift_nb"].set_property(
                "pkg_config_name", "thrift-nb")
            self.cpp_info.components["libthrift_nb"].libs = [
                "thriftnb" + libsuffix
            ]
            self.cpp_info.components["libthrift_nb"].requires = [
                "libthrift", "libevent::libevent"
            ]

        if self.options.with_qt5:
            self.cpp_info.components["libthrift_qt5"].set_property(
                "cmake_target_name", "thriftqt5::thriftqt5")
            self.cpp_info.components["libthrift_qt5"].set_property(
                "pkg_config_name", "thrift-qt5")
            self.cpp_info.components["libthrift_qt5"].libs = [
                "thriftqt5" + libsuffix
            ]
            self.cpp_info.components["libthrift_qt5"].requires = [
                "libthrift", "qt::qtCore"
            ]

        bin_path = os.path.join(self.package_folder, "bin")
        self.output.info("Appending PATH env var with : {}".format(bin_path))
        self.env_info.PATH.append(bin_path)

        # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed
        self.cpp_info.filenames["cmake_find_package"] = "Thrift"
        self.cpp_info.filenames["cmake_find_package_multi"] = "Thrift"
        self.cpp_info.names["cmake_find_package"] = "thrift"
        self.cpp_info.names["cmake_find_package_multi"] = "thrift"
        self.cpp_info.names["pkg_config"] = "thrift_conan_do_not_use"
        self.cpp_info.components["libthrift"].names[
            "cmake_find_package"] = "thrift"
        self.cpp_info.components["libthrift"].names[
            "cmake_find_package_multi"] = "thrift"
        if self.options.with_zlib:
            self.cpp_info.components["libthrift_z"].names[
                "cmake_find_package"] = "thriftz"
            self.cpp_info.components["libthrift_z"].names[
                "cmake_find_package_multi"] = "thriftz"
            self.cpp_info.components["libthrift_z"].build_modules[
                "cmake_find_package"] = [self._module_file_rel_path]
            self.cpp_info.components["libthrift_z"].build_modules[
                "cmake_find_package_multi"] = [self._module_file_rel_path]
        if self.options.with_libevent:
            self.cpp_info.components["libthrift_nb"].names[
                "cmake_find_package"] = "thriftnb"
            self.cpp_info.components["libthrift_nb"].names[
                "cmake_find_package_multi"] = "thriftnb"
            self.cpp_info.components["libthrift_nb"].build_modules[
                "cmake_find_package"] = [self._module_file_rel_path]
            self.cpp_info.components["libthrift_nb"].build_modules[
                "cmake_find_package_multi"] = [self._module_file_rel_path]
        if self.options.with_qt5:
            self.cpp_info.components["libthrift_qt5"].names[
                "cmake_find_package"] = "thriftqt5"
            self.cpp_info.components["libthrift_qt5"].names[
                "cmake_find_package_multi"] = "thriftqt5"
            self.cpp_info.components["libthrift_qt5"].build_modules[
                "cmake_find_package"] = [self._module_file_rel_path]
            self.cpp_info.components["libthrift_qt5"].build_modules[
                "cmake_find_package_multi"] = [self._module_file_rel_path]