def package_info(self): postfix = "" if self.settings.build_type == "Debug": if self.settings.os == "Windows": postfix += "d" elif tools.is_apple_os(self.settings.os): postfix += "_debug" self.cpp_info.libs = ["mediainfo" + postfix] if self.settings.os == "Linux": self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) self.cpp_info.names["cmake_find_package"] = "MediaInfoLib" self.cpp_info.names["cmake_find_package_multi"] = "MediaInfoLib" self.cpp_info.names["pkg_config"] = "libmediainfo" self.cpp_info.builddirs.append(self._module_subfolder) 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 ]
def validate(self): if self.settings.compiler.cppstd: tools.check_min_cppstd(self, 11) if tools.is_apple_os(self.settings.os): # FIXME: add Apple support raise ConanInvalidConfiguration( "This recipe does not support Apple.") if self.settings.os == "Linux": if self.settings.compiler == "gcc" and tools.Version( self.settings.compiler.version) < 5: # FIXME: need to test for availability of SYS_memfd_create syscall (Linux kernel >= 3.17) raise ConanInvalidConfiguration( "sentry-crashpad needs SYS_memfd_create syscall support.") if self.settings.compiler == "Visual Studio" and tools.Version( self.settings.compiler.version) < 15: raise ConanInvalidConfiguration( "Require at least Visual Studio 2017 (15)")
def _patch_sources(self): if self.settings.compiler == "Visual Studio": tools.replace_in_file( os.path.join(self._source_subfolder, "Makefile.win32.common"), "-MDd ", "-{} ".format(str(self.settings.compiler.runtime))) tools.replace_in_file( os.path.join(self._source_subfolder, "Makefile.win32.common"), "-MD ", "-{} ".format(str(self.settings.compiler.runtime))) if tools.is_apple_os(self.settings.os): # https://lists.freedesktop.org/archives/pixman/2014-November/003461.html test_makefile = os.path.join(self._source_subfolder, "test", "Makefile.in") tools.replace_in_file( test_makefile, "region_test_OBJECTS = region-test.$(OBJEXT)", "region_test_OBJECTS = region-test.$(OBJEXT) utils.$(OBJEXT)") tools.replace_in_file( test_makefile, "scaling_helpers_test_OBJECTS = scaling-helpers-test.$(OBJEXT)", "scaling_helpers_test_OBJECTS = scaling-helpers-test.$(OBJEXT) utils.$(OBJEXT)" )
def _build_with_autotools(self): with tools.chdir(self._source_subfolder): # autoreconf self.run("./buildconf", win_bash=tools.os_info.is_windows, run_environment=True) # fix generated autotools files on alle to have relocateable binaries if tools.is_apple_os(self.settings.os): tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name ") self.run("chmod +x configure") env_run = RunEnvironment(self) # run configure with *LD_LIBRARY_PATH env vars it allows to pick up shared openssl self.output.info("Run vars: " + repr(env_run.vars)) with tools.environment_append(env_run.vars): autotools, autotools_vars = self._configure_autotools() autotools.make(vars=autotools_vars)
def package_info(self): self.cpp_info.set_property("cmake_file_name", "MediaInfoLib") self.cpp_info.set_property("cmake_target_name", "mediainfo") self.cpp_info.set_property("pkg_config_name", "libmediainfo") postfix = "" if self.settings.build_type == "Debug": if self.settings.os == "Windows": postfix += "d" elif tools.is_apple_os(self.settings.os): postfix += "_debug" self.cpp_info.libs = ["mediainfo" + postfix] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "MediaInfoLib" self.cpp_info.names["cmake_find_package_multi"] = "MediaInfoLib" 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] self.cpp_info.names["pkg_config"] = "libmediainfo"
def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) tools.rename("Findtinyxml2.cmake", "FindTinyXML.cmake") tools.replace_in_file("FindTinyXML.cmake", "tinyxml2_LIBRARIES", "TinyXML_LIBRARIES") # TODO: move this to a patch (see how https://github.com/MediaArea/MediaInfoLib/issues/1408 if addressed by upstream) postfix = "" if self.settings.build_type == "Debug": if self.settings.os == "Windows": postfix += "d" elif tools.is_apple_os(self.settings.os): postfix += "_debug" tools.replace_in_file(os.path.join(self._source_subfolder, "Source", "MediaInfoDLL", "MediaInfoDLL.h"), "MediaInfo.dll", "MediaInfo{}.dll".format(postfix)) tools.replace_in_file(os.path.join(self._source_subfolder, "Source", "MediaInfoDLL", "MediaInfoDLL.h"), "libmediainfo.0.dylib", "libmediainfo{}.0.dylib".format(postfix))
def config_options(self): if self.settings.os == "Windows": del self.options.fPIC if not self.settings.os in ["Linux", "FreeBSD"]: del self.options.with_vaapi del self.options.with_vdpau del self.options.with_vulkan del self.options.with_xcb del self.options.with_libalsa del self.options.with_pulse if self.settings.os != "Macos": del self.options.with_appkit if self.settings.os not in ["Macos", "iOS", "tvOS"]: del self.options.with_coreimage del self.options.with_audiotoolbox del self.options.with_videotoolbox if not tools.is_apple_os(self.settings.os): del self.options.with_avfoundation if not self._version_supports_vulkan(): del self.options.with_vulkan
def _build_autotools(self): absolute_install_dir = os.path.abspath(os.path.join(".", "install")) absolute_install_dir = absolute_install_dir.replace("\\", "/") configure_args = self._get_configure_args(absolute_install_dir) if self.settings.os in ["Linux", "FreeBSD"]: self._build_autotools_linux(configure_args) elif self.settings.os == "Emscripten": self._build_autotools_emscripten(configure_args) elif self.settings.os == "Android": self._build_autotools_android(configure_args) elif tools.is_apple_os(self.settings.os): self._build_autotools_darwin(configure_args) elif self._is_mingw: self._build_autotools_mingw(configure_args) elif self.settings.os == "Neutrino": self._build_autotools_neutrino(configure_args) else: raise ConanInvalidConfiguration( "Unsupported os for libsodium: {}".format(self.settings.os))
def source(self): # download sources tools.get(**self.conan_data["sources"][self.version]) # check recipe conistency tools.check_with_algorithm_sum( "sha1", "osx10_compat.patch", "e211d33b1198e932ac251a811b783583ce1ec278") tools.check_with_algorithm_sum( "sha1", "SNI.patch", "13ec4af9bab09839a4cd6fc0d7c935749cba04f9") # apply patches tools.patch(base_path=self._source_subfolder, patch_file="SNI.patch", strip=1) if tools.is_apple_os(self.settings.os): tools.patch(base_path=self._source_subfolder, patch_file="osx10_compat.patch", strip=1)
def _configure_meson(self): meson = Meson(self) defs = dict() if tools.is_apple_os(self.settings.os): defs[ "iconv"] = "external" # https://gitlab.gnome.org/GNOME/glib/issues/1557 defs["selinux"] = "enabled" if self.options.get_safe( "with_selinux") else "disabled" defs["libmount"] = "enabled" if self.options.get_safe( "with_mount") else "disabled" defs["internal_pcre"] = not self.options.with_pcre if self.settings.os == "FreeBSD": defs["xattr"] = "false" defs["tests"] = "false" meson.configure(source_folder=self._source_subfolder, args=["--wrap-mode=nofallback"], build_folder=self._build_subfolder, defs=defs) return meson
def requirements(self): self.requires("zlib/1.2.12") self.requires("libffi/3.4.2") if self.options.with_pcre: if tools.Version(self.version) >= "2.73.2": self.requires("pcre2/10.40") else: self.requires("pcre/8.45") if self.options.get_safe("with_elf"): self.requires("libelf/0.8.13") if self.options.get_safe("with_mount"): self.requires("libmount/2.36.2") if self.options.get_safe("with_selinux"): self.requires("libselinux/3.3") if self.settings.os != "Linux": # for Linux, gettext is provided by libc self.requires("libgettext/0.21") if tools.is_apple_os(self.settings.os): self.requires("libiconv/1.17")
def test(self): if not tools.cross_building(self, skip_x64_x86=True): self.run("{} -c \"print('hello world')\"".format(self.deps_user_info["cpython"].python), run_environment=True) buffer = StringIO() self.run("{} -c \"import sys; print('.'.join(str(s) for s in sys.version_info[:3]))\"".format(self.deps_user_info["cpython"].python), run_environment=True, output=buffer) self.output.info(buffer.getvalue()) version_detected = buffer.getvalue().splitlines()[-1].strip() if self._py_version != version_detected: raise ConanException("python reported wrong version. Expected {exp}. Got {res}.".format(exp=self._py_version, res=version_detected)) if self._supports_modules: self._test_module("gdbm", self._cpython_option("with_gdbm")) self._test_module("bz2", self._cpython_option("with_bz2")) self._test_module("bsddb", self._cpython_option("with_bsddb")) self._test_module("lzma", self._cpython_option("with_lzma")) self._test_module("tkinter", self._cpython_option("with_tkinter")) with tools.environment_append({"TERM": "ansi"}): self._test_module("curses", self._cpython_option("with_curses")) self._test_module("expat", True) self._test_module("sqlite3", True) self._test_module("decimal", True) self._test_module("ctypes", True) if tools.is_apple_os(self.settings.os) and not self.options["cpython"].shared: self.output.info("Not testing the module, because these seem not to work on apple when cpython is built as a static library") # FIXME: find out why cpython on apple does not allow to use modules linked against a static python else: if self._supports_modules: with tools.environment_append({"PYTHONPATH": [os.path.join(self.build_folder, "lib")]}): self.output.info("Testing module (spam) using cmake built module") self._test_module("spam", True) with tools.environment_append({"PYTHONPATH": [os.path.join(self.build_folder, "lib_setuptools")]}): self.output.info("Testing module (spam) using setup.py built module") self._test_module("spam", True) # MSVC builds need PYTHONHOME set. with tools.environment_append({"PYTHONHOME": self.deps_user_info["cpython"].pythonhome}) if self.deps_user_info["cpython"].module_requires_pythonhome == "True" else tools.no_op(): self.run(os.path.join("bin", "test_package"), run_environment=True)
def _build_autotools(self): env_build = AutoToolsBuildEnvironment(self) if not self.options.shared: env_build.defines.append("U_STATIC_IMPLEMENTATION") if tools.is_apple_os( self.settings.os) and self.settings.get_safe("os.version"): env_build.flags.append( tools.apple_deployment_target_flag(self.settings.os, self.settings.os.version)) with tools.environment_append(env_build.vars): if self.settings.os == 'Linux': self.cfg['platform'] = 'Linux/gcc' if str( self.settings.compiler).startswith('gcc') else 'Linux' elif self.settings.os == 'Macos': self.cfg['platform'] = 'MacOSX' if self.settings.os == 'Windows': self.cfg['platform'] = 'MinGW' if self.settings.arch == 'x86': MINGW_CHOST = 'i686-w64-mingw32' else: MINGW_CHOST = 'x86_64-w64-mingw32' self.cfg['host'] = '--build={MINGW_CHOST} ' \ '--host={MINGW_CHOST} '.format(MINGW_CHOST=MINGW_CHOST) os.mkdir(self.cfg['build_dir']) config_cmd = self.build_config_cmd() # with tools.environment_append(env_build.vars): #Run only make to generate build folder for Cross compiling self.run("cd {builddir} && bash -c '{config_cmd}'".format( builddir=self.cfg['build_dir'], config_cmd=config_cmd)) os.system("cd {builddir} && make {silent} -j {cpus_var}".format( builddir=self.cfg['build_dir'], cpus_var=tools.cpu_count(), silent=self.cfg['silent']))
def configure(self): if self.settings.os_build != "Macos": raise ConanInvalidConfiguration("Build machine must be Macos") if not tools.is_apple_os(self.settings.os): raise ConanInvalidConfiguration("OS must be an Apple OS") if self.settings.os in ["watchOS", "tvOS"] and not self.options.enable_bitcode: raise ConanInvalidConfiguration("Bitcode is required on watchOS/tvOS") if self.settings.os == "Macos" and self.settings.arch not in ["x86", "x86_64"]: raise ConanInvalidConfiguration( "macOS: Only supported archs: [x86, x86_64]" ) if self.settings.os == "iOS" and self.settings.arch not in [ "armv7", "armv7s", "armv8", "armv8.3", "x86", "x86_64", ]: raise ConanInvalidConfiguration( "iOS: Only supported archs: [armv7, armv7s, armv8, armv8.3, x86, x86_64]" ) if self.settings.os == "tvOS" and self.settings.arch not in ["armv8", "x86_64"]: raise ConanInvalidConfiguration( "tvOS: Only supported archs: [armv8, x86_64]" ) if self.settings.os == "watchOS" and self.settings.arch not in [ "armv7k", "armv8_32", "x86", "x86_64", ]: raise ConanInvalidConfiguration( "watchOS: Only supported archs: [armv7k, armv8_32, x86, x86_64]" )
def _build_zlib_autotools(self): env_build = AutoToolsBuildEnvironment(self) # configure passes CFLAGS to linker, should be LDFLAGS tools.replace_in_file("../configure", "$LDSHARED $SFLAGS", "$LDSHARED $LDFLAGS") # same thing in Makefile.in, when building tests/example executables tools.replace_in_file("../Makefile.in", "$(CC) $(CFLAGS) -o", "$(CC) $(LDFLAGS) -o") # we need to build only libraries without test example and minigzip if self.options.shared: make_target = "libz.%s.dylib" % self.version \ if tools.is_apple_os(self.settings.os) else "libz.so.%s" % self.version else: make_target = "libz.a" env = {} if "clang" in str(self.settings.compiler) and tools.get_env("CC") is None and tools.get_env("CXX") is None: env = {"CC": "clang", "CXX": "clang++"} with tools.environment_append(env): env_build.configure("../", build=False, host=False, target=False) env_build.make(target=make_target)
def _patch_sources(self): shutil.copy( self._user_info_build["gnu-config"].CONFIG_SUB, os.path.join(self._source_subfolder, "config", "config.sub")) shutil.copy( self._user_info_build["gnu-config"].CONFIG_GUESS, os.path.join(self._source_subfolder, "config", "config.guess")) configure = os.path.join(self._source_subfolder, "configure") # relocatable shared libs on macOS tools.replace_in_file(configure, "-install_name \\$rpath/", "-install_name @rpath/") # avoid SIP issues on macOS when dependencies are shared if tools.is_apple_os(self.settings.os): libpaths = ":".join(self.deps_cpp_info.lib_paths) tools.replace_in_file( configure, "#! /bin/sh\n", "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n". format(libpaths), )
def configure(self): del self.settings.compiler.libcxx del self.settings.compiler.cppstd # be careful with those flags: # - with_openssl AND darwin_ssl uses darwin_ssl (to maintain recipe compatibilty) # - with_openssl AND NOT darwin_ssl uses openssl # - with_openssl AND with_winssl raises to error # - with_openssl AND NOT with_winssl uses openssl # Moreover darwin_ssl is set by default and with_winssl is not if self.settings.os == "Windows" and self.options.with_winssl and self.options.with_openssl: raise ConanInvalidConfiguration('Specify only with_winssl or with_openssl') if self.options.with_openssl: # enforce shared linking due to openssl dependency if not tools.is_apple_os(self.settings.os) or not self.options.darwin_ssl: self.options["openssl"].shared = self.options.shared if self.options.with_libssh2: if self.settings.compiler != "Visual Studio": self.options["libssh2"].shared = self.options.shared
def validate(self): if self.settings.compiler.get_safe("cppstd"): tools.check_min_cppstd(self, 11) # see https://github.com/KhronosGroup/glslang/issues/2283 glslang_version = tools.Version(self.version) if (self.options.shared and (self.settings.os == "Windows" or \ (glslang_version >= "7.0.0" and glslang_version < "11.0.0" and tools.is_apple_os(self.settings.os))) ): raise ConanInvalidConfiguration( "glslang {} shared library build is broken on {}".format( self.version, self.settings.os, ) ) if self.options.enable_optimizer and self.options["spirv-tools"].shared: raise ConanInvalidConfiguration( "glslang with enable_optimizer requires static spirv-tools, " "because SPIRV-Tools-opt is not built if shared" )
def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) self._cmake.definitions["VULKAN_HEADERS_INSTALL_DIR"] = self.deps_cpp_info["vulkan-headers"].rootpath self._cmake.definitions["BUILD_TESTS"] = False self._cmake.definitions["USE_CCACHE"] = False if self.settings.os == "Linux": self._cmake.definitions["BUILD_WSI_XCB_SUPPORT"] = self.options.with_wsi_xcb self._cmake.definitions["BUILD_WSI_XLIB_SUPPORT"] = self.options.with_wsi_xlib self._cmake.definitions["BUILD_WSI_WAYLAND_SUPPORT"] = self.options.with_wsi_wayland self._cmake.definitions["BUILD_WSI_DIRECTFB_SUPPORT"] = self.options.with_wsi_directfb if self.settings.os == "Windows": self._cmake.definitions["ENABLE_WIN10_ONECORE"] = False if tools.is_apple_os(self.settings.os): self._cmake.definitions["BUILD_STATIC_LOADER"] = not self.options.shared self._cmake.definitions["BUILD_LOADER"] = True if self.settings.os == "Windows": self._cmake.definitions["USE_MASM"] = True self._cmake.configure() return self._cmake
def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) if self.settings.os == "Windows": cmake = self._configure_cmake() cmake.build() else: with tools.chdir(os.path.join(self._source_subfolder, "c++")): self.run("{} -fiv".format(tools.get_env("AUTORECONF"))) # relocatable shared libs on macOS tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") # avoid SIP issues on macOS when dependencies are shared if tools.is_apple_os(self.settings.os): libpaths = ":".join(self.deps_cpp_info.lib_paths) tools.replace_in_file( "configure", "#! /bin/sh\n", "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths), ) autotools = self._configure_autotools() autotools.make()
def validate(self): if not self._uses_valid_abi_and_compiler: raise ConanInvalidConfiguration( "Cannot compile CPR/1.6.0 with libstdc++ on clang < 9") if self.options.get_safe("with_openssl", False) and tools.is_apple_os( self.settings.os): # https://github.com/whoshuu/cpr/issues/546 raise ConanInvalidConfiguration( "cpr cannot be built on macOS with openssl") if self.options.get_safe("with_winssl", False) and self.settings.os != "Windows": raise ConanInvalidConfiguration( "cpr only supports winssl on Windows") if self.options.get_safe("with_openssl", False) and self.options.get_safe( "with_winssl", False): raise ConanInvalidConfiguration( "cpr can not be built with both openssl and winssl") if self.settings.compiler == "Visual Studio" and self.options.shared and "MT" in self.settings.compiler.runtime: raise ConanInvalidConfiguration( "Visual Studio build for shared library with MT runtime is not supported" ) if self.options.get_safe( "with_openssl", False) and self.options["libcurl"].with_ssl != "openssl": raise ConanInvalidConfiguration( "cpr requires libcurl to be built with the option with_ssl='openssl'." ) if self.options.get_safe( "with_winssl", False) and self.options["libcurl"].with_ssl != "schannel": raise ConanInvalidConfiguration( "cpr requires libcurl to be built with the option with_ssl='schannel'." )
def _get_toolset_version_and_exe(self): compiler_version = str(self.settings.compiler.version) compiler = str(self.settings.compiler) if self._is_msvc: cversion = self.settings.compiler.version if Version(str(cversion)) >= "16": _msvc_version = "14.2" elif Version(str(cversion)) >= "15": _msvc_version = "14.1" else: _msvc_version = "%s.0" % cversion return "msvc", _msvc_version, "" elif self.settings.os == "Windows" and self.settings.compiler == "clang": return "clang-win", compiler_version, "" elif self.settings.os == "Emscripten" and self.settings.compiler == "clang": return "emscripten", compiler_version, self._cxx elif self.settings.compiler == "gcc" and tools.is_apple_os( self.settings.os): return "darwin", compiler_version, self._cxx elif compiler == "gcc" and compiler_version[0] >= "5": # For GCC >= v5 we only need the major otherwise Boost doesn't find the compiler # The NOT windows check is necessary to exclude MinGW: if not tools.which("g++-%s" % compiler_version[0]): # In fedora 24, 25 the gcc is 6, but there is no g++-6 and the detection is 6.3.1 # so b2 fails because 6 != 6.3.1. Specify the exe to avoid the smart detection executable = tools.which("g++") or "" else: executable = "" return compiler, compiler_version[0], executable elif self.settings.compiler == "apple-clang": return "clang-darwin", compiler_version, self._cxx elif self.settings.os == "Android" and self.settings.compiler == "clang": return "clang-linux", compiler_version, self._cxx elif str(self.settings.compiler) in ["clang", "gcc"]: # For GCC < v5 and Clang we need to provide the entire version string return compiler, compiler_version, "" elif self.settings.compiler == "sun-cc": return "sunpro", compiler_version, "" else: return compiler, compiler_version, ""
def package_info(self): self.cpp_info.names["pkg_config"] = "libcares" self.cpp_info.components["cares"].names["cmake_find_package"] = "cares" self.cpp_info.components["cares"].names[ "cmake_find_package_multi"] = "cares" self.cpp_info.components["cares"].names["pkg_config"] = "libcares" self.cpp_info.components["cares"].libs = tools.collect_libs(self) if not self.options.shared: self.cpp_info.components["cares"].defines.append("CARES_STATICLIB") if self.settings.os == "Linux": self.cpp_info.components["cares"].system_libs.append("rt") elif self.settings.os == "Windows": self.cpp_info.components["cares"].system_libs.extend( ["ws2_32", "Advapi32"]) elif tools.is_apple_os(self.settings.os): self.cpp_info.components["cares"].system_libs.append("resolv") if self.options.tools: bin_path = os.path.join(self.package_folder, "bin") self.output.info( "Appending PATH environment variable: {}".format(bin_path)) self.env_info.PATH.append(bin_path)
def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("Zbar can't be built on Windows") if tools.is_apple_os(self.settings.os) and not self.options.shared: raise ConanInvalidConfiguration( "Zbar can't be built static on macOS") if self.options.with_imagemagick: #TODO add when available self.output.warn( "There is no imagemagick package available on Conan (yet). This recipe will use the one present on the system (if available)." ) if self.options.with_gtk: #TODO add when available self.output.warn( "There is no gtk package available on Conan (yet). This recipe will use the one present on the system (if available)." ) if self.options.with_qt: #TODO add when available self.output.warn( "There is no qt package available on Conan (yet). This recipe will use the one present on the system (if available)." ) if self.options.with_xv: #TODO add when available self.output.warn( "There is no Xvideo package available on Conan (yet). This recipe will use the one present on the system (if available)." )
def source(self): # download sources tools.get(**self.conan_data["sources"][self.version]) # check recipe conistency tools.check_with_algorithm_sum( "sha1", "osx10_compat.patch", "e211d33b1198e932ac251a811b783583ce1ec278") tools.check_with_algorithm_sum( "sha1", "SNI.patch", "13ec4af9bab09839a4cd6fc0d7c935749cba04f9") tools.check_with_algorithm_sum( "sha1", "CMakeLists.txt", "884441e52e8d848fbbca5c9fa0a3d04244e7a049") tools.check_with_algorithm_sum( "sha1", "win_config.h", "484eb1f669576af2793614482ba33b8bce40e0db") tools.check_with_algorithm_sum( "sha1", "win.patch", "5c9364fc147eef1e60d004a0ea565c10c5d1219c") # apply patches tools.patch(base_path=self._source_subfolder, patch_file="SNI.patch", strip=1) if tools.is_apple_os(self.settings.os): tools.patch(base_path=self._source_subfolder, patch_file="osx10_compat.patch", strip=1) if tools.os_info.is_windows: shutil.copyfile( os.path.join(self.source_folder, "CMakeLists.txt"), os.path.join(self._source_subfolder, "CMakeLists.txt")) shutil.copyfile( os.path.join(self.source_folder, "win_config.h"), os.path.join(self._source_subfolder, "config", "config.h")) tools.patch(base_path=self._source_subfolder, patch_file="win.patch", strip=1)
def _configure_cmake(self): cmake = CMake(self) cmake.definitions["THREADSAFE"] = self.options.threadsafe cmake.definitions["USE_SSH"] = self.options.with_libssh2 if tools.is_apple_os(self.settings.os): cmake.definitions["USE_ICONV"] = self.options.with_iconv else: cmake.definitions["USE_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 self.settings.compiler == "Visual Studio": cmake.definitions["STATIC_CRT"] = "MT" in str(self.settings.compiler.runtime) cmake.configure() return cmake
def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) self._cmake.definitions[ "CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe( "fPIC", True) self._cmake.definitions["SHADERC_ENABLE_SPVC"] = self.options.get_safe( "spvc", False) self._cmake.definitions["SHADERC_SKIP_INSTALL"] = False self._cmake.definitions["SHADERC_SKIP_TESTS"] = True self._cmake.definitions["SHADERC_SPVC_ENABLE_DIRECT_LOGGING"] = False self._cmake.definitions["SHADERC_SPVC_DISABLE_CONTEXT_LOGGING"] = False self._cmake.definitions["SHADERC_ENABLE_WERROR_COMPILE"] = False if self.settings.compiler == "Visual Studio": self._cmake.definitions["SHADERC_ENABLE_SHARED_CRT"] = str( self.settings.compiler.runtime).startswith("MD") self._cmake.definitions["ENABLE_CODE_COVERAGE"] = False if tools.is_apple_os(self.settings.os): self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def _configure_autotools(self): if not self._autotools: prefix = tools.unix_path(self.package_folder) args = ['--disable-cli', '--prefix={}'.format(prefix)] if self.options.shared: args.append('--enable-shared') else: args.append('--enable-static') if self.settings.os != 'Windows' and self.options.fPIC: args.append('--enable-pic') if self.settings.build_type == 'Debug': args.append('--enable-debug') args.append('--bit-depth=%s' % str(self.options.bit_depth)) if tools.cross_building(self.settings): if self.settings.os == "Android": # the as of ndk does not work well for building libx264 self._override_env["AS"] = os.environ["CC"] ndk_root = tools.unix_path(os.environ["NDK_ROOT"]) arch = {'armv7': 'arm', 'armv8': 'aarch64', 'x86': 'i686', 'x86_64': 'x86_64'}.get(str(self.settings.arch)) abi = 'androideabi' if self.settings.arch == 'armv7' else 'android' cross_prefix = "%s/bin/%s-linux-%s-" % (ndk_root, arch, abi) args.append('--cross-prefix=%s' % cross_prefix) if self._is_msvc: self._override_env['CC'] = 'cl' self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) if self._is_msvc: self._autotools.flags.append('-%s' % str(self.settings.compiler.runtime)) # cannot open program database ... if multiple CL.EXE write to the same .PDB file, please use /FS self._autotools.flags.append('-FS') if tools.is_apple_os(self.settings.os) and self.settings.get_safe("os.version"): self._autotools.flags.append(tools.apple_deployment_target_flag(self.settings.os, self.settings.os.version)) self._autotools.configure(args=args, build=False, vars=self._override_env, configure_dir=self._source_subfolder) return self._autotools
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 self._is_msvc: 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}"])
def package_info(self): self.cpp_info.libs = tools.collect_libs(self) # included as discussed here https://github.com/conan-io/conan-center-index/pull/10732#issuecomment-1123596308 self.cpp_info.includedirs.append(os.path.join(self.package_folder, "include")) self.cpp_info.includedirs.append(os.path.join(self.package_folder, "include", "dummy1", "dummy2")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Common", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsEngine", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsEngineVulkan", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsEngineOpenGL", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsAccessories", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsTools", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "HLSL2GLSLConverterLib", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "Archiver", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Primitives", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Basic", "interface")) if self.settings.os == "Android": self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Android", "interface")) elif tools.is_apple_os(self.settings.os): self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Apple", "interface")) elif self.settings.os == "Emscripten": self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Emscripten", "interface")) elif self.settings.os == "Linux": self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Linux", "interface")) elif self.settings.os == "Windows": self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Win32", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsEngineD3D11", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Graphics", "GraphicsEngineD3D12", "interface")) self.cpp_info.defines.append("SPIRV_CROSS_NAMESPACE_OVERRIDE={}".format(self.options["spirv-cross"].namespace)) self.cpp_info.defines.append("{}=1".format(self._diligent_platform())) if self.settings.os in ["Macos", "Linux"]: self.cpp_info.system_libs = ["dl", "pthread"] if self.settings.os == 'Macos': self.cpp_info.frameworks = ["CoreFoundation", 'Cocoa']