Esempio n. 1
0
 def cmake_flags(self):
     
     # Retrieve the absolute paths to libprotobuf, libprotoc, and protoc
     from ue4util import Utility
     protobuf = self.deps_cpp_info["protobuf-ue4"]
     libprotobuf = Utility.resolve_file(protobuf.lib_paths[0], "protobuf")
     libprotoc = Utility.resolve_file(protobuf.lib_paths[0], "protoc")
     protoc = Utility.resolve_file(protobuf.bin_paths[0], "protoc")
     
     # Generate the CMake flags to use our custom dependencies
     cares = self.deps_cpp_info["cares-ue4"]
     openssl = self.deps_cpp_info["OpenSSL"]
     zlib = self.deps_cpp_info["zlib"]
     return [
         "-DgRPC_BUILD_CSHARP_EXT=OFF",
         "-DgRPC_BUILD_TESTS=OFF",
         "-DgRPC_MSVC_STATIC_RUNTIME=OFF",
         "-DgRPC_CARES_PROVIDER=package",
         "-DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG",
         "-DgRPC_PROTOBUF_PROVIDER=package",
         "-DgRPC_SSL_PROVIDER=package",
         "-DgRPC_ZLIB_PROVIDER=package",
         "-Dc-ares_DIR=" + os.path.join(cares.lib_paths[0], "cmake", "c-ares"),
         "-DOPENSSL_SYSTEM_LIBRARIES={}".format(";".join(openssl.system_libs)),
         "-DOPENSSL_USE_STATIC_LIBS=ON",
         "-DOPENSSL_ROOT_DIR=" + openssl.rootpath,
         "-DProtobuf_DIR=" + os.path.join(protobuf.rootpath, "cmake"),
         "-DZLIB_INCLUDE_DIR=" + zlib.include_paths[0],
         "-DZLIB_LIBRARY=" + Utility.resolve_file(zlib.lib_paths[0], zlib.libs[0]),
     ]
Esempio n. 2
0
    def __init__(self, build_data):
        '''
        Creates a new ProtoCompiler using the supplied builder data, which is provided
        by the `grpc-ue4` package to consumers via `user_info.build_data`
        '''

        # De-serialise the JSON build data
        protobuf, grpc = json.loads(build_data)

        # Retrieve the absolute path to protoc and the gRPC C++ plugin
        self.protoc = Utility.resolve_file(protobuf, "protoc")
        self.plugin = Utility.resolve_file(grpc, "grpc_cpp_plugin")
Esempio n. 3
0
    def cmake_flags(self):

        # Generate the CMake flags to ensure the UE4-bundled version of zlib is used
        from ue4util import Utility
        zlib = self.deps_cpp_info["zlib"]
        return [
            "-DBUILD_SHARED_LIBS=OFF", "-Dprotobuf_BUILD_TESTS=OFF",
            "-Dprotobuf_MSVC_STATIC_RUNTIME=OFF",
            "-DZLIB_INCLUDE_DIR=" + zlib.include_paths[0], "-DZLIB_LIBRARY=" +
            Utility.resolve_file(zlib.lib_paths[0], zlib.libs[0])
        ]
Esempio n. 4
0
    def _configure_cmake(self):

        # Generate the CMake flags to ensure the UE4-bundled version of zlib is used
        from ue4util import Utility
        zlib = self.deps_cpp_info["zlib"]

        if self._cmake:
            return self._cmake
        self._cmake = CMake(self)

        self._cmake.definitions["ZLIB_INCLUDE_DIR"] = zlib.include_paths[0]
        self._cmake.definitions["ZLIB_LIBRARY"] = Utility.resolve_file(
            zlib.lib_paths[0], zlib.libs[0])
        if self.settings.os != "Windows":
            self._cmake.definitions["USE_FILESYSTEM_FALLBACK"] = True
        self._cmake.configure(source_dir="11zip")
        return self._cmake
