def _get_host_build_target_flags(self, arch_detected, os_detected): """Based on google search for build/host triplets, it could need a lot and complex verification""" if not cross_building(self._conanfile.settings, os_detected, arch_detected): return False, False, False arch_setting = self._conanfile.settings.get_safe("arch") os_setting = self._conanfile.settings.get_safe("os") if os_detected == "Windows" and os_setting != "Windows": return None, None, None # Don't know what to do with these, even exists? its only for configure # Building FOR windows if os_setting == "Windows": build = "i686-w64-mingw32" if arch_detected == "x86" else "x86_64-w64-mingw32" host = "i686-w64-mingw32" if arch_setting == "x86" else "x86_64-w64-mingw32" else: # Building for Linux or Android build = "%s-%s" % (arch_detected, {"Linux": "linux-gnu", "Darwin": "apple-macos"}.get(os_detected, os_detected.lower())) if arch_setting == "armv8": host_arch = "aarch64" else: host_arch = "arm" if "arm" in arch_setting else arch_setting host = "%s%s" % (host_arch, {"Linux": "-linux-gnueabi", "Android": "-linux-android"}.get(os_setting, "")) if arch_setting == "armv7hf" and os_setting == "Linux": host += "hf" elif "arm" in arch_setting and arch_setting != "armv8" and os_setting == "Android": host += "eabi" return build, host, None
def _get_host_build_target_flags(self): """Based on google search for build/host triplets, it could need a lot and complex verification""" arch_detected = detected_architecture() or platform.machine() os_detected = platform.system() arch_settings = self._conanfile.settings.get_safe("arch") os_settings = self._conanfile.settings.get_safe("os") compiler = self._conanfile.settings.get_safe("compiler") if (os_detected is None or arch_detected is None or arch_settings is None or os_settings is None): return False, False, False if not cross_building(self._conanfile.settings, os_detected, arch_detected): return False, False, False try: build = get_gnu_triplet(os_detected, arch_detected, compiler) except ConanException: build = None try: host = get_gnu_triplet(os_settings, arch_settings, compiler) except ConanException: host = None return build, host, None
def build_requirements(self): if hasattr(self, "settings_build") and tools.cross_building( self, skip_x64_x86=True): self.build_requires("corrade/{}".format(self.version))
def test(self): if not tools.cross_building(self, skip_x64_x86=True): for exe in ["gettext", "ngettext", "msgcat", "msgmerge"]: self.run("{} --version".format(exe), run_environment=True)
def test(self): if not tools.cross_building(self.settings): bin_path = os.path.join("bin", "benchmark_playground") self.run(bin_path, run_environment=True)
def test(self): if not tools.cross_building(self.settings): bin_path = os.path.join("bin", "cefsimple")
def _get_build_flags(self): if tools.cross_building(self.settings): flags = self._get_build_cross_flags() else: flags = [] # https://www.boost.org/doc/libs/1_70_0/libs/context/doc/html/context/architectures.html if self._b2_os: flags.append("target-os=%s" % self._b2_os) if self._b2_architecture: flags.append("architecture=%s" % self._b2_architecture) if self._b2_address_model: flags.append("address-model=%s" % self._b2_address_model) if self._b2_binary_format: flags.append("binary-format=%s" % self._b2_binary_format) if self._b2_abi: flags.append("abi=%s" % self._b2_abi) flags.append("--layout=%s" % self.options.layout) flags.append("-sBOOST_BUILD_PATH=%s" % self._boost_build_dir) flags.append("-sNO_ZLIB=%s" % ("0" if self.options.zlib else "1")) flags.append("-sNO_BZIP2=%s" % ("0" if self.options.bzip2 else "1")) flags.append("-sNO_LZMA=%s" % ("0" if self.options.lzma else "1")) flags.append("-sNO_ZSTD=%s" % ("0" if self.options.zstd else "1")) def add_defines(option, library): if option: for define in self.deps_cpp_info[library].defines: flags.append("define=%s" % define) if self._zip_bzip2_requires_needed: add_defines(self.options.zlib, "zlib") add_defines(self.options.bzip2, "bzip2") add_defines(self.options.lzma, "lzma") add_defines(self.options.zstd, "zstd") if self._is_msvc and self.settings.compiler.runtime: flags.append("runtime-link=%s" % ("static" if "MT" in str( self.settings.compiler.runtime) else "shared")) flags.append("threading=multi") flags.append("link=%s" % ("static" if not self.options.shared else "shared")) if self.settings.build_type == "Debug": flags.append("variant=debug") else: flags.append("variant=release") for libname in lib_list: if getattr(self.options, "without_%s" % libname): flags.append("--without-%s" % libname) toolset, _, _ = self._get_toolset_version_and_exe() flags.append("toolset=%s" % toolset) if self.settings.get_safe("compiler.cppstd"): flags.append( "cxxflags=%s" % cppstd_flag(self.settings.get_safe("compiler"), self.settings.get_safe("compiler.version"), self.settings.get_safe("compiler.cppstd"))) # CXX FLAGS cxx_flags = [] # fPIC DEFINITION if self.settings.os != "Windows": if self.options.fPIC: cxx_flags.append("-fPIC") # Standalone toolchain fails when declare the std lib if self.settings.os != "Android": try: if self._gnu_cxx11_abi: flags.append("define=_GLIBCXX_USE_CXX11_ABI=%s" % self._gnu_cxx11_abi) if "clang" in str(self.settings.compiler): if str(self.settings.compiler.libcxx) == "libc++": cxx_flags.append("-stdlib=libc++") flags.append('linkflags="-stdlib=libc++"') else: cxx_flags.append("-stdlib=libstdc++") except: pass if self.options.error_code_header_only: flags.append("define=BOOST_ERROR_CODE_HEADER_ONLY=1") if self.options.system_no_deprecated: flags.append("define=BOOST_SYSTEM_NO_DEPRECATED=1") if self.options.asio_no_deprecated: flags.append("define=BOOST_ASIO_NO_DEPRECATED=1") if self.options.filesystem_no_deprecated: flags.append("define=BOOST_FILESYSTEM_NO_DEPRECATED=1") if self.options.segmented_stacks: flags.extend([ "segmented-stacks=on", "define=BOOST_USE_SEGMENTED_STACKS=1", "define=BOOST_USE_UCONTEXT=1" ]) if tools.is_apple_os(self.settings.os): if self.settings.get_safe("os.version"): cxx_flags.append( tools.apple_deployment_target_flag( self.settings.os, self.settings.os.version)) if self.settings.os == "iOS": cxx_flags.append("-DBOOST_AC_USE_PTHREADS") cxx_flags.append("-DBOOST_SP_USE_PTHREADS") cxx_flags.append("-fvisibility=hidden") cxx_flags.append("-fvisibility-inlines-hidden") cxx_flags.append("-fembed-bitcode") cxx_flags = 'cxxflags="%s"' % " ".join(cxx_flags) if cxx_flags else "" flags.append(cxx_flags) if self.options.extra_b2_flags: flags.append(str(self.options.extra_b2_flags)) return flags
def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) self._cmake.definitions["OPENCV_CONFIG_INSTALL_PATH"] = "cmake" self._cmake.definitions["OPENCV_BIN_INSTALL_PATH"] = "bin" self._cmake.definitions["OPENCV_LIB_INSTALL_PATH"] = "lib" self._cmake.definitions["OPENCV_3P_LIB_INSTALL_PATH"] = "lib" self._cmake.definitions["OPENCV_OTHER_INSTALL_PATH"] = "res" self._cmake.definitions["OPENCV_LICENSES_INSTALL_PATH"] = "licenses" self._cmake.definitions["BUILD_CUDA_STUBS"] = False self._cmake.definitions["BUILD_DOCS"] = False self._cmake.definitions["BUILD_EXAMPLES"] = False self._cmake.definitions["BUILD_FAT_JAVA_LIB"] = False self._cmake.definitions["BUILD_IPP_IW"] = False self._cmake.definitions["BUILD_ITT"] = False self._cmake.definitions["BUILD_JASPER"] = False self._cmake.definitions["BUILD_JAVA"] = False self._cmake.definitions["BUILD_JPEG"] = False self._cmake.definitions["BUILD_OPENEXR"] = False self._cmake.definitions["BUILD_OPENJPEG"] = False self._cmake.definitions["BUILD_TESTS"] = False self._cmake.definitions["BUILD_PROTOBUF"] = False self._cmake.definitions["BUILD_PACKAGE"] = False self._cmake.definitions["BUILD_PERF_TESTS"] = False self._cmake.definitions["BUILD_USE_SYMLINKS"] = False self._cmake.definitions["BUILD_opencv_apps"] = False self._cmake.definitions["BUILD_opencv_java"] = False self._cmake.definitions["BUILD_opencv_java_bindings_gen"] = False self._cmake.definitions["BUILD_opencv_js"] = False self._cmake.definitions["BUILD_ZLIB"] = False self._cmake.definitions["BUILD_PNG"] = False self._cmake.definitions["BUILD_TIFF"] = False self._cmake.definitions["BUILD_WEBP"] = False self._cmake.definitions["BUILD_TBB"] = False self._cmake.definitions["OPENCV_FORCE_3RDPARTY_BUILD"] = False self._cmake.definitions["BUILD_opencv_python2"] = False self._cmake.definitions["BUILD_opencv_python3"] = False self._cmake.definitions["BUILD_opencv_python_bindings_g"] = False self._cmake.definitions["BUILD_opencv_python_tests"] = False self._cmake.definitions["BUILD_opencv_ts"] = False self._cmake.definitions["WITH_1394"] = False self._cmake.definitions["WITH_ADE"] = False self._cmake.definitions["WITH_ARAVIS"] = False self._cmake.definitions["WITH_CLP"] = False self._cmake.definitions["WITH_NVCUVID"] = False self._cmake.definitions["WITH_FFMPEG"] = False self._cmake.definitions["WITH_GSTREAMER"] = False self._cmake.definitions["WITH_HALIDE"] = False self._cmake.definitions["WITH_HPX"] = False self._cmake.definitions[ "WITH_IMGCODEC_HDR"] = self.options.with_imgcodec_hdr self._cmake.definitions[ "WITH_IMGCODEC_PFM"] = self.options.with_imgcodec_pfm self._cmake.definitions[ "WITH_IMGCODEC_PXM"] = self.options.with_imgcodec_pxm self._cmake.definitions[ "WITH_IMGCODEC_SUNRASTER"] = self.options.with_imgcodec_sunraster self._cmake.definitions["WITH_INF_ENGINE"] = False self._cmake.definitions["WITH_IPP"] = False self._cmake.definitions["WITH_ITT"] = False self._cmake.definitions["WITH_LIBREALSENSE"] = False self._cmake.definitions["WITH_MFX"] = False self._cmake.definitions["WITH_NGRAPH"] = False self._cmake.definitions["WITH_OPENCL"] = False self._cmake.definitions["WITH_OPENCLAMDBLAS"] = False self._cmake.definitions["WITH_OPENCLAMDFFT"] = False self._cmake.definitions["WITH_OPENCL_SVM"] = False self._cmake.definitions["WITH_OPENGL"] = False self._cmake.definitions["WITH_OPENMP"] = False self._cmake.definitions["WITH_OPENNI"] = False self._cmake.definitions["WITH_OPENNI2"] = False self._cmake.definitions["WITH_OPENVX"] = False self._cmake.definitions["WITH_PLAIDML"] = False self._cmake.definitions["WITH_PVAPI"] = False self._cmake.definitions["WITH_QT"] = False self._cmake.definitions["WITH_QUIRC"] = False self._cmake.definitions["WITH_V4L"] = self.options.get_safe( "with_v4l", False) self._cmake.definitions["WITH_VA"] = False self._cmake.definitions["WITH_VA_INTEL"] = False self._cmake.definitions["WITH_VTK"] = False self._cmake.definitions["WITH_VULKAN"] = False self._cmake.definitions["WITH_XIMEA"] = False self._cmake.definitions["WITH_XINE"] = False self._cmake.definitions["WITH_LAPACK"] = False self._cmake.definitions["WITH_GTK"] = self.options.get_safe( "with_gtk", False) self._cmake.definitions["WITH_GTK_2_X"] = self._is_gtk_version2 self._cmake.definitions["WITH_WEBP"] = self.options.with_webp self._cmake.definitions["WITH_JPEG"] = self.options.with_jpeg != False self._cmake.definitions["WITH_PNG"] = self.options.with_png if self._has_with_tiff_option: self._cmake.definitions["WITH_TIFF"] = self.options.with_tiff if self._has_with_jpeg2000_option: self._cmake.definitions[ "WITH_JASPER"] = self.options.with_jpeg2000 == "jasper" self._cmake.definitions[ "WITH_OPENJPEG"] = self.options.with_jpeg2000 == "openjpeg" self._cmake.definitions["WITH_OPENEXR"] = self.options.with_openexr self._cmake.definitions["WITH_EIGEN"] = self.options.with_eigen self._cmake.definitions[ "HAVE_QUIRC"] = self.options.with_quirc # force usage of quirc requirement self._cmake.definitions[ "WITH_DSHOW"] = self.settings.compiler == "Visual Studio" self._cmake.definitions[ "WITH_MSMF"] = self.settings.compiler == "Visual Studio" self._cmake.definitions[ "WITH_MSMF_DXVA"] = self.settings.compiler == "Visual Studio" self._cmake.definitions["OPENCV_MODULES_PUBLIC"] = "opencv" if self.options.detect_cpu_baseline: self._cmake.definitions["CPU_BASELINE"] = "DETECT" if self.options.get_safe("neon") is not None: self._cmake.definitions["ENABLE_NEON"] = self.options.get_safe( "neon") self._cmake.definitions["WITH_PROTOBUF"] = self.options.dnn if self.options.dnn: self._cmake.definitions["PROTOBUF_UPDATE_FILES"] = True self._cmake.definitions["BUILD_opencv_dnn"] = True if self.options.contrib: self._cmake.definitions[ 'OPENCV_EXTRA_MODULES_PATH'] = os.path.join( self.build_folder, self._contrib_folder, 'modules') self._cmake.definitions[ 'BUILD_opencv_freetype'] = self.options.get_safe( "contrib_freetype", False) self._cmake.definitions['BUILD_opencv_sfm'] = self.options.get_safe( "contrib_sfm", False) if self.options.with_openexr: self._cmake.definitions["OPENEXR_ROOT"] = self.deps_cpp_info[ "openexr"].rootpath if self.options.get_safe("with_jpeg2000") == "openjpeg": openjpeg_version = tools.Version( self.deps_cpp_info["openjpeg"].version) self._cmake.definitions[ "OPENJPEG_MAJOR_VERSION"] = openjpeg_version.major self._cmake.definitions[ "OPENJPEG_MINOR_VERSION"] = openjpeg_version.minor self._cmake.definitions[ "OPENJPEG_BUILD_VERSION"] = openjpeg_version.patch if self.options.parallel: self._cmake.definitions[ "WITH_TBB"] = self.options.parallel == "tbb" self._cmake.definitions[ "WITH_OPENMP"] = self.options.parallel == "openmp" self._cmake.definitions["WITH_CUDA"] = self.options.with_cuda self._cmake.definitions["WITH_ADE"] = self.options.with_ade if self.options.with_cuda: # This allows compilation on older GCC/NVCC, otherwise build errors. self._cmake.definitions[ "CUDA_NVCC_FLAGS"] = "--expt-relaxed-constexpr" self._cmake.definitions["WITH_CUBLAS"] = self.options.get_safe( "with_cublas", False) self._cmake.definitions["WITH_CUFFT"] = self.options.get_safe( "with_cufft", False) self._cmake.definitions["ENABLE_PIC"] = self.options.get_safe( "fPIC", True) if self.settings.compiler == "Visual Studio": self._cmake.definitions["BUILD_WITH_STATIC_CRT"] = "MT" in str( self.settings.compiler.runtime) if self.settings.os == "Android": self._cmake.definitions["ANDROID_STL"] = "c++_static" self._cmake.definitions[ "ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level self._cmake.definitions["ANDROID_ABI"] = tools.to_android_abi( str(self.settings.arch)) self._cmake.definitions["BUILD_ANDROID_EXAMPLES"] = False if "ANDROID_NDK_HOME" in os.environ: self._cmake.definitions["ANDROID_NDK"] = os.environ.get( "ANDROID_NDK_HOME") if tools.cross_building(self): # FIXME: too specific and error prone, should be delegated to CMake helper cmake_system_processor = { "armv8": "aarch64", "armv8.3": "aarch64", }.get(str(self.settings.arch), str(self.settings.arch)) self._cmake.definitions[ "CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor # Workaround for cross-build to at least iOS/tvOS/watchOS, # when dependencies are found with find_path() and find_library() self._cmake.definitions[ "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE"] = "BOTH" self._cmake.definitions[ "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY"] = "BOTH" self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def test(self): if not tools.cross_building(self.settings): os.chdir("bin") self.run(".{}example".format(os.sep))
def package_info(self): self.cpp_info.names["cmake_find_package"] = "Qt6" self.cpp_info.names["cmake_find_package_multi"] = "Qt6" libsuffix = "" if self.settings.build_type == "Debug": if self.settings.os == "Windows": libsuffix = "d" if tools.is_apple_os(self.settings.os): libsuffix = "_debug" def _get_corrected_reqs(requires): reqs = [] for r in requires: reqs.append(r if "::" in r else "qt%s" % r) return reqs def _create_module(module, requires=[]): componentname = "qt%s" % module assert componentname not in self.cpp_info.components, "Module %s already present in self.cpp_info.components" % module self.cpp_info.components[componentname].names[ "cmake_find_package"] = module self.cpp_info.components[componentname].names[ "cmake_find_package_multi"] = module self.cpp_info.components[componentname].libs = [ "Qt6%s%s" % (module, libsuffix) ] self.cpp_info.components[componentname].includedirs = [ "include", os.path.join("include", "Qt%s" % module) ] self.cpp_info.components[componentname].defines = [ "QT_%s_LIB" % module.upper() ] if module != "Core" and "Core" not in requires: requires.append("Core") self.cpp_info.components[ componentname].requires = _get_corrected_reqs(requires) def _create_plugin(pluginname, libname, type, requires): componentname = "qt%s" % pluginname assert componentname not in self.cpp_info.components, "Plugin %s already present in self.cpp_info.components" % pluginname self.cpp_info.components[componentname].names[ "cmake_find_package"] = pluginname self.cpp_info.components[componentname].names[ "cmake_find_package_multi"] = pluginname self.cpp_info.components[componentname].libs = [ libname + libsuffix ] self.cpp_info.components[componentname].libdirs = [ os.path.join("res", "archdatadir", "plugins", type) ] self.cpp_info.components[componentname].includedirs = [] if "Core" not in requires: requires.append("Core") self.cpp_info.components[ componentname].requires = _get_corrected_reqs(requires) core_reqs = ["zlib::zlib"] if self.options.with_pcre2: core_reqs.append("pcre2::pcre2") if self.options.with_doubleconversion: core_reqs.append("double-conversion::double-conversion") if self.options.get_safe("with_icu", False): core_reqs.append("icu::icu") _create_module("Core", core_reqs) self.cpp_info.components["qtCore"].libs.append("Qt6Core_qobject%s" % libsuffix) if self.options.gui: gui_reqs = [] if self.options.with_freetype: gui_reqs.append("freetype::freetype") if self.options.with_libpng: gui_reqs.append("libpng::libpng") if self.options.get_safe("with_fontconfig", False): gui_reqs.append("fontconfig::fontconfig") if self.settings.os in ["Linux", "FreeBSD"]: gui_reqs.append("xorg::xorg") if not tools.cross_building(self, skip_x64_x86=True): gui_reqs.append("xkbcommon::xkbcommon") if self.settings.os != "Windows" and self.options.get_safe( "opengl", "no") != "no": gui_reqs.append("opengl::opengl") if self.options.with_harfbuzz: gui_reqs.append("harfbuzz::harfbuzz") if self.options.with_libjpeg == "libjpeg-turbo": gui_reqs.append("libjpeg-turbo::libjpeg-turbo") if self.options.with_libjpeg == "libjpeg": gui_reqs.append("libjpeg::libjpeg") _create_module("Gui", gui_reqs) if self.options.with_sqlite3: _create_plugin("QSQLiteDriverPlugin", "qsqlite", "sqldrivers", ["sqlite3::sqlite3"]) if self.options.with_pq: _create_plugin("QPSQLDriverPlugin", "qsqlpsql", "sqldrivers", ["libpq::libpq"]) if self.options.with_odbc: if self.settings.os != "Windows": _create_plugin("QODBCDriverPlugin", "qsqlodbc", "sqldrivers", ["odbc::odbc"]) _create_module("Network", ["openssl::openssl"] if self.options.openssl else []) _create_module("Sql") _create_module("Test") if self.options.widgets: _create_module("Widgets", ["Gui"]) if self.options.gui and self.options.widgets: _create_module("PrintSupport", ["Gui", "Widgets"]) if self.options.get_safe("opengl", "no") != "no" and self.options.gui: _create_module("OpenGL", ["Gui"]) if self.options.widgets and self.options.get_safe("opengl", "no") != "no": _create_module("OpenGLWidgets", ["OpenGL", "Widgets"]) _create_module("DBus") _create_module("Concurrent") _create_module("Xml") if self.options.qt5compat: _create_module("Core5Compat") if self.options.qtdeclarative: _create_module("Qml", ["Network"]) _create_module("QmlModels", ["Qml"]) if self.options.gui: _create_module("Quick", ["Gui", "Qml", "QmlModels"]) if self.options.widgets: _create_module("QuickWidgets", ["Gui", "Qml", "Quick", "Widgets"]) _create_module("QuickShapes", ["Gui", "Qml", "Quick"]) _create_module("QmlWorkerScript", ["Qml"]) _create_module("QuickTest", ["Test"]) if self.options.qttools and self.options.gui and self.options.widgets: _create_module("UiPlugin", ["Gui", "Widgets"]) self.cpp_info.components["qtUiPlugin"].libs = [ ] # this is a collection of abstract classes, so this is header-only self.cpp_info.components["qtUiPlugin"].libdirs = [] _create_module("UiTools", ["UiPlugin", "Gui", "Widgets"]) _create_module("Designer", ["Gui", "UiPlugin", "Widgets", "Xml"]) _create_module("Help", ["Gui", "Sql", "Widgets"]) if self.options.qtquick3d and self.options.gui: _create_module("Quick3DUtils", ["Gui"]) _create_module("Quick3DAssetImport", ["Gui", "Qml", "Quick3DUtils"]) _create_module("Quick3DRuntimeRender", [ "Gui", "Quick", "Quick3DAssetImport", "Quick3DUtils", "ShaderTools" ]) _create_module("Quick3D", ["Gui", "Qml", "Quick", "Quick3DRuntimeRender"]) if self.options.qtquickcontrols2 and self.options.gui: _create_module("QuickControls2", ["Gui", "Quick"]) _create_module("QuickTemplates2", ["Gui", "Quick"]) if self.options.qtshadertools and self.options.gui: _create_module("ShaderTools", ["Gui"]) if self.options.qtsvg and self.options.gui: _create_module("Svg", ["Gui"]) if self.options.widgets: _create_module("SvgWidgets", ["Gui", "Svg", "Widgets"]) if self.options.qtwayland and self.options.gui: _create_module("WaylandClient", ["Gui", "wayland::wayland-client"]) _create_module("WaylandCompositor", ["Gui", "wayland::wayland-server"]) if not self.options.shared: if self.settings.os == "Windows": self.cpp_info.components["qtCore"].system_libs.append( "version" ) # qtcore requires "GetFileVersionInfoW" and "VerQueryValueW" which are in "Version.lib" library self.cpp_info.components["qtCore"].system_libs.append( "winmm" ) # qtcore requires "__imp_timeSetEvent" which is in "Winmm.lib" library self.cpp_info.components["qtCore"].system_libs.append( "netapi32" ) # qtcore requires "NetApiBufferFree" which is in "Netapi32.lib" library self.cpp_info.components["qtCore"].system_libs.append( "userenv" ) # qtcore requires "__imp_GetUserProfileDirectoryW " which is in "UserEnv.Lib" library self.cpp_info.components["qtCore"].system_libs.append( "ws2_32" ) # qtcore requires "WSAStartup " which is in "Ws2_32.Lib" library self.cpp_info.components["qtNetwork"].system_libs.append( "DnsApi" ) # qtnetwork from qtbase requires "DnsFree" which is in "Dnsapi.lib" library if self.settings.os == "Macos": self.cpp_info.components["qtCore"].frameworks.append( "IOKit" ) # qtcore requires "_IORegistryEntryCreateCFProperty", "_IOServiceGetMatchingService" and much more which are in "IOKit" framework self.cpp_info.components["qtCore"].frameworks.append( "Cocoa" ) # qtcore requires "_OBJC_CLASS_$_NSApplication" and more, which are in "Cocoa" framework self.cpp_info.components["qtCore"].frameworks.append( "Security" ) # qtcore requires "_SecRequirementCreateWithString" and more, which are in "Security" framework self.cpp_info.components["qtCore"].builddirs.append( os.path.join("res", "archdatadir", "bin")) self.cpp_info.components["qtCore"].build_modules[ "cmake_find_package"].append(self._cmake_executables_file) self.cpp_info.components["qtCore"].build_modules[ "cmake_find_package_multi"].append(self._cmake_executables_file) for m in os.listdir(os.path.join("lib", "cmake")): module = os.path.join("lib", "cmake", m, "%sMacros.cmake" % m) component_name = m.replace("Qt6", "qt") self.cpp_info.components[component_name].build_modules[ "cmake_find_package"].append(module) self.cpp_info.components[component_name].build_modules[ "cmake_find_package_multi"].append(module) self.cpp_info.components[component_name].builddirs.append( os.path.join("lib", "cmake", m))
def test(self): if not tools.cross_building(self.settings): self.run("some_tool --version")
def test(self): if not tools.cross_building(self): self.run("xsd --help", run_environment=True)
def test(self): if not tools.cross_building(self.settings, skip_x64_x86=True): bin_path = os.path.join("bin", "test_package") arguments = "%sw+ Bincrafters" % ("\\" if self.settings.os == "Windows" else "\\\\") self.run("%s %s" % (bin_path, arguments), run_environment=True)
def validate(self): if hasattr(self, "settings_build") and tools.cross_building(self): raise ConanInvalidConfiguration("Cross-building not implemented") if self.settings.compiler.get_safe("cppstd"): tools.check_min_cppstd(self, 11)
def test(self): if not tools.cross_building(self): self.run(os.path.join(".", "test_package"), run_environment=True)
def _build_config_cmd(self): prefix = self.package_folder.replace("\\", "/") arch64 = [ 'x86_64', 'sparcv9', 'ppc64', 'ppc64le', 'armv8', 'armv8.3', 'mips64' ] bits = "64" if self.settings.arch in arch64 else "32" args = [ self._platform, "--prefix={0}".format(prefix), "--disable-samples", "--disable-layout", "--disable-layoutex" ] if not self.options.with_dyload: args += ["--disable-dyload"] if not self._enable_icu_tools: args.append("--disable-tools") if not self.options.with_icuio: args.append("--disable-icuio") if not self.options.with_extras: args.append("--disable-extras") env_build = self._configure_autotools() if tools.cross_building(self, skip_x64_x86=True): if self.settings.os in ["iOS", "tvOS", "watchOS"]: args.append("--host={}".format( tools.get_gnu_triplet("Macos", str(self.settings.arch)))) elif env_build.host: args.append("--host={}".format(env_build.host)) bin_path = self.deps_env_info["icu"].PATH[0].replace("\\", "/") base_path, _ = bin_path.rsplit('/', 1) args.append("--with-cross-build={}".format(base_path)) else: args.append("--with-library-bits={0}".format(bits), ) if self.settings.os != "Windows": # http://userguide.icu-project.org/icudata # This is the only directly supported behavior on Windows builds. args.append("--with-data-packaging={0}".format( self.options.data_packaging)) datadir = os.path.join(self.package_folder, "lib") datadir = datadir.replace("\\", "/") if tools.os_info.is_windows else datadir args.append("--datarootdir=%s" % datadir) # do not use share bindir = os.path.join(self.package_folder, "bin") bindir = bindir.replace("\\", "/") if tools.os_info.is_windows else bindir args.append("--sbindir=%s" % bindir) libdir = os.path.join(self.package_folder, "lib") libdir = libdir.replace("\\", "/") if tools.os_info.is_windows else libdir args.append("--libdir=%s" % libdir) if self._is_mingw: mingw_chost = "i686-w64-mingw32" if self.settings.arch == "x86" else "x86_64-w64-mingw32" args.extend([ "--build={0}".format(mingw_chost), "--host={0}".format(mingw_chost) ]) if self.settings.build_type == "Debug": args.extend(["--disable-release", "--enable-debug"]) if self.options.shared: args.extend(["--disable-static", "--enable-shared"]) else: args.extend(["--enable-static", "--disable-shared"]) if not self.options.with_unit_tests: args.append("--disable-tests") return "../source/runConfigureICU %s" % " ".join(args)
def unix_build(self, config_options_string): env_build = AutoToolsBuildEnvironment(self) extra_flags = ' '.join(env_build.flags) target_prefix = "" if self.settings.build_type == "Debug": config_options_string = " no-asm" + config_options_string extra_flags += " -O0" target_prefix = "debug-" if self.settings.compiler in ["apple-clang", "clang", "gcc"]: extra_flags += " -g3 -fno-omit-frame-pointer -fno-inline-functions" if self.settings.os == "Linux": if self.settings.arch == "x86": target = "%slinux-generic32" % target_prefix elif self.settings.arch == "x86_64": target = "%slinux-x86_64" % target_prefix elif self.settings.arch == "armv8": # Thanks @dashaomai! target = "%slinux-aarch64" % target_prefix elif str(self.settings.arch) in ("ppc64le", "ppc64", "mips64", "sparcv9"): target = "linux-%s" % str(self.settings.arch) elif "arm" in self.settings.arch: target = "linux-armv4" elif "mips" == self.settings.arch: target = "linux-mips32" else: raise Exception("Unsupported arch for Linux") elif self.settings.os == "Android": if "armv7" in self.settings.arch: target = "android-armv7" elif self.settings.arch == "armv8": target = "android-aarch64" elif self.settings.arch == "x86": target = "android-x86" elif self.settings.arch == "mips": target = "android-mips" else: raise Exception("Unsupported arch for Android") elif self.settings.os == "SunOS": if self.settings.compiler in ["apple-clang", "clang", "gcc"]: suffix = "-gcc" elif self.settings.compiler == "sun-cc": suffix = "-cc" else: raise Exception("Unsupported compiler on SunOS: %s" % self.settings.compiler) # OpenSSL has no debug profile for non sparcv9 machine if self.settings.arch != "sparcv9": target_prefix = "" if self.settings.arch in ["sparc", "x86"]: target = "%ssolaris-%s%s" % (target_prefix, self.settings.arch, suffix) elif self.settings.arch in ["sparcv9", "x86_64"]: target = "%ssolaris64-%s%s" % (target_prefix, self.settings.arch, suffix) else: raise Exception("Unsupported arch on SunOS: %s" % self.settings.arch) elif self.settings.os == "FreeBSD": target = "%sBSD-%s" % (target_prefix, self.settings.arch) else: raise Exception("Unsupported operating system: %s" % self.settings.os) config_line = "./Configure %s -fPIC %s %s" % (config_options_string, target, extra_flags) self.output.warn(config_line) self.run_in_src(config_line) if not tools.cross_building(self.settings): self.run_in_src("make depend") self.output.warn("----------MAKE OPENSSL %s-------------" % self.version) self.run_in_src("make", show_output=True)
def test(self): if not tools.cross_building(self): tools.mkdir("logs/") bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True)
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_c_ares)), "--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") # Cross building flags if tools.cross_building(self.settings): 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 build(self): cmake = CMake(self) cmake.configure() cmake.build() if not tools.cross_building(self.settings): cmake.test()
def test(self): if not tools.cross_building(self.settings): self.run(os.path.join("bin", "example"), run_environment=True)
def test(self): if not tools.cross_building(self.settings): print("SUCCESS") else: print("NOT_RUN (cross-building)")
def test(self): if not tools.cross_building(self.settings): args = " sample.wav sample.flac" bin_path = os.path.join("bin", "test_package") self.run(bin_path + args, run_environment=True)
def validate(self): if hasattr(self, 'settings_build') and tools.cross_building(self, skip_x64_x86=True): raise ConanInvalidConfiguration("Cross-building not implemented")
def test(self): if not tools.cross_building(self.settings): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True)
def test(self): if not tools.cross_building(self.settings): os.chdir("bin") tools.save("input.txt", "2*2\n\n") self.run(".%scalc < input.txt" % os.sep)
def get_build_flags(self): # flags = [] if tools.cross_building(self.settings): flags = self.get_build_cross_flags() else: flags = [] if self.settings.compiler == "Visual Studio": flags.append("toolset=msvc-%s" % self._msvc_version()) elif self.settings.compiler == "gcc": # For GCC we only need the major version otherwhise Boost doesn't find the compiler #flags.append("toolset=%s-%s"% (self.settings.compiler, self._gcc_short_version(self.settings.compiler.version))) flags.append("toolset=gcc") elif str(self.settings.compiler) in ["clang"]: flags.append( "toolset=%s-%s" % (self.settings.compiler, self.settings.compiler.version)) if self.settings.arch == 'x86' and 'address-model=32' not in flags: flags.append('address-model=32') elif self.settings.arch == 'x86_64' and 'address-model=64' not in flags: flags.append('address-model=64') if self.settings.compiler == "gcc": flags.append("--layout=system") if self.settings.compiler == "Visual Studio" and self.settings.compiler.runtime: flags.append("runtime-link=%s" % ("static" if self.msvc_mt_build else "shared")) # if self.settings.os == "Windows" and self.settings.compiler == "gcc": # flags.append("threading=multi") flags.append("threading=multi") flags.append("link=%s" % ("static" if not self.is_shared else "shared")) flags.append("variant=%s" % str(self.settings.build_type).lower()) flags.append("--reconfigure") if self.options.use_icu and self.use_icu and not self.options.without_locale: flags.append("boost.locale.iconv=off") flags.append("boost.locale.posix=off") # # # Just from icu # print("--------- FROM icu -------------") # # print(self.deps_cpp_info["icu"].include_paths) # # print(self.deps_cpp_info["icu"].lib_paths) # # print(self.deps_cpp_info["icu"].bin_paths) # print(self.deps_cpp_info["icu"].libs) # # print(self.deps_cpp_info["icu"].defines) # # print(self.deps_cpp_info["icu"].cflags) # # print(self.deps_cpp_info["icu"].cppflags) # # print(self.deps_cpp_info["icu"].sharedlinkflags) # # print(self.deps_cpp_info["icu"].exelinkflags) # if self.use_icu: if self.options.use_icu and self.use_icu: flags.append("-sICU_PATH=%s" % (self._get_icu_path(), )) # flags.append("-sICU_LINK=${ICU_LIBS[@]}") if self.options.use_bzip2 and self.use_zip_bzip2: flags.append("-sBZIP2_LIBPATH=%s" % (self.deps_cpp_info["bzip2"].lib_paths[0].replace( '\\', '/'), )) flags.append("-sBZIP2_INCLUDE=%s" % (self.deps_cpp_info["bzip2"].include_paths[0].replace( '\\', '/'), )) else: flags.append("-sNO_BZIP2=1") if self.options.use_zlib and self.use_zip_bzip2: flags.append( "-sZLIB_LIBPATH=%s" % (self.deps_cpp_info["zlib"].lib_paths[0].replace('\\', '/'), )) flags.append("-sZLIB_INCLUDE=%s" % (self.deps_cpp_info["zlib"].include_paths[0].replace( '\\', '/'), )) else: flags.append("-sNO_ZLIB=1") #TODO(fernando): Add support for LZMA/xz flags.append("-sNO_LZMA=1") if self.options.cppstd == '98': flags.append("cxxstd=98") elif self.options.cppstd == '11': flags.append("cxxstd=11") elif self.options.cppstd == '14': flags.append("cxxstd=14") elif self.options.cppstd == '17': flags.append("cxxstd=17") elif self.options.cppstd == '20': flags.append("cxxstd=20") # option_names = { # "--without-atomic": self.options.without_atomic, # "--without-chrono": self.options.without_chrono, # "--without-container": self.options.without_container, # "--without-context": self.options.without_context, # "--without-coroutine": self.options.without_coroutine, # "--without-date_time": self.options.without_date_time, # "--without-exception": self.options.without_exception, # "--without-fiber": self.options.without_fiber, # "--without-filesystem": self.options.without_filesystem, # "--without-graph": self.options.without_graph, # "--without-graph_parallel": self.options.without_graph_parallel, # "--without-iostreams": self.options.without_iostreams, # "--without-locale": self.options.without_locale, # "--without-log": self.options.without_log, # "--without-math": self.options.without_math, # "--without-mpi": self.options.without_mpi, # "--without-program_options": self.options.without_program_options, # "--without-random": self.options.without_random, # "--without-regex": self.options.without_regex, # "--without-serialization": self.options.without_serialization, # "--without-stacktrace": self.options.without_stacktrace, # "--without-system": self.options.without_system, # "--without-test": self.options.without_test, # "--without-thread": self.options.without_thread, # "--without-timer": self.options.without_timer, # "--without-type_erasure": self.options.without_type_erasure, # "--without-wave": self.options.without_wave # } # for option_name, activated in option_names.items(): # if activated: # flags.append(option_name) for libname in lib_list: if getattr(self.options, "without_%s" % libname): flags.append("--without-%s" % libname) # CXX FLAGS cxx_flags = [] # fPIC DEFINITION if self.fPIC_enabled: cxx_flags.append("-fPIC") # try: # if self.settings.compiler in [ "gcc", "clang" ]: # cxx_flags.append("-std=c++11") # always C++11 (at minimum) # if self.settings.compiler != "Visual Studio": # cxx_flags.append("-Wno-deprecated-declarations") # if self.settings.compiler == "gcc": # if float(self.settings.compiler.version) >= 5: # flags.append("define=_GLIBCXX_USE_CXX11_ABI=1") # else: # flags.append("define=_GLIBCXX_USE_CXX11_ABI=0") # if "clang" in str(self.settings.compiler): # if str(self.settings.compiler.libcxx) == "libc++": # cxx_flags.append("-stdlib=libc++") # cxx_flags.append("-std=c++11") # flags.append('linkflags="-stdlib=libc++"') # else: # cxx_flags.append("-stdlib=libstdc++") # cxx_flags.append("-std=c++11") # except BaseException as e: # self.output.warn(str(e)) if self.settings.compiler == "Visual Studio": cxx_flags.append("/DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE") # Related with: # https://github.com/boostorg/iostreams/issues/60 # https://github.com/boostorg/iostreams/pull/57/files # Not fixed in Boost Iostreams 1.68.0 # Maybe fixed in 1.69.0 # cxx_flags.append("/D_SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING") # Standalone toolchain fails when declare the std lib if self.settings.os != "Android": try: # if self.settings.compiler in [ "gcc", "clang", "apple-clang" ]: # cxx_flags.append("-std=c++11") # always C++11 (at minimum) if self.settings.compiler != "Visual Studio": cxx_flags.append("-Wno-deprecated-declarations") # if self.settings.compiler == "gcc": # if float(self.settings.compiler.version) >= 5: # flags.append("define=_GLIBCXX_USE_CXX11_ABI=1") # else: # flags.append("define=_GLIBCXX_USE_CXX11_ABI=0") # if self.settings.compiler == "gcc": # if str(self.settings.compiler.libcxx) == "libstdc++": # flags.append("define=_GLIBCXX_USE_CXX11_ABI=0") # elif str(self.settings.compiler.libcxx) == "libstdc++11": # flags.append("define=_GLIBCXX_USE_CXX11_ABI=1") if self.settings.compiler == "gcc": if float(str(self.settings.compiler.version)) >= 5: flags.append("define=_GLIBCXX_USE_CXX11_ABI=1") else: flags.append("define=_GLIBCXX_USE_CXX11_ABI=0") elif self.settings.compiler == "clang": if str(self.settings.compiler.libcxx ) == "libstdc++" or str( self.settings.compiler.libcxx) == "libstdc++11": flags.append("define=_GLIBCXX_USE_CXX11_ABI=1") if "clang" in str(self.settings.compiler): if str(self.settings.compiler.libcxx) == "libc++": cxx_flags.append("-stdlib=libc++") flags.append('linkflags="-stdlib=libc++"') else: cxx_flags.append("-stdlib=libstdc++") except: pass # except BaseException as e: # self.output.warn(str(e)) # cxx_flags = 'cxxflags="%s"' % " ".join(cxx_flags) if cxx_flags else "" # flags.append(cxx_flags) # flags.append("--without-python") if self.options.verbose: flags.append("-d 2") #Verbosity (from 1 to 13) cxx_flags = 'cxxflags="%s"' % " ".join(cxx_flags) if cxx_flags else "" flags.append(cxx_flags) return flags
def build(self): if not tools.cross_building(self.settings): cmake = CMake(self) # Current dir is "test_package/build/<build_id>" and CMakeLists.txt is in "test_package" cmake.configure() cmake.build()
def test(self): if not tools.cross_building(self.settings): os.chdir("bin") self.run(".%sexample" % os.sep)
def get_configure_command_args(self): params = [] params.append("--without-libidn2" if not self.options.with_libidn else "--with-libidn2") params.append("--without-librtmp" if not self.options.with_librtmp else "--with-librtmp") params.append("--without-libmetalink" if not self.options. with_libmetalink else "--with-libmetalink") params.append("--without-libpsl" if not self.options.with_libpsl else "--with-libpsl") params.append("--without-brotli" if not self.options.with_brotli else "--with-brotli") if self.settings.build_type == 'Debug': params.append("--enable-debug") if not self.options.get_safe("with_largefile"): params.append("--disable-largefile") if self.settings.os == "Macos" and self.options.darwin_ssl: params.append("--with-darwinssl") params.append("--without-ssl") elif self.settings.os == "Windows" and self.options.with_winssl: params.append("--with-winssl") params.append("--without-ssl") elif self.options.with_openssl: openssl_path = self.deps_cpp_info["openssl"].rootpath.replace( '\\', '/') params.append("--with-ssl=%s" % openssl_path) else: params.append("--without-ssl") if self.options.with_libssh2: params.append( "--with-libssh2=%s" % self.deps_cpp_info["libssh2"].lib_paths[0].replace('\\', '/')) else: params.append("--without-libssh2") if self.options.with_nghttp2: params.append( "--with-nghttp2=%s" % self.deps_cpp_info["nghttp2"].rootpath.replace('\\', '/')) else: params.append("--without-nghttp2") params.append( "--with-zlib=%s" % self.deps_cpp_info["zlib"].lib_paths[0].replace('\\', '/')) if not self.options.shared: params.append("--disable-shared") params.append("--enable-static") else: params.append("--enable-shared") params.append("--disable-static") if self.options.disable_threads: params.append("--disable-thread") if not self.options.with_ldap: params.append("--disable-ldap") 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)) host = None # Cross building flags if tools.cross_building( self.settings) and self.settings.os in ["Linux", "iOS"]: host = self.get_host() return params, host
def test(self): if not tools.cross_building(self.settings): os.chdir("bin") self.run(".%sexample" % os.sep)
def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "example") self.run(bin_path, run_environment=True)
def test(self): if not tools.cross_building(self.settings): os.chdir("bin") self.run(".%sversion_check" % os.sep)
def test(self): if not tools.cross_building(self.settings): bin_path = os.path.join("bin", "test_package") self.run("{} --width 640".format(bin_path), run_environment=True) self.run("{} --help".format(bin_path), run_environment=True)