Ask Your Question

Revision history [back]

you can find below a sample edit of build_sdk.py to produce a tiny libopencv_java4.so

--   OpenCV modules:
--     To be built:                 core imgcodecs imgproc java

here is the edit:

def build_library(self, abi, do_install):
    cmd = [self.cmake_path, "-GNinja"]
    cmake_vars = dict(
        CMAKE_TOOLCHAIN_FILE=self.get_toolchain_file(),
        INSTALL_CREATE_DISTRIB="ON",
        WITH_OPENCL="OFF",
        WITH_IPP=("ON" if abi.haveIPP() else "OFF"),
        WITH_TBB="ON",
        BUILD_opencv_flann="OFF",
        BUILD_opencv_dnn="OFF",
        BUILD_opencv_features2d="OFF",
        BUILD_opencv_photo="OFF",
        BUILD_opencv_objdetect="OFF",
        BUILD_opencv_ml="OFF",
        BUILD_opencv_video="OFF",
        BUILD_opencv_videoio="OFF",
        BUILD_opencv_highgui="OFF",
        BUILD_opencv_gapi="OFF",
        BUILD_PROTOBUFF="OFF",
        WITH_ADE="OFF",
        WITH_PROTOBUF="OFF",
        WITH_CAROTENE="OFF",
        WITH_TIFF="OFF",
        WITH_OPENEXR="OFF",
        WITH_OPENJPEG="OFF",
        WITH_WEBP="OFF",
        WITH_JASPER="OFF",
        WITH_IMGCODEC_HDR="OFF",
        WITH_IMGCODEC_PFM="OFF",
        WITH_IMGCODEC_PXM="OFF",
        WITH_IMGCODEC_SUNRASTER="OFF",
        WITH_QUIRC="OFF",
        BUILD_EXAMPLES="OFF",
        BUILD_TESTS="OFF",
        BUILD_PERF_TESTS="OFF",
        BUILD_DOCS="OFF",
        BUILD_ANDROID_EXAMPLES=("OFF" if self.no_samples_build else "ON"),
        INSTALL_ANDROID_EXAMPLES=("OFF" if self.no_samples_build else "ON"),
    )