Esempio n. 5
0
    def configure_flags(self):

        # Determine the absolute path to `geos-config`
        from ue4util import Utility
        geos = self.deps_cpp_info["geos-ue4"]
        geosConfig = Utility.resolve_file(geos.bin_paths[0], "geos-config")

        return [
            "--prefix=" + self.package_folder, "--datarootdir={}/data".format(
                self.package_folder), "--enable-static", "--disable-shared",
            "--without-libtool", "--enable-pdf-plugin=no",
            "--without-ld-shared", "--with-threads=yes",
            "--with-libz={}".format(self.deps_cpp_info["zlib"].rootpath),
            "--without-liblzma", "--without-libiconv-prefix", "--without-pg",
            "--without-grass", "--without-libgrass", "--without-cfitsio",
            "--without-pcraster", "--with-png={}".format(
                self.deps_cpp_info["UElibPNG"].rootpath), "--without-mrf",
            "--without-dds", "--without-gta", "--with-libtiff=internal",
            "--with-geotiff=internal", "--with-jpeg=internal",
            "--with-rename_internal_libtiff_symbols",
            "--with-rename_internal_libgeotiff_symbols", "--without-jpeg12",
            "--without-gif", "--without-ogdi", "--without-fme",
            "--without-sosi", "--without-mongocxx", "--without-hdf4",
            "--without-hdf5", "--without-kea", "--without-netcdf",
            "--without-jasper", "--without-openjpeg", "--without-fgdb",
            "--without-ecw", "--without-kakadu", "--without-mrsid",
            "--without-jp2mrsid", "--without-mrsid_lidar", "--without-msg",
            "--without-bsb", "--without-oci", "--without-oci-include",
            "--without-oci-lib", "--without-grib", "--without-mysql",
            "--without-ingres", "--without-xerces", "--without-expat",
            "--without-libkml", "--without-odbc", "--with-dods-root=no",
            "--without-curl", "--without-xml2", "--without-spatialite",
            "--without-sqlite3", "--without-pcre", "--without-idb",
            "--without-sde", "--without-epsilon", "--without-webp",
            "--without-qhull", "--with-freexl=no", "--with-libjson-c=internal",
            "--without-pam", "--without-poppler", "--without-podofo",
            "--without-pdfium", "--without-perl", "--without-python",
            "--without-java", "--without-mdb", "--without-rasdaman",
            "--without-armadillo", "--without-cryptopp", "--with-zstd=no",
            "--with-proj={}".format(self.deps_cpp_info["proj-ue4"].rootpath),
            "--with-geos={}".format(geosConfig)
        ]
Esempio n. 6
0
    def _configure_cmake(self):
        
        # Generate the CMake flags to ensure the UE4-bundled version of zlib is used
        from ue4util import Utility
        zlib = self.deps_cpp_info["zlib"]
        openssl = self.deps_cpp_info["OpenSSL"]

        if self._cmake:
            return self._cmake
        self._cmake = CMake(self)
        self._cmake.definitions["BUILD_REGRESS"] = False
        self._cmake.definitions["BUILD_EXAMPLES"] = False
        self._cmake.definitions["BUILD_DOC"] = False

        self._cmake.definitions["ENABLE_LZMA"] = False
        self._cmake.definitions["ENABLE_BZIP2"] = False
        self._cmake.definitions["ENABLE_ZSTD"] = True

        self._cmake.definitions["ENABLE_COMMONCRYPTO"] = False  # TODO: We need CommonCrypto package
        self._cmake.definitions["ENABLE_GNUTLS"] = False  # TODO: We need GnuTLS package

        self._cmake.definitions["ENABLE_MBEDTLS"] = False
        self._cmake.definitions["ENABLE_OPENSSL"] = False
        self._cmake.definitions["ENABLE_WINDOWS_CRYPTO"] = False

        self._cmake.definitions["ZLIB_INCLUDE_DIR"] = zlib.include_paths[0]
        self._cmake.definitions["ZLIB_LIBRARY"] = Utility.resolve_file(zlib.lib_paths[0], zlib.libs[0])
        

        self._cmake.configure(source_dir="libzip")
        # return [
        #     "-DZLIB_INCLUDE_DIR=" + zlib.include_paths[0],
        #     "-DZLIB_LIBRARY=" + Utility.resolve_file(zlib.lib_paths[0], zlib.libs[0]),
        #     "-DOPENSSL_SYSTEM_LIBRARIES={}".format(";".join(openssl.system_libs)),
        #     "-DOPENSSL_USE_STATIC_LIBS=ON",
        #     "-DOPENSSL_ROOT_DIR=" + openssl.rootpath,
        #     "-DENABLE_GNUTLS = False",
        #     "-DENABLE_COMMONCRYPTO = False"
        # ]
        return self._cmake
