コード例 #1
0
 def applyCmakeSettingsForAndroid(self, cmake):
     android_toolchain = os.environ["ANDROID_NDK_PATH"] + "/build/cmake/android.toolchain.cmake"
     cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = android_toolchain
     cmake.definitions["ANDROID_NDK"] = os.environ["ANDROID_NDK_PATH"]
     cmake.definitions["ANDROID_ABI"] = tools.to_android_abi(self.settings.arch)
     cmake.definitions["ANDROID_STL"] = self.options.android_stl_type
     cmake.definitions["ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level
     cmake.definitions["ANDROID_TOOLCHAIN"] = "clang"
     cmake.definitions["DJINNI_WITH_JNI"] = "ON"
コード例 #2
0
        def add_components(components):
            for component in components:
                conan_component = component["target"]
                cmake_target = component["target"]
                cmake_component = component["lib"]
                lib_name = get_lib_name(component["lib"])
                requires = component["requires"]
                # TODO: we should also define COMPONENTS names of each target for find_package() but not possible yet in CMakeDeps
                #       see https://github.com/conan-io/conan/issues/10258
                self.cpp_info.components[conan_component].set_property("cmake_target_name", cmake_target)
                self.cpp_info.components[conan_component].libs = [lib_name]
                if self.settings.os != "Windows":
                    self.cpp_info.components[conan_component].includedirs.append(os.path.join("include", "opencv4"))
                self.cpp_info.components[conan_component].requires = requires
                if self.settings.os == "Linux":
                    self.cpp_info.components[conan_component].system_libs = ["dl", "m", "pthread", "rt"]

                if self.settings.os == "Android":
                    self.cpp_info.components[conan_component].includedirs = [
                        os.path.join("sdk", "native", "jni", "include")]
                    self.cpp_info.components[conan_component].system_libs.append("log")
                    if int(str(self.settings.os.api_level)) > 20:
                        self.cpp_info.components[conan_component].system_libs.append("mediandk")
                    if not self.options.shared:
                        self.cpp_info.components[conan_component].libdirs.append(
                            os.path.join("sdk", "native", "staticlibs", tools.to_android_abi(str(self.settings.arch))))
                        if conan_component == "opencv_core":
                            self.cpp_info.components[conan_component].libdirs.append("lib")
                            self.cpp_info.components[conan_component].libs += tools.collect_libs(self)

                if self.settings.os in ["iOS", "Macos", "Linux"]:
                    if not self.options.shared:
                        if conan_component == "opencv_core":
                            libs = list(filter(lambda x: not x.startswith("opencv"), tools.collect_libs(self)))
                            self.cpp_info.components[conan_component].libs += libs

                # TODO: to remove in conan v2 once cmake_find_package* generators removed
                self.cpp_info.components[conan_component].names["cmake_find_package"] = cmake_target
                self.cpp_info.components[conan_component].names["cmake_find_package_multi"] = cmake_target
                self.cpp_info.components[conan_component].build_modules["cmake_find_package"] = [self._module_file_rel_path]
                self.cpp_info.components[conan_component].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path]
                if cmake_component != cmake_target:
                    conan_component_alias = conan_component + "_alias"
                    self.cpp_info.components[conan_component_alias].names["cmake_find_package"] = cmake_component
                    self.cpp_info.components[conan_component_alias].names["cmake_find_package_multi"] = cmake_component
                    self.cpp_info.components[conan_component_alias].requires = [conan_component]
                    self.cpp_info.components[conan_component_alias].includedirs = []
                    self.cpp_info.components[conan_component_alias].libdirs = []
                    self.cpp_info.components[conan_component_alias].resdirs = []
                    self.cpp_info.components[conan_component_alias].bindirs = []
                    self.cpp_info.components[conan_component_alias].frameworkdirs = []
