def test_valid_min_cppstd_from_settings_with_extension(self, cppstd): """ valid_min_cppstd must returns True when current cppstd in settings has GNU extension and extensions is enabled """ conanfile = self._create_conanfile("gcc", "9", "Linux", "gnu17", "libstdc++") self.assertTrue(valid_min_cppstd(conanfile, cppstd, True)) conanfile.settings.values["compiler.cppstd"] = "17" self.assertFalse(valid_min_cppstd(conanfile, cppstd, True))
def test_min_cppstd_mingw_windows(self, cppstd): """ GNU extensions HAS effect on Windows when running a cross-building for Linux """ with mock.patch("platform.system", mock.MagicMock(return_value="Windows")): conanfile = self._create_conanfile("gcc", "9", "Linux", "gnu17", "libstdc++") self.assertTrue(valid_min_cppstd(conanfile, cppstd, True)) conanfile.settings.values["compiler.cppstd"] = "17" self.assertFalse(valid_min_cppstd(conanfile, cppstd, True))
def configure(self): if not self.options.examples: del self.settings.build_type del self.settings.os del self.settings.arch if not valid_min_cppstd(self, "17"): self.settings.compiler.cppstd = "17"
def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) self._cmake.definitions[ "BSONCXX_POLY_USE_MNMLSTC"] = self.options.polyfill == "mnmlstc" self._cmake.definitions[ "BSONCXX_POLY_USE_STD"] = self.options.polyfill == "std" self._cmake.definitions[ "BSONCXX_POLY_USE_STD_EXPERIMENTAL"] = self.options.polyfill == "experimental" self._cmake.definitions[ "BSONCXX_POLY_USE_BOOST"] = self.options.polyfill == "boost" self._cmake.definitions["BUILD_VERSION"] = self.version self._cmake.definitions[ "BSONCXX_LINK_WITH_STATIC_MONGOC"] = not self.options[ "mongo-c-driver"].shared self._cmake.definitions[ "MONGOCXX_LINK_WITH_STATIC_MONGOC"] = not self.options[ "mongo-c-driver"].shared self._cmake.definitions["MONGOCXX_ENABLE_SSL"] = self.options.with_ssl if not tools.valid_min_cppstd(self, self._minimal_std_version): self._cmake.definitions[ "CMAKE_CXX_STANDARD"] = self._minimal_std_version # FIXME: two CMake module/config files should be generated (mongoc-1.0-config.cmake and bson-1.0-config.cmake), # but it can't be modeled right now. # Fix should happen in mongo-c-driver recipe if not os.path.exists("Findbson-1.0.cmake"): self.output.info("Copying mongoc config file to bson") shutil.copy("Findmongoc-1.0.cmake", "Findbson-1.0.cmake") self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def _configure_cmake(self): cmake = CMake(self) cmake.definitions["PODOFO_BUILD_LIB_ONLY"] = True cmake.definitions["PODOFO_BUILD_SHARED"] = self.options.shared cmake.definitions["PODOFO_BUILD_STATIC"] = not self.options.shared if not self.options.threadsafe: cmake.definitions["PODOFO_NO_MULTITHREAD"] = True if not tools.valid_min_cppstd( self, 11) and tools.Version(self.version) >= "0.9.7": cmake.definitions["CMAKE_CXX_STANDARD"] = 11 # To install relocatable shared lib on Macos cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" # Custom CMake options injected in our patch, required to ensure reproducible builds cmake.definitions["PODOFO_WITH_OPENSSL"] = self.options.with_openssl cmake.definitions["PODOFO_WITH_LIBIDN"] = self.options.with_libidn cmake.definitions["PODOFO_WITH_LIBJPEG"] = self.options.with_jpeg cmake.definitions["PODOFO_WITH_TIFF"] = self.options.with_tiff cmake.definitions["PODOFO_WITH_PNG"] = self.options.with_png cmake.definitions[ "PODOFO_WITH_UNISTRING"] = self.options.with_unistring 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["PODOFO_BUILD_LIB_ONLY"] = True self._cmake.definitions["PODOFO_BUILD_SHARED"] = self.options.shared self._cmake.definitions[ "PODOFO_BUILD_STATIC"] = not self.options.shared if not self.options.threadsafe: self._cmake.definitions["PODOFO_NO_MULTITHREAD"] = True if not tools.valid_min_cppstd( self, 11) and tools.Version(self.version) >= "0.9.7": self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 # Custom CMake options injected in our patch, required to ensure reproducible builds self._cmake.definitions[ "PODOFO_WITH_OPENSSL"] = self.options.with_openssl self._cmake.definitions[ "PODOFO_WITH_LIBIDN"] = self.options.with_libidn self._cmake.definitions["PODOFO_WITH_LIBJPEG"] = self.options.with_jpeg self._cmake.definitions["PODOFO_WITH_TIFF"] = self.options.with_tiff self._cmake.definitions["PODOFO_WITH_PNG"] = self.options.with_png self._cmake.definitions[ "PODOFO_WITH_UNISTRING"] = self.options.with_unistring self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def test_valid_min_cppstd_gnu_compiler_extension(self): """ valid_min_cppstd must returns False when current compiler does not support GNU extension on Linux and extensions is required """ conanfile = self._create_conanfile("gcc", "9", "Linux", None, "libstdc++") with mock.patch("platform.system", mock.MagicMock(return_value="Linux")): with mock.patch.object(OSInfo, '_get_linux_distro_info'): with mock.patch("conans.client.tools.settings.cppstd_default", return_value="gnu1z"): self.assertFalse(valid_min_cppstd(conanfile, "20", True))
def _configure_cmake(self): if self._cmake is not None: return self._cmake # This doesn't work yet as one would expect, because the install target builds everything # and we need the install target because of the generated CMake files # # enable_mobile=False # Enables iOS and Android support # # cmake.definitions["CONAN_ENABLE_MOBILE"] = "ON" if self.options.csharp_ext else "OFF" self._cmake = CMake(self) self._cmake.definitions["gRPC_BUILD_CODEGEN"] = self.options.codegen self._cmake.definitions[ "gRPC_BUILD_CSHARP_EXT"] = self.options.csharp_ext self._cmake.definitions["gRPC_BUILD_TESTS"] = False # We need the generated cmake/ files (bc they depend on the list of targets, which is dynamic) self._cmake.definitions["gRPC_INSTALL"] = True # tell grpc to use the find_package versions self._cmake.definitions["gRPC_ZLIB_PROVIDER"] = "package" self._cmake.definitions["gRPC_CARES_PROVIDER"] = "package" self._cmake.definitions["gRPC_RE2_PROVIDER"] = "package" self._cmake.definitions["gRPC_SSL_PROVIDER"] = "package" self._cmake.definitions["gRPC_PROTOBUF_PROVIDER"] = "package" self._cmake.definitions["gRPC_ABSL_PROVIDER"] = "package" self._cmake.definitions[ "gRPC_BUILD_GRPC_CPP_PLUGIN"] = self.options.cpp_plugin self._cmake.definitions[ "gRPC_BUILD_GRPC_CSHARP_PLUGIN"] = self.options.csharp_plugin self._cmake.definitions[ "gRPC_BUILD_GRPC_NODE_PLUGIN"] = self.options.node_plugin self._cmake.definitions[ "gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN"] = self.options.objective_c_plugin self._cmake.definitions[ "gRPC_BUILD_GRPC_PHP_PLUGIN"] = self.options.php_plugin self._cmake.definitions[ "gRPC_BUILD_GRPC_PYTHON_PLUGIN"] = self.options.python_plugin self._cmake.definitions[ "gRPC_BUILD_GRPC_RUBY_PLUGIN"] = self.options.ruby_plugin # Some compilers will start defaulting to C++17, so abseil will be built using C++17 # gRPC will force C++11 if CMAKE_CXX_STANDARD is not defined # So, if settings.compiler.cppstd is not defined there will be a mismatch if not tools.valid_min_cppstd(self, 11): self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 if tools.cross_building(self): # otherwise find_package() can't find config files since # conan doesn't populate CMAKE_FIND_ROOT_PATH self._cmake.definitions[ "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE"] = "BOTH" self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) if not tools.valid_min_cppstd(self, 11): self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 self._cmake.definitions["ABSL_ENABLE_INSTALL"] = True self._cmake.definitions["BUILD_TESTING"] = False if tools.cross_building(self): self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = str(self.settings.arch) self._cmake.configure() return self._cmake
def _configure_cmake(self): cmake = CMake(self) # Inject C++ standard from profile since we have removed hardcoded C++11 from upstream build files if not tools.valid_min_cppstd(self, 11): cmake.definitions["CMAKE_CXX_STANDARD"] = 11 # Generate a relocatable shared lib on Macos cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" cmake.definitions[ "BUILD_LIBRARY_TYPE"] = "Shared" if self.options.shared else "Static" cmake.definitions["INSTALL_TEST_CASES"] = False cmake.definitions["BUILD_RESOURCES"] = False cmake.definitions["BUILD_RELEASE_DISABLE_EXCEPTIONS"] = True if self.settings.build_type == "Debug": cmake.definitions[ "BUILD_WITH_DEBUG"] = self.options.extended_debug_messages cmake.definitions["BUILD_USE_PCH"] = False cmake.definitions["INSTALL_SAMPLES"] = False cmake.definitions["INSTALL_DIR_LAYOUT"] = "Unix" cmake.definitions["INSTALL_DIR_BIN"] = "bin" cmake.definitions["INSTALL_DIR_LIB"] = "lib" cmake.definitions["INSTALL_DIR_INCLUDE"] = "include" cmake.definitions["INSTALL_DIR_RESOURCE"] = "res/resource" cmake.definitions["INSTALL_DIR_DATA"] = "res/data" cmake.definitions["INSTALL_DIR_SAMPLES"] = "res/samples" cmake.definitions["INSTALL_DIR_DOC"] = "res/doc" if is_msvc(self): cmake.definitions["BUILD_SAMPLES_MFC"] = False cmake.definitions["BUILD_SAMPLES_QT"] = False cmake.definitions["BUILD_Inspector"] = False if tools.is_apple_os(self.settings.os): cmake.definitions["USE_GLX"] = False if self.settings.os == "Windows": cmake.definitions["USE_D3D"] = False cmake.definitions["BUILD_ENABLE_FPE_SIGNAL_HANDLER"] = False cmake.definitions["BUILD_DOC_Overview"] = False cmake.definitions["USE_FREEIMAGE"] = self.options.with_freeimage cmake.definitions["USE_OPENVR"] = self.options.with_openvr cmake.definitions["USE_FFMPEG"] = self.options.with_ffmpeg cmake.definitions["USE_TBB"] = self.options.with_tbb cmake.definitions["USE_RAPIDJSON"] = self.options.with_rapidjson if tools.Version(self.version) >= "7.6.0": cmake.definitions["USE_DRACO"] = self.options.with_draco cmake.definitions["USE_TK"] = self.options.with_tk cmake.definitions["USE_OPENGL"] = self.options.with_opengl cmake.configure(source_folder=self._source_subfolder) return cmake
def _configure_cmake(self): if self._cmake is not None: return self._cmake # This doesn't work yet as one would expect, because the install target builds everything # and we need the install target because of the generated CMake files # # enable_mobile=False # Enables iOS and Android support # # cmake.definitions["CONAN_ENABLE_MOBILE"] = "ON" if self.options.csharp_ext else "OFF" self._cmake = CMake(self) self._cmake.definitions["gRPC_BUILD_CODEGEN"] = self.options.codegen self._cmake.definitions["gRPC_BUILD_CSHARP_EXT"] = self.options.csharp_ext self._cmake.definitions["gRPC_BUILD_TESTS"] = False # We need the generated cmake/ files (bc they depend on the list of targets, which is dynamic) self._cmake.definitions["gRPC_INSTALL"] = True self._cmake.definitions["gRPC_INSTALL_SHAREDIR"] = "res/grpc" # tell grpc to use the find_package versions self._cmake.definitions["gRPC_ZLIB_PROVIDER"] = "package" self._cmake.definitions["gRPC_CARES_PROVIDER"] = "package" self._cmake.definitions["gRPC_RE2_PROVIDER"] = "package" self._cmake.definitions["gRPC_SSL_PROVIDER"] = "package" self._cmake.definitions["gRPC_PROTOBUF_PROVIDER"] = "package" self._cmake.definitions["gRPC_ABSL_PROVIDER"] = "package" self._cmake.definitions["gRPC_BUILD_GRPC_CPP_PLUGIN"] = self.options.cpp_plugin self._cmake.definitions["gRPC_BUILD_GRPC_CSHARP_PLUGIN"] = self.options.csharp_plugin self._cmake.definitions["gRPC_BUILD_GRPC_NODE_PLUGIN"] = self.options.node_plugin self._cmake.definitions["gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN"] = self.options.objective_c_plugin self._cmake.definitions["gRPC_BUILD_GRPC_PHP_PLUGIN"] = self.options.php_plugin self._cmake.definitions["gRPC_BUILD_GRPC_PYTHON_PLUGIN"] = self.options.python_plugin self._cmake.definitions["gRPC_BUILD_GRPC_RUBY_PLUGIN"] = self.options.ruby_plugin # Require C++11 at least. Consumed targets (abseil) via interface target_compiler_feature # can propagate newer standards if not tools.valid_min_cppstd(self, 11): self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 if tools.cross_building(self): # otherwise find_package() can't find config files since # conan doesn't populate CMAKE_FIND_ROOT_PATH self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_PACKAGE"] = "BOTH" if tools.is_apple_os(self.settings.os): # workaround for: install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def _configure_cmake(self): if not self._cmake: self._cmake = CMake(self) self._cmake.definitions["BUILD_TESTS"] = False self._cmake.definitions["BUILD_EXAMPLES"] = False self._cmake.definitions["BUILD_PACKAGES"] = False self._cmake.definitions[ "BUILD_SQLITE3"] = self.options.with_sqlite3 if tools.Version( self.version) >= "1.2.2" and not tools.valid_min_cppstd( self, 14): self._cmake.definitions["CMAKE_CXX_STANDARD"] = 14 self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) if not tools.valid_min_cppstd(self, 11): self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 self._cmake.definitions["CRC32C_BUILD_TESTS"] = False self._cmake.definitions["CRC32C_BUILD_BENCHMARKS"] = False self._cmake.definitions["CRC32C_INSTALL"] = True self._cmake.definitions["CRC32C_USE_GLOG"] = False self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def _configure_cmake(self): cmake = CMake(self) cmake.definitions["USE_THIRDPARTY_LIBRARIES"] = False cmake.definitions["ENABLE_TESTING"] = False cmake.definitions[ "OVERRIDE_CXX_STANDARD_FLAGS"] = not tools.valid_min_cppstd( self, 11) cmake.definitions["ENABLE_PULL"] = self.options.with_pull cmake.definitions["ENABLE_PUSH"] = self.options.with_push if self.options.with_pull: cmake.definitions[ "ENABLE_COMPRESSION"] = self.options.with_compression 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["GDCM_BUILD_DOCBOOK_MANPAGES"] = False self._cmake.definitions["GDCM_BUILD_SHARED_LIBS"] = self.options.shared # FIXME: unvendor deps https://github.com/conan-io/conan-center-index/pull/5705#discussion_r647224146 self._cmake.definitions["GDCM_USE_SYSTEM_EXPAT"] = True self._cmake.definitions["GDCM_USE_SYSTEM_OPENJPEG"] = True self._cmake.definitions["GDCM_USE_SYSTEM_ZLIB"] = True if not tools.valid_min_cppstd(self, 11): self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def configure(self): if self.options.shared: del self.options.fPIC if self.settings.os == "Macos": raise ConanInvalidConfiguration("Macos build not supported") if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("The compilation of SystemC as a " "DLL on Windows is currently not " "supported") if tools.valid_min_cppstd(self, "17"): raise ConanInvalidConfiguration( "C++ Standard %s not supported by SystemC" % self.settings.compiler.cppstd)
def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) self._cmake.definitions["LIBTINS_BUILD_EXAMPLES"] = False self._cmake.definitions["LIBTINS_BUILD_TESTS"] = False self._cmake.definitions["LIBTINS_BUILD_SHARED"] = self.options.shared self._cmake.definitions[ "LIBTINS_ENABLE_CXX11"] = tools.valid_min_cppstd(self, 11) self._cmake.definitions[ "LIBTINS_ENABLE_ACK_TRACKER"] = self.options.with_ack_tracker self._cmake.definitions["LIBTINS_ENABLE_WPA2"] = self.options.with_wpa2 self._cmake.definitions[ "LIBTINS_ENABLE_DOT11"] = self.options.with_dot11 self._cmake.configure(build_folder=self._build_subfolder) return self._cmake
def _configure_autotools(self): autotools = AutoToolsBuildEnvironment( self, win_bash=tools.os_info.is_windows) yes_no = lambda v: "yes" if v else "no" internal_no = lambda v: "internal" if v else "no" rootpath = lambda req: tools.unix_path(self.deps_cpp_info[req].rootpath ) rootpath_no = lambda v, req: rootpath(req) if v else "no" args = [] args.append("--datarootdir={}".format( tools.unix_path(os.path.join(self.package_folder, "res")))) # Shared/Static args.extend([ "--enable-static={}".format(yes_no(not self.options.shared)), "--enable-shared={}".format(yes_no(self.options.shared)), ]) args.append("--includedir={}".format( tools.unix_path( os.path.join(self.package_folder, "include", "gdal")))) # Enable C++14 if requested in conan profile or if with_charls enabled if (self.settings.compiler.cppstd and tools.valid_min_cppstd( self, 14)) or self.options.with_charls: args.append("--with-cpp14") # Debug if self.settings.build_type == "Debug": args.append("--enable-debug") # SIMD Intrinsics simd_intrinsics = self.options.get_safe("simd_intrinsics", False) if not simd_intrinsics: args.extend(["--without-sse", "--without-ssse3", "--without-avx"]) elif simd_intrinsics == "sse": args.extend(["--with-sse", "--without-ssse3", "--without-avx"]) elif simd_intrinsics == "ssse3": args.extend(["--with-sse", "--with-ssse3", "--without-avx"]) elif simd_intrinsics == "avx": args.extend(["--with-sse", "--with-ssse3", "--with-avx"]) # LTO (disabled) args.append("--disable-lto") # Symbols args.append("--with-hide_internal_symbols") # Do not add /usr/local/lib and /usr/local/include args.append("--without-local") # Threadsafe args.append("--with-threads={}".format(yes_no( self.options.threadsafe))) # Depencencies: args.append("--with-proj=yes") # always required ! args.append("--with-libz={}".format(yes_no(self.options.with_zlib))) if self._has_with_libdeflate_option: args.append("--with-libdeflate={}".format( yes_no(self.options.with_libdeflate))) args.append("--with-libiconv-prefix={}".format( rootpath_no(self.options.with_libiconv, "libiconv"))) args.append( "--with-liblzma=no" ) # always disabled: liblzma is an optional transitive dependency of gdal (through libtiff). args.append("--with-zstd={}".format( yes_no(self.options.get_safe("with_zstd")) )) # Optional direct dependency of gdal only if lerc lib enabled if self._has_with_blosc_option: args.append("--with-blosc={}".format( yes_no(self.options.with_blosc))) if self._has_with_lz4_option: args.append("--with-lz4={}".format(yes_no(self.options.with_lz4))) # Drivers: if not (self.options.with_zlib and self.options.with_png and bool(self.options.with_jpeg)): # MRF raster driver always depends on zlib, libpng and libjpeg: https://github.com/OSGeo/gdal/issues/2581 if tools.Version(self.version) < "3.0.0": args.append("--without-mrf") else: args.append("--disable-driver-mrf") args.append("--with-pg={}".format(yes_no(self.options.with_pg))) args.extend(["--without-grass", "--without-libgrass" ]) # TODO: to implement when libgrass lib available args.append("--with-cfitsio={}".format( rootpath_no(self.options.with_cfitsio, "cfitsio"))) args.append("--with-pcraster={}".format( internal_no(self.options.with_pcraster) )) # TODO: use conan recipe when available instead of internal one args.append("--with-png={}".format( rootpath_no(self.options.with_png, "libpng"))) args.append("--with-dds={}".format( rootpath_no(self.options.with_dds, "crunch"))) args.append("--with-gta={}".format( rootpath_no(self.options.with_gta, "libgta"))) args.append("--with-pcidsk={}".format( internal_no(self.options.with_pcidsk) )) # TODO: use conan recipe when available instead of internal one args.append("--with-libtiff={}".format( rootpath("libtiff"))) # always required ! args.append("--with-geotiff={}".format( rootpath("libgeotiff"))) # always required ! if self.options.with_jpeg == "libjpeg": args.append("--with-jpeg={}".format(rootpath("libjpeg"))) elif self.options.with_jpeg == "libjpeg-turbo": args.append("--with-jpeg={}".format(rootpath("libjpeg-turbo"))) else: args.append("--without-jpeg") args.append("--without-jpeg12" ) # disabled: it requires internal libjpeg and libgeotiff args.append("--with-charls={}".format(yes_no( self.options.with_charls))) args.append("--with-gif={}".format( rootpath_no(self.options.with_gif, "giflib"))) args.append( "--without-ogdi" ) # TODO: to implement when ogdi lib available (https://sourceforge.net/projects/ogdi/) args.append("--without-fme") # commercial library args.append( "--without-sosi") # TODO: to implement when fyba lib available args.append("--without-mongocxx") # TODO: handle mongo-cxx-driver v2 args.append("--with-mongocxxv3={}".format( yes_no(self.options.with_mongocxx))) args.append("--with-hdf4={}".format(yes_no(self.options.with_hdf4))) args.append("--with-hdf5={}".format(yes_no(self.options.with_hdf5))) args.append("--with-kea={}".format(yes_no(self.options.with_kea))) args.append("--with-netcdf={}".format( rootpath_no(self.options.with_netcdf, "netcdf"))) args.append("--with-jasper={}".format( rootpath_no(self.options.with_jasper, "jasper"))) args.append("--with-openjpeg={}".format( yes_no(self.options.with_openjpeg))) args.append( "--without-fgdb" ) # TODO: to implement when file-geodatabase-api lib available args.append("--without-ecw") # commercial library args.append("--without-kakadu") # commercial library args.extend( ["--without-mrsid", "--without-jp2mrsid", "--without-mrsid_lidar"]) # commercial library args.append("--without-jp2lura") # commercial library args.append("--without-msg") # commercial library args.append("--without-oci") # TODO args.append("--with-gnm={}".format(yes_no(self.options.with_gnm))) args.append("--with-mysql={}".format(yes_no(self.options.with_mysql))) args.append("--without-ingres") # commercial library args.append("--with-xerces={}".format( rootpath_no(self.options.with_xerces, "xerces-c"))) args.append("--with-expat={}".format(yes_no(self.options.with_expat))) args.append("--with-libkml={}".format( rootpath_no(self.options.with_libkml, "libkml"))) if self.options.with_odbc: args.append("--with-odbc={}".format( "yes" if self.settings.os == "Windows" else rootpath("odbc"))) else: args.append("--without-odbc") args.append("--without-dods-root" ) # TODO: to implement when libdap lib available args.append("--with-curl={}".format(yes_no(self.options.with_curl))) args.append("--with-xml2={}".format(yes_no(self.options.with_xml2))) args.append("--without-spatialite" ) # TODO: to implement when libspatialite lib available args.append("--with-sqlite3={}".format( yes_no(self.options.get_safe("with_sqlite3")))) args.append("--without-rasterlite2" ) # TODO: to implement when rasterlite2 lib available if self._has_with_pcre2_option: args.append("--with-pcre2={}".format( yes_no(self.options.get_safe("with_pcre2")))) args.append("--with-pcre={}".format( yes_no(self.options.get_safe("with_pcre")))) args.append("--without-teigha") # commercial library args.append("--without-idb") # commercial library if tools.Version(self.version) < "3.2.0": args.append("--without-sde") # commercial library if tools.Version(self.version) < "3.3.0": args.append("--without-epsilon") args.append("--with-webp={}".format( rootpath_no(self.options.with_webp, "libwebp"))) args.append("--with-geos={}".format(yes_no(self.options.with_geos))) args.append( "--without-sfcgal") # TODO: to implement when sfcgal lib available args.append("--with-qhull={}".format(yes_no(self.options.with_qhull))) if self.options.with_opencl: args.extend([ "--with-opencl", "--with-opencl-include={}".format( tools.unix_path(self.deps_cpp_info["opencl-headers"]. include_paths[0])), "--with-opencl-lib=-L{}".format( tools.unix_path( self.deps_cpp_info["opencl-icd-loader"].lib_paths[0])) ]) else: args.append("--without-opencl") args.append("--with-freexl={}".format(yes_no( self.options.with_freexl))) args.append("--with-libjson-c={}".format( rootpath("json-c"))) # always required ! if self.options.without_pam: args.append("--without-pam") args.append("--with-poppler={}".format( yes_no(self.options.with_poppler))) args.append("--with-podofo={}".format( rootpath_no(self.options.with_podofo, "podofo"))) if self.options.with_podofo: args.append("--with-podofo-lib=-l{}".format(" -l".join( self._gather_libs("podofo")))) args.append( "--without-pdfium") # TODO: to implement when pdfium lib available args.append("--without-perl") args.append("--without-python") args.append("--without-java") args.append("--without-hdfs") if tools.Version(self.version) >= "3.0.0": args.append("--without-tiledb" ) # TODO: to implement when tiledb lib available args.append("--without-mdb") args.append("--without-rasdaman" ) # TODO: to implement when rasdaman lib available if self._has_with_brunsli_option: args.append("--with-brunsli={}".format( yes_no(self.options.with_brunsli))) if tools.Version(self.version) >= "3.1.0": args.append("--without-rdb") # commercial library args.append("--without-armadillo" ) # TODO: to implement when armadillo lib available args.append("--with-cryptopp={}".format( rootpath_no(self.options.with_cryptopp, "cryptopp"))) args.append("--with-crypto={}".format(yes_no( self.options.with_crypto))) if tools.Version(self.version) >= "3.3.0": args.append("--with-lerc={}".format( internal_no(not self.options.without_lerc))) else: args.append("--with-lerc={}".format( yes_no(not self.options.without_lerc))) if self.options.with_null: args.append("--with-null") if self._has_with_exr_option: args.append("--with-exr={}".format(yes_no(self.options.with_exr))) if self._has_with_heif_option: args.append("--with-heif={}".format(yes_no( self.options.with_heif))) # Inject -stdlib=libc++ for clang with libc++ env_build_vars = autotools.vars if self.settings.compiler == "clang" and \ self.settings.os == "Linux" and tools.stdcpp_library(self) == "c++": env_build_vars["LDFLAGS"] = "-stdlib=libc++ {}".format( env_build_vars["LDFLAGS"]) autotools.configure(args=args, vars=env_build_vars) return autotools
def test_valid_min_cppstd_from_outdated_settings(self, cppstd): """ valid_min_cppstd returns False when cppstd is greater when supported on settings """ conanfile = self._create_conanfile("gcc", "9", "Linux", cppstd, "libstdc++") self.assertFalse(valid_min_cppstd(conanfile, "17", False))
def _configure_autotools(self): if self._autotools: return self._autotools configure_dir = self._source_subfolder with tools.chdir(configure_dir): self.run("autoconf -i", win_bash=tools.os_info.is_windows) self._autotools = AutoToolsBuildEnvironment( self, win_bash=tools.os_info.is_windows) args = [] args.append("--datarootdir={}".format( tools.unix_path(os.path.join(self.package_folder, "res")))) # Shared/Static if self.options.shared: args.extend(["--disable-static", "--enable-shared"]) else: args.extend(["--disable-shared", "--enable-static"]) # Enable C++14 if requested in conan profile if self.settings.compiler.cppstd and tools.valid_min_cppstd(self, 14): args.append("--with-cpp14") # Debug if self.settings.build_type == "Debug": args.append("--enable-debug") # SIMD Intrinsics simd_intrinsics = self.options.get_safe("simd_intrinsics", False) if not simd_intrinsics: args.extend(["--without-sse", "--without-ssse3", "--without-avx"]) elif simd_intrinsics == "sse": args.extend(["--with-sse", "--without-ssse3", "--without-avx"]) elif simd_intrinsics == "ssse3": args.extend(["--with-sse", "--with-ssse3", "--without-avx"]) elif simd_intrinsics == "avx": args.extend(["--with-sse", "--with-ssse3", "--with-avx"]) # LTO (disabled) args.append("--disable-lto") # Symbols args.append("--with-hide_internal_symbols") # Do not add /usr/local/lib and /usr/local/include args.append("--without-local") # Threadsafe args.append("--with-threads={}".format( "yes" if self.options.threadsafe else "no")) # Depencencies: args.append("--with-proj=yes") # always required ! args.append( "--with-libz={}".format("yes" if self.options.with_zlib else "no")) args.append("--with-libiconv-prefix={}".format( tools.unix_path(self.deps_cpp_info["libiconv"].rootpath))) args.append( "--with-liblzma=no" ) # always disabled: liblzma is an optional transitive dependency of gdal (through libtiff). args.append("--with-zstd={}".format( "yes" if self.options.get_safe("with_zstd") else "no" )) # Optional direct dependency of gdal only if lerc lib enabled if tools.Version(self.version) >= "3.2.0": args.append( "--without-libdeflate" ) # TODO: to implement when libdeflate recipe available # Drivers: if not (self.options.with_zlib and self.options.with_png and bool(self.options.with_jpeg)): # MRF raster driver always depends on zlib, libpng and libjpeg: https://github.com/OSGeo/gdal/issues/2581 if tools.Version(self.version) < "3.0.0": args.append("--without-mrf") else: args.append("--disable-driver-mrf") args.append( "--with-pg={}".format("yes" if self.options.with_pg else "no")) args.extend(["--without-grass", "--without-libgrass" ]) # TODO: to implement when libgrass lib available args.append("--with-cfitsio={}".format( tools.unix_path(self.deps_cpp_info["cfitsio"].rootpath) if self. options.with_cfitsio else "no")) args.append("--with-pcraster={}".format( "internal" if self.options.with_pcraster else "no" )) # TODO: use conan recipe when available instead of internal one args.append("--with-png={}".format( tools.unix_path(self.deps_cpp_info["libpng"].rootpath) if self. options.with_png else "no")) args.append("--with-dds={}".format( tools.unix_path(self.deps_cpp_info["crunch"].rootpath) if self. options.with_dds else "no")) args.append("--with-gta={}".format( tools.unix_path(self.deps_cpp_info["libgta"].rootpath) if self. options.with_gta else "no")) args.append("--with-pcidsk={}".format( "internal" if self.options.with_pcidsk else "no" )) # TODO: use conan recipe when available instead of internal one args.append("--with-libtiff={}".format( tools.unix_path( self.deps_cpp_info["libtiff"].rootpath))) # always required ! args.append("--with-geotiff={}".format( tools.unix_path(self.deps_cpp_info["libgeotiff"].rootpath)) ) # always required ! if self.options.with_jpeg == "libjpeg": args.append("--with-jpeg={}".format( tools.unix_path(self.deps_cpp_info["libjpeg"].rootpath))) elif self.options.with_jpeg == "libjpeg-turbo": args.append("--with-jpeg={}".format( tools.unix_path(self.deps_cpp_info["libjpeg-turbo"].rootpath))) else: args.append("--without-jpeg") args.append("--without-jpeg12" ) # disabled: it requires internal libjpeg and libgeotiff args.append("--with-charls={}".format( "yes" if self.options.with_charls else "no")) args.append("--with-gif={}".format( tools.unix_path(self.deps_cpp_info["giflib"].rootpath) if self. options.with_gif else "no")) args.append( "--without-ogdi" ) # TODO: to implement when ogdi lib available (https://sourceforge.net/projects/ogdi/) args.append("--without-fme") # commercial library args.append( "--without-sosi") # TODO: to implement when fyba lib available args.append("--without-mongocxx" ) # TODO: to implement when mongocxx lib available args.append( "--with-hdf4={}".format("yes" if self.options.with_hdf4 else "no")) args.append( "--with-hdf5={}".format("yes" if self.options.with_hdf5 else "no")) args.append( "--with-kea={}".format("yes" if self.options.with_kea else "no")) args.append("--without-netcdf" ) # TODO: to implement when netcdf-c lib available args.append("--with-jasper={}".format( tools.unix_path(self.deps_cpp_info["jasper"].rootpath) if self. options.with_jasper else "no")) args.append("--with-openjpeg={}".format( "yes" if self.options.with_openjpeg else "no")) args.append( "--without-fgdb" ) # TODO: to implement when file-geodatabase-api lib available args.append("--without-ecw") # commercial library args.append("--without-kakadu") # commercial library args.extend( ["--without-mrsid", "--without-jp2mrsid", "--without-mrsid_lidar"]) # commercial library args.append("--without-jp2lura") # commercial library args.append("--without-msg") # commercial library args.append("--without-oci") # TODO args.append( "--with-gnm={}".format("yes" if self.options.with_gnm else "no")) args.append("--with-mysql={}".format( "yes" if bool(self.options.with_mysql) else "no")) args.append("--without-ingres") # commercial library args.append("--with-xerces={}".format( tools.unix_path(self.deps_cpp_info["xerces-c"].rootpath) if self. options.with_xerces else "no")) args.append("--with-expat={}".format( "yes" if self.options.with_expat else "no")) args.append("--with-libkml={}".format( tools.unix_path(self.deps_cpp_info["libkml"].rootpath) if self. options.with_libkml else "no")) if self.options.with_odbc: args.append("--with-odbc={}".format( "yes" if self.settings.os == "Windows" else tools. unix_path(self.deps_cpp_info["odbc"].rootpath))) else: args.append("--without-odbc") args.append("--without-dods-root" ) # TODO: to implement when libdap lib available args.append( "--with-curl={}".format("yes" if self.options.with_curl else "no")) args.append( "--with-xml2={}".format("yes" if self.options.with_xml2 else "no")) args.append("--without-spatialite" ) # TODO: to implement when libspatialite lib available args.append("--with-sqlite3={}".format( "yes" if self.options.get_safe("with_sqlite3") else "no")) args.append("--without-rasterlite2" ) # TODO: to implement when rasterlite2 lib available args.append("--with-pcre={}".format( "yes" if self.options.get_safe("with_pcre") else "no")) args.append("--without-teigha") # commercial library args.append("--without-idb") # commercial library if tools.Version(self.version) < "3.2.0": args.append("--without-sde") # commercial library args.append("--without-epsilon" ) # TODO: to implement when epsilon lib available args.append("--with-webp={}".format( tools.unix_path(self.deps_cpp_info["libwebp"].rootpath) if self. options.with_webp else "no")) args.append( "--with-geos={}".format("yes" if self.options.with_geos else "no")) args.append( "--without-sfcgal") # TODO: to implement when sfcgal lib available args.append("--with-qhull={}".format( "yes" if self.options.with_qhull else "no")) args.append( "--without-opencl" ) # TODO: to implement when opencl-headers available (and also OpenCL lib?) args.append("--with-freexl={}".format( "yes" if self.options.with_freexl else "no")) args.append("--with-libjson-c={}".format( tools.unix_path( self.deps_cpp_info["json-c"].rootpath))) # always required ! if self.options.without_pam: args.append("--without-pam") args.append("--without-poppler" ) # TODO: to implement when poppler lib available args.append( "--without-podofo") # TODO: to implement when podofo lib available args.append( "--without-pdfium") # TODO: to implement when pdfium lib available args.append("--without-perl") args.append("--without-python") args.append("--without-java") args.append("--without-hdfs") if tools.Version(self.version) >= "3.0.0": args.append("--without-tiledb" ) # TODO: to implement when tiledb lib available args.append("--without-mdb") args.append("--without-rasdaman" ) # TODO: to implement when rasdaman lib available if tools.Version(self.version) >= "3.1.0": args.append("--without-rdb") # commercial library args.append("--without-armadillo" ) # TODO: to implement when armadillo lib available args.append("--with-cryptopp={}".format( tools.unix_path(self.deps_cpp_info["cryptopp"].rootpath) if self. options.with_cryptopp else "no")) args.append("--with-crypto={}".format( "yes" if self.options.with_crypto else "no")) args.append("--with-lerc={}".format( "no" if self.options.without_lerc else "yes")) if self.options.with_null: args.append("--with-null") if self.options.get_safe("with_exr") is not None: args.append("--with-exr={}".format( "yes" if self.options.with_exr else "no")) if tools.Version(self.version) >= "3.2.0": args.append("--without-heif" ) # TODO: to implement when libheif recipe available # Inject -stdlib=libc++ for clang with libc++ env_build_vars = self._autotools.vars if self.settings.compiler == "clang" and \ self.settings.os == "Linux" and tools.stdcpp_library(self) == "c++": env_build_vars["LDFLAGS"] = "-stdlib=libc++ {}".format( env_build_vars["LDFLAGS"]) with tools.chdir(configure_dir): self._autotools.configure(args=args, vars=env_build_vars) return self._autotools
def configure(self): if not tools.valid_min_cppstd(self, "17"): self.output.warn( "C++17 is required, setting settings.compiler.cppstd=17") self.settings.compiler.cppstd = 17
def package_info(self): if not tools.valid_min_cppstd(self, "20"): self.cpp_info.defines = ["FLATBUSH_SPAN"]
def test_valid_min_cppstd_from_settings(self, cppstd): """ valid_min_cppstd must accept cppstd less/equal than cppstd in settings """ conanfile = self._create_conanfile("gcc", "9", "Linux", "17", "libstdc++") self.assertTrue(valid_min_cppstd(conanfile, cppstd, False))
def test_valid_min_cppstd_unsupported_standard(self): """ valid_min_cppstd must returns False when the compiler does not support a standard """ conanfile = self._create_conanfile("gcc", "9", "Linux", None, "libstdc++") self.assertFalse(valid_min_cppstd(conanfile, "42", False))