Esempio n. 7
0
    def build_windows(self):

        # Retrieve the path details for PROJ, GEOS, curl, libpng and zlib
        from ue4util import Utility
        curl = self.deps_cpp_info["libcurl"]
        geos = self.deps_cpp_info["geos-ue4"]
        png = self.deps_cpp_info["UElibPNG"]
        proj = self.deps_cpp_info["proj-ue4"]
        zlib = self.deps_cpp_info["zlib"]

        # Disable unsupported external dependencies and point GDAL to the include directories and library locations of our libraries
        self._replace_multiple(
            "nmake.opt",
            [

                # Set the installation path to our package folder
                [
                    "\nGDAL_HOME = \"C:\\warmerda\\bld\"",
                    "\nGDAL_HOME = \"{}\"".format(self.package_folder)
                ],

                # Disable building GDAL as a shared library
                ["\nDLLBUILD=1", "\n#DLLBUILD=1"],

                # Disable formats for which we lack external dependencies
                [
                    "\nPAM_SETTING=-DPAM_ENABLED",
                    "\n#PAM_SETTING=-DPAM_ENABLED"
                ],
                ["\nBSB_SUPPORTED = 1", "\n#BSB_SUPPORTED = 1"],
                ["\nODBC_SUPPORTED = 1", "\n#ODBC_SUPPORTED = 1"],
                ["\nGRIB_SETTING=yes", "\n#GRIB_SETTING=yes"],
                ["\nMRF_SETTING=yes", "\n#MRF_SETTING=yes"],

                # PROJ
                [
                    "\n#PROJ_FLAGS = -DPROJ_STATIC -DPROJ_VERSION=4",
                    "\nPROJ_FLAGS = -DPROJ_STATIC -DPROJ_VERSION=4"
                ],
                [
                    "\n#PROJ_INCLUDE = -Id:\projects\proj.4\src",
                    "\nPROJ_INCLUDE=-I{}".format(proj.include_paths[0])
                ],
                [
                    "\n#PROJ_LIBRARY = d:\projects\proj.4\src\proj_i.lib",
                    "\nPROJ_LIBRARY={}".format(
                        Utility.resolve_file(proj.lib_paths[0], proj.libs[0]))
                ],

                # GEOS
                [
                    "\n#GEOS_DIR=C:/warmerda/geos", "\nGEOS_DIR={}".format(
                        geos.rootpath)
                ],
                [
                    "\n#GEOS_CFLAGS = -I$(GEOS_DIR)/capi -I$(GEOS_DIR)/source/headers -DHAVE_GEOS",
                    "\nGEOS_CFLAGS=-I{} -DHAVE_GEOS".format(
                        geos.include_paths[0])
                ],
                [
                    "\n#GEOS_LIB     = $(GEOS_DIR)/source/geos_c_i.lib",
                    "\nGEOS_LIB={}".format(" ".join([
                        Utility.resolve_file(geos.lib_paths[0], lib)
                        for lib in geos.libs
                    ]))
                ],

                # curl
                [
                    "\n#CURL_DIR=C:\curl-7.15.0", "\nCURL_DIR={}".format(
                        curl.rootpath)
                ],
                [
                    "\n#CURL_INC = -I$(CURL_DIR)/include",
                    "\nCURL_INC = -I{}".format(curl.include_paths[0])
                ],
                [
                    "\n#CURL_LIB = $(CURL_DIR)/libcurl.lib",
                    "\nCURL_LIB = {}".format(
                        Utility.resolve_file(curl.lib_paths[0], curl.libs[0]))
                ],
                [
                    "\n#CURL_CFLAGS = -DCURL_STATICLIB",
                    "\nCURL_CFLAGS = -DCURL_STATICLIB"
                ],

                # libpng
                ["\n#PNG_EXTERNAL_LIB = 1", "\nPNG_EXTERNAL_LIB = 1"],
                [
                    "\n#PNGDIR = c:/projects/libpng-1.0.8",
                    "\nPNGDIR = {}".format(png.include_paths[0])
                ],
                [
                    "\n#PNG_LIB = $(PNGDIR)/libpng.lib",
                    "\nPNG_LIB = {}".format(
                        Utility.resolve_file(png.lib_paths[0], png.libs[0]))
                ],

                # zlib
                ["\n#ZLIB_EXTERNAL_LIB = 1", "\nZLIB_EXTERNAL_LIB = 1"],
                [
                    "\n#ZLIB_INC = -IC:\projects\zlib",
                    "\nZLIB_INC = -I{}".format(zlib.include_paths[0])
                ],
                [
                    "\n#ZLIB_LIB = C:\projects\lib\Release\zlib.lib",
                    "\nZLIB_LIB = {}".format(
                        Utility.resolve_file(zlib.lib_paths[0], zlib.libs[0]))
                ]
            ])

        # Prevent the GDAL command-line tools from being built (since they don't work nicely with a static build) but ensure their library functions are still built
        self._replace_multiple(
            "makefile.vc",
            [

                # Change the call to build the default target in the apps subdirectory to build just the libraries without the associated executables
                [
                    "\n\tcd apps\r\n\t$(MAKE) /f makefile.vc\r\n",
                    "\n\tcd apps\r\n\t$(MAKE) /f makefile.vc appslib\r\n"
                ],

                # Comment out the call to build the install target in the apps subdirectory
                [
                    "\n\tcd ..\\apps\r\n\t$(MAKE) /f makefile.vc install",
                    "\n\tcd ..\\apps\r\n\techo $(MAKE) /f makefile.vc install"
                ],

                # Prevent our external dependencies from being bundled into the GDAL static library
                [
                    "lib /nologo /out:gdal.lib $(LIBOBJ) $(EXTERNAL_LIBS)",
                    "lib /nologo /out:gdal.lib $(LIBOBJ)"
                ]
            ])

        # Patch the Visual Studio project file generation script to call the installation target when building the project
        tools.replace_in_file("generate_vcxproj.bat",
                              "^</NMakeBuildCommandLine^>",
                              " devinstall^</NMakeBuildCommandLine^>")

        # Generate the Visual Studio project file
        msvcVersion = int(str(self.settings.compiler.version))
        self.run("generate_vcxproj.bat {:.1f} {} gdal".format(
            15 if msvcVersion > 15 else msvcVersion,
            '64' if self.settings.arch == 'x86_64' else '32'))

        # Build the project and install the built files in our package folder
        msbuild = MSBuild(self)
        msbuild.build("gdal.vcxproj")