コード例 #3
0
 def applyCmakeSettingsForAndroid(self, cmake):
     android_toolchain = os.environ["ANDROID_NDK_PATH"] + "/build/cmake/android.toolchain.cmake"
     cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = android_toolchain
     cmake.definitions["ANDROID_NDK"] = os.environ["ANDROID_NDK_PATH"]
     cmake.definitions["ANDROID_ABI"] = tools.to_android_abi(self.settings.arch)
     cmake.definitions["ANDROID_STL"] = self.options.android_stl_type
     cmake.definitions["ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level
     cmake.definitions["ANDROID_TOOLCHAIN"] = "clang"
     cmake.definitions["BUILD_TESTING"] = "OFF"
     cmake.definitions["BUILD_CURL_EXE"] = "OFF"
     cmake.definitions["CMAKE_USE_LIBSSH2"] = "OFF"
     tools.replace_in_file("%s/curl-%s/CMakeLists.txt" % (self.source_folder, self.version),
         "find_package(OpenSSL", "find_host_package(OpenSSL")
     self.addFindHostPackage()
コード例 #4
0
        def add_components(components):
            for component in components:
                conan_component = component["target"]
                cmake_target = component["target"]
                lib_name = get_lib_name(component["lib"])
                requires = component["requires"]
                self.cpp_info.components[conan_component].names["cmake_find_package"] = cmake_target
                self.cpp_info.components[conan_component].names["cmake_find_package_multi"] = cmake_target
                self.cpp_info.components[conan_component].builddirs.append(self._module_subfolder)
                module_rel_path = os.path.join(self._module_subfolder, self._module_file)
                self.cpp_info.components[conan_component].build_modules["cmake_find_package"] = [module_rel_path]
                self.cpp_info.components[conan_component].build_modules["cmake_find_package_multi"] = [module_rel_path]
                self.cpp_info.components[conan_component].libs = [lib_name]
                if self.settings.os != "Windows":
                    self.cpp_info.components[conan_component].includedirs.append(os.path.join("include", "opencv4"))
                self.cpp_info.components[conan_component].requires = requires
                if self.settings.os == "Linux":
                    self.cpp_info.components[conan_component].system_libs = ["dl", "m", "pthread", "rt"]

                if self.settings.os == "Android":
                    self.cpp_info.components[conan_component].includedirs = [
                        os.path.join("sdk", "native", "jni", "include")]
                    self.cpp_info.components[conan_component].system_libs.append("log")
                    if int(str(self.settings.os.api_level)) > 20:
                        self.cpp_info.components[conan_component].system_libs.append("mediandk")
                    if not self.options.shared:
                        self.cpp_info.components[conan_component].libdirs.append(
                            os.path.join("sdk", "native", "staticlibs", tools.to_android_abi(str(self.settings.arch))))
                        if conan_component == "opencv_core":
                            self.cpp_info.components[conan_component].libdirs.append("lib")
                            self.cpp_info.components[conan_component].libs += tools.collect_libs(self)

                if self.settings.os in ["iOS", "Macos", "Linux"]:
                    if not self.options.shared:
                        if conan_component == "opencv_core":
                            libs = list(filter(lambda x: not x.startswith("opencv"), tools.collect_libs(self)))
                            self.cpp_info.components[conan_component].libs += libs

                # CMake components names
                cmake_component = component["lib"]
                if cmake_component != cmake_target:
                    conan_component_alias = conan_component + "_alias"
                    self.cpp_info.components[conan_component_alias].names["cmake_find_package"] = cmake_component
                    self.cpp_info.components[conan_component_alias].names["cmake_find_package_multi"] = cmake_component
                    self.cpp_info.components[conan_component_alias].requires = [conan_component]
                    self.cpp_info.components[conan_component_alias].includedirs = []
                    self.cpp_info.components[conan_component_alias].libdirs = []
                    self.cpp_info.components[conan_component_alias].resdirs = []
                    self.cpp_info.components[conan_component_alias].bindirs = []
                    self.cpp_info.components[conan_component_alias].frameworkdirs = []
コード例 #5
0
        def add_components(components):
            # TODO: OpenCV doesn't use cmake target namespace
            for component in components:
                conan_component = component["target"]
                cmake_target = component["target"]
                lib_name = get_lib_name(component["lib"])
                requires = component["requires"]
                self.cpp_info.components[conan_component].names["cmake_find_package"] = cmake_target
                self.cpp_info.components[conan_component].names["cmake_find_package_multi"] = cmake_target
                self.cpp_info.components[conan_component].libs = [lib_name]
                self.cpp_info.components[conan_component].includedirs.append(os.path.join("include", "opencv4"))
                self.cpp_info.components[conan_component].requires = requires
                if self.settings.os == "Linux":
                    self.cpp_info.components[conan_component].system_libs = ["dl", "m", "pthread", "rt"]

                if self.settings.os == "Android":
                    self.cpp_info.components[conan_component].includedirs = [
                        os.path.join("sdk", "native", "jni", "include")]
                    self.cpp_info.components[conan_component].system_libs.append("log")
                    if int(str(self.settings.os.api_level)) > 20:
                        self.cpp_info.components[conan_component].system_libs.append("mediandk")
                    if not self.options.shared:
                        self.cpp_info.components[conan_component].libdirs.append(
                            os.path.join("sdk", "native", "staticlibs", tools.to_android_abi(str(self.settings.arch))))
                        if conan_component == "opencv_core":
                            self.cpp_info.components[conan_component].libdirs.append("lib")
                            self.cpp_info.components[conan_component].libs += tools.collect_libs(self)
 
                # CMake components names
                conan_component_alias = conan_component + "_alias"
                cmake_component = component["lib"]
                self.cpp_info.components[conan_component_alias].names["cmake_find_package"] = cmake_component
                self.cpp_info.components[conan_component_alias].names["cmake_find_package_multi"] = cmake_component
                self.cpp_info.components[conan_component_alias].requires = [conan_component]
                self.cpp_info.components[conan_component_alias].includedirs.append(os.path.join("include", "opencv4"))
                self.cpp_info.components[conan_component_alias].libdirs = []
                self.cpp_info.components[conan_component_alias].resdirs = []
                self.cpp_info.components[conan_component_alias].bindirs = []
                self.cpp_info.components[conan_component_alias].frameworkdirs = []
コード例 #6
0
    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"] = False
        self._cmake.definitions["WITH_IMGCODEC_PFM"] = False
        self._cmake.definitions["WITH_IMGCODEC_PXM"] = False
        self._cmake.definitions["WITH_IMGCODEC_SUNRASTER"] = False
        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
        self._cmake.definitions["WITH_TIFF"] = self.options.with_tiff
        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.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
        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.settings):
            # 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

        self._cmake.configure(build_folder=self._build_subfolder)
        return self._cmake
