def test(self): if not cross_building(self, skip_x64_x86=True): self.run(os.path.join("bin", "core"), run_environment=True) if self.options["poco"].enable_util: self.run(os.path.join("bin", "util"), run_environment=True) if self.options["poco"].enable_crypto: self.run("{} {}".format( os.path.join("bin", "crypto"), os.path.join(self.source_folder, "conanfile.py")), run_environment=True) if self.options["poco"].enable_net: self.run(os.path.join("bin", "net"), run_environment=True) if self.options["poco"].enable_util: self.run(os.path.join("bin", "net_2"), run_environment=True) if self._with_netssl: self.run(os.path.join("bin", "netssl"), run_environment=True) if self.options["poco"].enable_data_sqlite: self.run(os.path.join("bin", "sqlite"), run_environment=True) if self._with_encodings: self.run(os.path.join("bin", "encodings"), run_environment=True) if self._with_jwt: self.run(os.path.join("bin", "jwt"), run_environment=True) if self._with_prometheus: self.run(os.path.join("bin", "prometheus"), run_environment=True)
def _configure_cmake(self): cmake = CMake(self) cmake.definitions["BUILD_TRAINING_TOOLS"] = self.options.with_training cmake.definitions["INSTALL_CONFIGS"] = self.options.with_training # pre-5.0.0 uses custom STATIC variable instead of BUILD_SHARED_LIBS if tools.Version(self.version) < "5.0.0": cmake.definitions["STATIC"] = not self.options.shared # Use CMake-based package build and dependency detection, not the pkg-config, cppan or SW cmake.definitions["CPPAN_BUILD"] = False cmake.definitions["SW_BUILD"] = False # disable autodetect of vector extensions and march=native cmake.definitions["ENABLE_OPTIMIZATIONS"] = self.options.with_auto_optimize if tools.Version(self.version) < "5.0.0": cmake.definitions["AUTO_OPTIMIZE"] = self.options.with_auto_optimize # Set Leptonica_DIR to ensure that find_package will be called in original CMake file cmake.definitions["Leptonica_DIR"] = self.deps_cpp_info["leptonica"].rootpath if tools.Version(self.version) >= "5.0.0": cmake.definitions["DISABLE_CURL"] = not self.options.with_libcurl cmake.definitions["DISABLE_ARCHIVE"] = not self.options.with_libarchive if cross_building(self): cmake_system_processor = { "armv8": "aarch64", "armv8.3": "aarch64", }.get(str(self.settings.arch), str(self.settings.arch)) cmake.definitions["CONAN_TESSERACT_SYSTEM_PROCESSOR"] = cmake_system_processor cmake.configure(build_folder=self._build_subfolder) return cmake
def _configure_autotools(self): autotools = AutoToolsBuildEnvironment( self, win_bash=tools.os_info.is_windows) if self.settings.os != "Windows": autotools.fpic = self.options.get_safe("fPIC", True) autotools_vars = self._configure_autotools_vars() # tweaks for mingw if self._is_mingw: autotools.defines.append("_AMD64_") if cross_building(self) and tools.is_apple_os(self.settings.os): autotools.defines.extend(['HAVE_SOCKET', 'HAVE_FCNTL_O_NONBLOCK']) configure_args = self._get_configure_command_args() if self.settings.os == "iOS" and self.settings.arch == "x86_64": # please do not autodetect --build for the iOS simulator, thanks! autotools.configure(vars=autotools_vars, args=configure_args, build=False) else: autotools.configure(vars=autotools_vars, args=configure_args) return autotools, autotools_vars
def test(self): if not cross_building(self): bin_path = os.path.join("bin", "hs_example") self.run(bin_path, run_environment=True) if self.options["hyperscan"].build_chimera: bin_path = os.path.join("bin", "ch_example") self.run(bin_path, run_environment=True)
def build(self): cmake = CMake(self) cmake.configure() cmake.build() if not cross_building(self): pkg_config = PkgConfig(self, "wayland-scanner", self.generators_folder) self.run('%s --version' % pkg_config.variables["wayland_scanner"], env="conanrun")
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_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).") if tools.Version(self.version) >= "0.22" and cross_building(self): raise ConanInvalidConfiguration("{} can't be built on cross building environment currently because autopoint(part of gettext) doesn't execute correctly.".format(self.name))
def build(self): # TODO: Add some test for the cross-building scenario if not cross_building(self): calc_wsdl = os.path.join(os.path.dirname(__file__), 'calc.wsdl') self.output.info("Generating code from WSDL '{}'".format(calc_wsdl)) self.run("wsdl2h -o calc.h {}".format(calc_wsdl), run_environment=True) self.run("soapcpp2 -j -CL -I{} calc.h".format(os.path.join(self.deps_cpp_info["gsoap"].rootpath, 'bin', 'import')), run_environment=True) cmake = CMake(self) cmake.configure() cmake.build()
def validate(self): def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] minimum_version = self._compilers_minimum_version.get( str(self.settings.compiler), False) if minimum_version and loose_lt_semver( str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( "{} {} requires {} {} or newer".format( self.name, self.version, self.settings.compiler, minimum_version, )) if hasattr(self, "settings_build") and cross_building( self, skip_x64_x86=True): raise ConanInvalidConfiguration( "Cross compilation not yet supported by the recipe. contributions are welcome." ) # FIXME: patch libmysqlclient 8.0.17 to support apple-clang >= 12? # current errors: # error: expected unqualified-id MYSQL_VERSION_MAJOR=8 # error: no member named 'ptrdiff_t' in the global namespace if self.version == "8.0.17" and self.settings.compiler == "apple-clang" and \ tools.Version(self.settings.compiler.version) >= "12.0": raise ConanInvalidConfiguration( "libmysqlclient 8.0.17 doesn't support apple-clang >= 12.0") # mysql>=8.0.17 doesn't support shared library on MacOS. # https://github.com/mysql/mysql-server/blob/mysql-8.0.17/cmake/libutils.cmake#L333-L335 if tools.Version(self.version) >= "8.0.17" and self.settings.compiler == "apple-clang" and \ self.options.shared: raise ConanInvalidConfiguration( "{}/{} doesn't support shared library".format( self.name, self.version)) # mysql < 8.0.29 uses `requires` in source code. It is the reserved keyword in C++20. # https://github.com/mysql/mysql-server/blob/mysql-8.0.0/include/mysql/components/services/dynamic_loader.h#L270 if self.settings.compiler.get_safe("cppstd") == "20" and tools.Version( self.version) < "8.0.29": raise ConanInvalidConfiguration( "{}/{} doesn't support C++20".format(self.name, self.version))
def requirements(self): self.requires("opengl/system") self.requires("spirv-cross/1.3.216.0") self.requires("spirv-tools/1.3.216.0") if self.options.with_glslang: self.requires("glslang/1.3.216.0") self.requires("vulkan-headers/1.3.216.0") self.requires("vulkan-validationlayers/1.3.216.0") self.requires("volk/1.3.216.0") self.requires("xxhash/0.8.1") if self.settings.os in ["Linux", "FreeBSD"]: self.requires("xorg/system") if not cross_building(self, skip_x64_x86=True): self.requires("xkbcommon/1.4.1")
def validate(self): if hasattr(self, 'settings_build') and 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")
def _configure_cmake(self): cmake = CMake(self) cmake.definitions[self._get_cmake_option( "CPR_FORCE_USE_SYSTEM_CURL")] = True cmake.definitions[self._get_cmake_option("CPR_BUILD_TESTS")] = False cmake.definitions[self._get_cmake_option( "CPR_GENERATE_COVERAGE")] = False cmake.definitions[self._get_cmake_option( "CPR_USE_SYSTEM_GTEST")] = False cmake.definitions["CPR_CURL_NOSIGNAL"] = not self.options.signal ssl_value = str(self.options.get_safe("with_ssl")) SSL_OPTIONS = { "CPR_FORCE_DARWINSSL_BACKEND": ssl_value == "darwinssl", "CPR_FORCE_OPENSSL_BACKEND": ssl_value == "openssl", "CPR_FORCE_WINSSL_BACKEND": ssl_value == "winssl", "CMAKE_USE_OPENSSL": ssl_value == "openssl" } for cmake_option, value in SSL_OPTIONS.items(): cmake.definitions[self._get_cmake_option(cmake_option)] = value # If we are on a version where disabling SSL requires a cmake option, disable it if not self._uses_old_cmake_options and str( self.options.get_safe("with_ssl")) == CprConan._NO_SSL: cmake.definitions["CPR_ENABLE_SSL"] = False if hasattr(self, "settings_build") and cross_building( self, skip_x64_x86=True): cmake.definitions["THREAD_SANITIZER_AVAILABLE_EXITCODE"] = 1 cmake.definitions[ "THREAD_SANITIZER_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 cmake.definitions["ADDRESS_SANITIZER_AVAILABLE_EXITCODE"] = 1 cmake.definitions[ "ADDRESS_SANITIZER_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 cmake.definitions["ALL_SANITIZERS_AVAILABLE_EXITCODE"] = 1 cmake.definitions[ "ALL_SANITIZERS_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 cmake.configure(build_folder=self._build_subfolder) return cmake
def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) self._cmake.definitions["BENCHMARK_ENABLE_TESTING"] = "OFF" self._cmake.definitions["BENCHMARK_ENABLE_GTEST_TESTS"] = "OFF" self._cmake.definitions["BENCHMARK_ENABLE_LTO"] = "ON" if self.options.enable_lto else "OFF" self._cmake.definitions["BENCHMARK_ENABLE_EXCEPTIONS"] = "ON" if self.options.enable_exceptions else "OFF" if self.settings.os != "Windows": if cross_building(self): self._cmake.definitions["HAVE_STD_REGEX"] = False self._cmake.definitions["HAVE_POSIX_REGEX"] = False self._cmake.definitions["HAVE_STEADY_CLOCK"] = False self._cmake.definitions["BENCHMARK_USE_LIBCXX"] = "ON" if self.settings.compiler.get_safe("libcxx") == "libc++" else "OFF" else: self._cmake.definitions["BENCHMARK_USE_LIBCXX"] = "OFF" self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def test(self): if not cross_building(self): bin_path = os.path.join("bin", "digest") self.run(bin_path, run_environment=True) if not self.options["openssl"].no_legacy: bin_legacy_path = os.path.join("bin", "digest_legacy") self.run(bin_legacy_path, run_environment=True) if not self.options["openssl"].no_stdio: self.run("openssl version", run_environment=True) assert os.path.exists( os.path.join(self.deps_cpp_info["openssl"].rootpath, "licenses", "LICENSE.txt")) for fn in ( "libcrypto.pc", "libssl.pc", "openssl.pc", ): assert os.path.isfile(os.path.join(self.build_folder, fn))
def test(self): if cross_building(self): return self.run(os.path.join("bin", "lambda_exe"), run_environment=True) if self.options["boost"].header_only: return if not self.options["boost"].without_random: self.run(os.path.join("bin", "random_exe"), run_environment=True) if not self.options["boost"].without_regex: self.run(os.path.join("bin", "regex_exe"), run_environment=True) if not self.options["boost"].without_test: self.run(os.path.join("bin", "test_exe"), run_environment=True) if not self.options["boost"].without_coroutine: self.run(os.path.join("bin", "coroutine_exe"), run_environment=True) if not self.options["boost"].without_chrono: self.run(os.path.join("bin", "chrono_exe"), run_environment=True) if not self.options["boost"].without_fiber: self.run(os.path.join("bin", "fiber_exe"), run_environment=True) if not self.options["boost"].without_locale: self.run(os.path.join("bin", "locale_exe"), run_environment=True) if not self._boost_option("without_nowide", True): self.run("{} {}".format(os.path.join("bin", "nowide_exe"), os.path.join(self.source_folder, "conanfile.py")), run_environment=True) if not self._boost_option("without_json", True): self.run(os.path.join("bin", "json_exe"), run_environment=True) if not self.options["boost"].without_python: with tools.environment_append({"PYTHONPATH": "{}:{}".format("bin", "lib")}): self.run("{} {}".format(self.options["boost"].python_executable, os.path.join(self.source_folder, "python.py")), run_environment=True) self.run(os.path.join("bin", "numpy_exe"), run_environment=True) if not self.options["boost"].without_stacktrace: self.run(os.path.join("bin", "stacktrace_noop_exe"), run_environment=True) if str(self.deps_user_info["boost"].stacktrace_addr2line_available) == "True": self.run(os.path.join("bin", "stacktrace_addr2line_exe"), run_environment=True) if self.settings.os == "Windows": self.run(os.path.join("bin", "stacktrace_windbg_exe"), run_environment=True) self.run(os.path.join("bin", "stacktrace_windbg_cached_exe"), run_environment=True) else: self.run(os.path.join("bin", "stacktrace_basic_exe"), run_environment=True) if self._boost_option("with_stacktrace_backtrace", False): self.run(os.path.join("bin", "stacktrace_backtrace_exe"), run_environment=True)
def _patch_autotools(self): if self._is_using_cmake_build: return # Disable curl tool for these reasons: # - link errors if mingw shared or iOS/tvOS/watchOS # - it makes recipe consistent with CMake build where we don't build curl tool top_makefile = os.path.join(self._source_subfolder, "Makefile.am") tools.replace_in_file(top_makefile, "SUBDIRS = lib src", "SUBDIRS = lib") tools.replace_in_file(top_makefile, "include src/Makefile.inc", "") if self._is_mingw: # patch for zlib naming in mingw if self.options.with_zlib: configure_ac = os.path.join(self._source_subfolder, "configure.ac") zlib_name = self.deps_cpp_info["zlib"].libs[0] tools.replace_in_file(configure_ac, "AC_CHECK_LIB(z,", "AC_CHECK_LIB({},".format(zlib_name)) tools.replace_in_file(configure_ac, "-lz ", "-l{} ".format(zlib_name)) if self.options.shared: # patch for shared mingw build lib_makefile = os.path.join(self._source_subfolder, "lib", "Makefile.am") tools.replace_in_file(lib_makefile, "noinst_LTLIBRARIES = libcurlu.la", "") tools.replace_in_file(lib_makefile, "noinst_LTLIBRARIES =", "") tools.replace_in_file(lib_makefile, "lib_LTLIBRARIES = libcurl.la", "noinst_LTLIBRARIES = libcurl.la") # add directives to build dll # used only for native mingw-make if not cross_building(self): added_content = tools.load("lib_Makefile_add.am") tools.save(lib_makefile, added_content, append=True)
def generate(self): tc = MesonToolchain(self) tc.project_options["libdir"] = "lib" tc.project_options["datadir"] = "res" tc.project_options["libraries"] = self.options.enable_libraries tc.project_options[ "dtd_validation"] = self.options.enable_dtd_validation tc.project_options["documentation"] = False if Version(self.version) >= "1.18.91": tc.project_options["scanner"] = True # Generate PC files for the tool_requires wayland package to ensure wayland-scanner is found for build machine. if cross_building(self): native_generators_folder = os.path.join( self.generators_folder, "native") mkdir(self, native_generators_folder) for pc_name, pc_content in get_pc_files_and_content( self, self.dependencies.build["wayland"]).items(): save(self, os.path.join(native_generators_folder, pc_name), pc_content) tc.project_options[ "build.pkg_config_path"] = native_generators_folder tc.generate()
def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) self._cmake.definitions["HEXL_BENCHMARK"] = False self._cmake.definitions["HEXL_TESTING"] = False self._cmake.definitions[ "HEXL_EXPERIMENTAL"] = self.options.experimental if self.options.fpga_compatibility_dyadic_multiply and self.options.fpga_compatibility_keyswitch: self._cmake.definitions["HEXL_FPGA_COMPATIBILITY"] = 3 elif self.options.fpga_compatibility_dyadic_multiply: self._cmake.definitions["HEXL_FPGA_COMPATIBILITY"] = 1 elif self.options.fpga_compatibility_keyswitch: self._cmake.definitions["HEXL_FPGA_COMPATIBILITY"] = 2 else: self._cmake.definitions["HEXL_FPGA_COMPATIBILITY"] = 0 self._cmake.definitions["HEXL_SHARED_LIB"] = self.options.shared self._cmake.definitions["HEXL_CROSS_COMPILED"] = cross_building(self) self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def _meson_supported(self): return False and self.options["qt"].shared and\ not cross_building(self) and\ not tools.os_info.is_macos and\ not self._is_mingw()
def test(self): if not cross_building(self, skip_x64_x86=True): self._test_with_qmake() self._test_with_meson() self._test_with_cmake_find_package_multi()
def test(self): if not cross_building(self): for test in ["", "-mb", "-signal"]: self.run("test_package{}".format(test), run_environment=True)
def build_requirements(self): self.tool_requires("meson/0.63.0") self.tool_requires("pkgconf/1.7.4") if cross_building(self): self.tool_requires(f"wayland/{self.version}")
def validate(self): if self.options.shared and self.settings.os == "Windows": raise ConanInvalidConfiguration("Shared inih is not supported") if hasattr(self, "settings_build") and cross_building(self): raise ConanInvalidConfiguration("Cross-building not implemented")
def test(self): if not cross_building(self): self.run("dbus-monitor --help", run_environment=True) self.run(os.path.join("bin", "test_package"), run_environment=True)
def _win_bash(self): return self._settings_build.os == "Windows" and \ not self._use_nmake and \ (self._is_mingw or cross_building(self, skip_x64_x86=True))
def test(self): if not cross_building(self): self.run("mold -v", run_environment=True)
def test(self): if not cross_building(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun")
def _get_configure_command_args(self): yes_no = lambda v: "yes" if v else "no" params = [ "--with-libidn2={}".format(yes_no(self.options.with_libidn)), "--with-librtmp={}".format(yes_no(self.options.with_librtmp)), "--with-libpsl={}".format(yes_no(self.options.with_libpsl)), "--with-schannel={}".format( yes_no(self.options.with_ssl == "schannel")), "--with-secure-transport={}".format( yes_no(self.options.with_ssl == "darwinssl")), "--with-brotli={}".format(yes_no(self.options.with_brotli)), "--enable-shared={}".format(yes_no(self.options.shared)), "--enable-static={}".format(yes_no(not self.options.shared)), "--enable-dict={}".format(yes_no(self.options.with_dict)), "--enable-file={}".format(yes_no(self.options.with_file)), "--enable-ftp={}".format(yes_no(self.options.with_ftp)), "--enable-gopher={}".format(yes_no(self.options.with_gopher)), "--enable-http={}".format(yes_no(self.options.with_http)), "--enable-imap={}".format(yes_no(self.options.with_imap)), "--enable-ldap={}".format(yes_no(self.options.with_ldap)), "--enable-mqtt={}".format(yes_no(self.options.with_mqtt)), "--enable-pop3={}".format(yes_no(self.options.with_pop3)), "--enable-rtsp={}".format(yes_no(self.options.with_rtsp)), "--enable-smb={}".format(yes_no(self.options.with_smb)), "--enable-smtp={}".format(yes_no(self.options.with_smtp)), "--enable-telnet={}".format(yes_no(self.options.with_telnet)), "--enable-tftp={}".format(yes_no(self.options.with_tftp)), "--enable-debug={}".format( yes_no(self.settings.build_type == "Debug")), "--enable-ares={}".format(yes_no(self.options.with_c_ares)), "--enable-threaded-resolver={}".format( yes_no(self.options.with_threaded_resolver)), "--enable-cookies={}".format(yes_no(self.options.with_cookies)), "--enable-ipv6={}".format(yes_no(self.options.with_ipv6)), "--enable-manual={}".format(yes_no(self.options.with_docs)), "--enable-verbose={}".format( yes_no(self.options.with_verbose_debug)), "--enable-symbol-hiding={}".format( yes_no(self.options.with_symbol_hiding)), "--enable-unix-sockets={}".format( yes_no(self.options.with_unix_sockets)), ] if self.options.with_ssl == "openssl": params.append("--with-ssl={}".format( tools.unix_path(self.deps_cpp_info["openssl"].rootpath))) else: params.append("--without-ssl") if self.options.with_ssl == "wolfssl": params.append("--with-wolfssl={}".format( tools.unix_path(self.deps_cpp_info["wolfssl"].rootpath))) else: params.append("--without-wolfssl") if self.options.with_libssh2: params.append("--with-libssh2={}".format( tools.unix_path(self.deps_cpp_info["libssh2"].rootpath))) else: params.append("--without-libssh2") if self.options.with_nghttp2: params.append("--with-nghttp2={}".format( tools.unix_path(self.deps_cpp_info["libnghttp2"].rootpath))) else: params.append("--without-nghttp2") if self.options.with_zlib: params.append("--with-zlib={}".format( tools.unix_path(self.deps_cpp_info["zlib"].rootpath))) else: params.append("--without-zlib") if self._has_zstd_option: params.append("--with-zstd={}".format( yes_no(self.options.with_zstd))) if self._has_metalink_option: params.append("--with-libmetalink={}".format( yes_no(self.options.with_libmetalink))) if not self.options.with_proxy: params.append("--disable-proxy") if not self.options.with_rtsp: params.append("--disable-rtsp") if not self.options.with_crypto_auth: params.append( "--disable-crypto-auth" ) # also disables NTLM in versions of curl prior to 7.78.0 # ntlm will default to enabled if any SSL options are enabled if not self.options.with_ntlm: if tools.Version(self.version) <= "7.77.0": params.append("--disable-crypto-auth") else: params.append("--disable-ntlm") if not self.options.with_ntlm_wb: params.append("--disable-ntlm-wb") if self.options.with_ca_bundle == False: params.append("--without-ca-bundle") elif self.options.with_ca_bundle: params.append("--with-ca-bundle=" + str(self.options.with_ca_bundle)) if self.options.with_ca_path == False: params.append('--without-ca-path') elif self.options.with_ca_path: params.append("--with-ca-path=" + str(self.options.with_ca_path)) # Cross building flags if cross_building(self): if self.settings.os == "Linux" and "arm" in self.settings.arch: params.append("--host=%s" % self._get_linux_arm_host()) elif self.settings.os == "iOS": params.append("--enable-threaded-resolver") params.append("--disable-verbose") elif self.settings.os == "Android": pass # this just works, conan is great! return params
def test(self): if not cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True)
def test(self): if not cross_building(self): self.run(os.path.join(".", "test_package"), run_environment=True)