Esempio n. 8
0
    def cmake_flags(self):
        flags = [

            # Disable a whole bunch of external dependencies
            "-DENABLE_IMPL_COLLECTION=OFF",
            "-DENABLE_INSTRUMENTATION=OFF",
            "-DENABLE_NOISY_WARNINGS=OFF",
            "-DENABLE_POPCNT=OFF",
            "-DENABLE_SOLUTION_FOLDERS=ON",
            "-DINSTALL_CREATE_DISTRIB=OFF",
            "-DINSTALL_C_EXAMPLES=OFF",
            "-DINSTALL_PYTHON_EXAMPLES=OFF",
            "-DINSTALL_TESTS=OFF",
            "-DBUILD_SHARED_LIBS=OFF",
            "-DBUILD_TESTS=OFF",
            "-DBUILD_PERF_TESTS=OFF",
            "-DBUILD_opencv_python2=OFF",
            "-DBUILD_opencv_python3=OFF",
            "-DBUILD_CUDA_STUBS=OFF",
            "-DWITH_CLP=OFF",
            "-DWITH_CSTRIPES=OFF",
            "-DWITH_CUBLAS=OFF",
            "-DWITH_CUDA=OFF",
            "-DWITH_CUFFT=OFF",
            "-DWITH_DIRECTX=OFF",
            "-DWITH_DSHOW=OFF",
            "-DWITH_EIGEN=OFF",
            "-DWITH_FFMPEG=OFF",
            "-DWITH_GDAL=OFF",
            "-DWITH_GDCM=OFF",
            "-DWITH_GIGEAPI=OFF",
            "-DWITH_GSTREAMER=OFF",
            "-DWITH_GSTREAMER_0_10=OFF",
            "-DWITH_INTELPERC=OFF",
            "-DWITH_IPP=OFF",
            "-DWITH_IPP_A=OFF",
            "-DWITH_JASPER=OFF",
            "-DWITH_JPEG=OFF",
            "-DWITH_LAPACK=OFF",
            "-DWITH_MATLAB=OFF",
            "-DWITH_MSMF=OFF",
            "-DWITH_OPENCL=OFF",
            "-DWITH_OPENCLAMDBLAS=OFF",
            "-DWITH_OPENCLAMDFFT=OFF",
            "-DWITH_OPENCL_SVM=OFF",
            "-DWITH_OPENEXR=OFF",
            "-DWITH_OPENGL=OFF",
            "-DWITH_OPENMP=OFF",
            "-DWITH_OPENNI=OFF",
            "-DWITH_OPENNI2=OFF",
            "-DWITH_OPENVX=OFF",
            "-DWITH_PVAPI=OFF",
            "-DWITH_QT=OFF",
            "-DWITH_TBB=OFF",
            "-DWITH_TIFF=OFF",
            "-DWITH_VFW=OFF",
            "-DWITH_VTK=OFF",
            "-DWITH_WEBP=OFF",
            "-DWITH_WIN32UI=OFF",
            "-DWITH_XIMEA=OFF",
            "-DWITH_ITT=OFF",
            "-DBUILD_WITH_STATIC_CRT=OFF",

            # Just build a few core modules
            "-DBUILD_opencv_apps=OFF",
            "-DBUILD_opencv_calib3d=OFF",
            "-DBUILD_opencv_core=ON",
            "-DBUILD_opencv_cudaarithm=OFF",
            "-DBUILD_opencv_cudabgsegm=OFF",
            "-DBUILD_opencv_cudacodec=OFF",
            "-DBUILD_opencv_cudafeatures2d=OFF",
            "-DBUILD_opencv_cudafilters=OFF",
            "-DBUILD_opencv_cudaimgproc=OFF",
            "-DBUILD_opencv_cudalegacy=OFF",
            "-DBUILD_opencv_cudaobjdetect=OFF",
            "-DBUILD_opencv_cudaoptflow=OFF",
            "-DBUILD_opencv_cudastereo=OFF",
            "-DBUILD_opencv_cudawarping=OFF",
            "-DBUILD_opencv_cudev=OFF",
            "-DBUILD_opencv_dnn=OFF",
            "-DBUILD_opencv_features2d=ON",
            "-DBUILD_opencv_flann=ON",
            "-DBUILD_opencv_highgui=OFF",
            "-DBUILD_opencv_imgcodecs=ON",
            "-DBUILD_opencv_imgproc=ON",
            "-DBUILD_opencv_ml=OFF",
            "-DBUILD_opencv_objdetect=OFF",
            "-DBUILD_opencv_photo=OFF",
            "-DBUILD_opencv_shape=OFF",
            "-DBUILD_opencv_stitching=OFF",
            "-DBUILD_opencv_superres=OFF",
            "-DBUILD_opencv_ts=OFF",
            "-DBUILD_opencv_video=OFF",
            "-DBUILD_opencv_videoio=OFF",
            "-DBUILD_opencv_videostab=OFF",
            "-DBUILD_opencv_world=OFF",
            "-DWITH_PNG=ON",
            "-DBUILD_ZLIB=OFF",  # Don't use bundled zlib, since we use the version from UE4
            "-DBUILD_PNG=OFF"  # Don't use bundled libpng, since we use the version from UE4
        ]

        # Append the flags to ensure OpenCV's FindXXX modules use our UE4-specific dependencies
        from ue4util import Utility
        zlib = self.deps_cpp_info["zlib"]
        libpng = self.deps_cpp_info["UElibPNG"]
        flags.extend([
            "-DPNG_PNG_INCLUDE_DIR=" + libpng.include_paths[0],
            "-DPNG_LIBRARY=" +
            Utility.resolve_file(libpng.lib_paths[0], libpng.libs[0]),
            "-DZLIB_INCLUDE_DIR=" + zlib.include_paths[0], "-DZLIB_LIBRARY=" +
            Utility.resolve_file(zlib.lib_paths[0], zlib.libs[0])
        ])
        return flags