コード例 #7
0
 def _build_autotools_android(self, configure_args):
     host_arch = "%s-linux-%s" % (tools.to_android_abi(
         self.settings.arch), self._android_id_str)
     configure_args.append("--host=%s" % host_arch)
     self._build_autotools_impl(configure_args)
コード例 #8
0
 def _android_arch(self):
     arch = str(self.settings.arch)
     return tools.to_android_abi(arch)
コード例 #9
0
    def build(self):
        cmake = CMake(self)
        library_folder = "%s/curl-%s" % (self.source_folder, self.version)
        cmake.verbose = True
        variants = []

        if self.settings.os == "Android":
            android_toolchain = os.environ[
                "ANDROID_NDK_PATH"] + "/build/cmake/android.toolchain.cmake"
            cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = android_toolchain
            cmake.definitions["ANDROID_NDK"] = os.environ["ANDROID_NDK_PATH"]
            cmake.definitions["ANDROID_ABI"] = tools.to_android_abi(
                self.settings.arch)
            cmake.definitions["ANDROID_STL"] = self.options.android_stl_type
            cmake.definitions[
                "ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level
            cmake.definitions["ANDROID_TOOLCHAIN"] = "clang"
            cmake.definitions["BUILD_TESTING"] = "OFF"
            cmake.definitions["BUILD_CURL_EXE"] = "OFF"
            tools.replace_in_file(
                "%s/curl-%s/CMakeLists.txt" %
                (self.source_folder, self.version), "find_package(OpenSSL",
                "find_host_package(OpenSSL")
            self.addFindHostPackage()

        if self.settings.os == "iOS":
            ios_toolchain = "cmake-modules/Toolchains/ios.toolchain.cmake"
            cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = ios_toolchain
            cmake.definitions["BUILD_TESTING"] = "OFF"
            cmake.definitions["BUILD_CURL_EXE"] = "OFF"
            cmake.definitions["CMAKE_OSX_ARCHITECTURES"] = tools.to_apple_arch(
                self.settings.arch)
            tools.replace_in_file(
                "%s/curl-%s/CMakeLists.txt" %
                (self.source_folder, self.version), "find_package(OpenSSL",
                "find_host_package(OpenSSL")

            # define all architectures for ios fat library
            if "arm" in self.settings.arch:
                variants = ["armv7", "armv7s", "armv8"]

            # apply build config for all defined architectures
            if len(variants) > 0:
                archs = ""
                for i in range(0, len(variants)):
                    if i == 0:
                        archs = tools.to_apple_arch(variants[i])
                    else:
                        archs += ";" + tools.to_apple_arch(variants[i])
                cmake.definitions["CMAKE_OSX_ARCHITECTURES"] = archs

            if self.settings.arch == "x86":
                cmake.definitions["IOS_PLATFORM"] = "SIMULATOR"
            elif self.settings.arch == "x86_64":
                cmake.definitions["IOS_PLATFORM"] = "SIMULATOR64"
            else:
                cmake.definitions["IOS_PLATFORM"] = "OS"

        if self.settings.os == "Macos":
            cmake.definitions["CMAKE_OSX_ARCHITECTURES"] = tools.to_apple_arch(
                self.settings.arch)

        cmake.definitions["CURL_DISABLE_LDAP"] = not self.options.with_ldap
        cmake.definitions[
            "BUILD_SHARED_LIBS"] = "ON" if self.options.shared else "OFF"

        cmake.configure(source_folder=library_folder)
        cmake.build()
        cmake.install()
コード例 #10
0
    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_CUDA"] = False
        self._cmake.definitions["WITH_CUFFT"] = False
        self._cmake.definitions["WITH_CUBLAS"] = 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"] = False
        self._cmake.definitions["WITH_IMGCODEC_PFM"] = False
        self._cmake.definitions["WITH_IMGCODEC_PXM"] = False
        self._cmake.definitions["WITH_IMGCODEC_SUNRASTER"] = False
        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_OPENJPEG"] = 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_PROTOBUF"] = False
        self._cmake.definitions["WITH_PVAPI"] = False
        self._cmake.definitions["WITH_QT"] = False
        self._cmake.definitions["WITH_QUIRC"] = False
        self._cmake.definitions["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.options.get_safe(
            "with_gtk", False)
        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
        self._cmake.definitions["WITH_TIFF"] = self.options.with_tiff
        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.contrib:
            self._cmake.definitions[
                'OPENCV_EXTRA_MODULES_PATH'] = os.path.join(
                    self.build_folder, self._contrib_folder, 'modules')
        if self.options.with_openexr:
            self._cmake.definitions["OPENEXR_ROOT"] = self.deps_cpp_info[
                "openexr"].rootpath
        if self.options.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["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")

        self._cmake.configure(build_folder=self._build_subfolder)
        return self._cmake
コード例 #11
0
    def build(self):
        cmake = CMake(self)
        library_folder = "%s/djinni" % self.source_folder
        cmake.verbose = True

        if self.settings.os == "Android":
            android_toolchain = os.environ[
                "ANDROID_NDK_PATH"] + "/build/cmake/android.toolchain.cmake"
            cmake.definitions["CMAKE_SYSTEM_NAME"] = "Android"
            cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = android_toolchain
            cmake.definitions["ANDROID_NDK"] = os.environ["ANDROID_NDK_PATH"]
            cmake.definitions["ANDROID_ABI"] = tools.to_android_abi(
                self.settings.arch)
            cmake.definitions["ANDROID_STL"] = self.options.android_stl_type
            cmake.definitions[
                "ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level
            cmake.definitions["ANDROID_TOOLCHAIN"] = "clang"
            cmake.definitions["DJINNI_WITH_JNI"] = "ON"

        if self.settings.os == "iOS":
            cmake.definitions["CMAKE_SYSTEM_NAME"] = "iOS"
            cmake.definitions["DEPLOYMENT_TARGET"] = "10.0"
            cmake.definitions["CMAKE_OSX_DEPLOYMENT_TARGET"] = "10.0"
            cmake.definitions["CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH"] = "NO"
            cmake.definitions["CMAKE_IOS_INSTALL_COMBINED"] = "YES"

            cmake.definitions["DJINNI_WITH_OBJC"] = "ON"

            # define all architectures for ios fat library
            if "arm" in self.settings.arch:
                cmake.definitions[
                    "CMAKE_OSX_ARCHITECTURES"] = "armv7;armv7s;arm64;arm64e"
            else:
                cmake.definitions[
                    "CMAKE_OSX_ARCHITECTURES"] = tools.to_apple_arch(
                        self.settings.arch)

        if self.options.shared == False:
            cmake.definitions["DJINNI_STATIC_LIB"] = "ON"

        cmake.configure(source_folder=library_folder)
        cmake.build()

        # we have to create the include structure ourself, because there is no install in the djinni cmakelists
        include_folder = os.path.join(self.build_folder, "include")
        os.mkdir(include_folder)
        include_djinni_folder = os.path.join(include_folder, "djinni")
        os.mkdir(include_djinni_folder)

        # copy common support lib headers
        support_lib_folder = os.path.join(self.build_folder, "djinni",
                                          "support-lib")
        for f in os.listdir(support_lib_folder):
            if f.endswith(".hpp") and not os.path.islink(
                    os.path.join(support_lib_folder, f)):
                copy2(os.path.join(support_lib_folder, f),
                      os.path.join(include_djinni_folder, f))

        # copy objc specific header files
        if self.settings.os == "iOS":
            include_objc_folder = os.path.join(include_djinni_folder, "objc")
            os.mkdir(include_objc_folder)
            support_lib_objc_folder = os.path.join(support_lib_folder, "objc")
            for f in os.listdir(support_lib_objc_folder):
                if f.endswith(".h") and not os.path.islink(
                        os.path.join(support_lib_objc_folder, f)):
                    copy2(os.path.join(support_lib_objc_folder, f),
                          os.path.join(include_objc_folder, f))

        # copy jni specific header files
        if self.settings.os == "Android":
            include_jni_folder = os.path.join(include_djinni_folder, "jni")
            os.mkdir(include_jni_folder)
            support_lib_jni_folder = os.path.join(support_lib_folder, "jni")
            for f in os.listdir(support_lib_jni_folder):
                if f.endswith(".hpp") and not os.path.islink(
                        os.path.join(support_lib_jni_folder, f)):
                    copy2(os.path.join(support_lib_jni_folder, f),
                          os.path.join(include_jni_folder, f))
コード例 #12
0
 def configure(self):
     if self.settings.os == 'Android':
         self.settings.compiler = 'clang'
         self.settings.compiler.version = '7.0'
         self.settings.compiler.libcxx = 'c++_static'
         self.android_abi = tools.to_android_abi(self.settings.arch)