From 674cf7111a26594f8c0b84420c50c76fafd01d28 Mon Sep 17 00:00:00 2001 From: Ted Strzalkowski Date: Sun, 2 Aug 2020 11:22:06 -0700 Subject: [PATCH] Disable Java wrapper build by default. - Java wrapper build isn't necessary for all Python builds. - Java wrapper build can now be enabled with ``ENABLE_JAVA`` environment variable. --- .travis.yml | 37 +++++++++++++++++++++++++++++++++++++ README.md | 1 + setup.py | 3 +++ 3 files changed, 41 insertions(+) diff --git a/.travis.yml b/.travis.yml index 26b345b4..45f70617 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,6 +66,18 @@ jobs: - SDIST=1 - ENABLE_CONTRIB=0 - ENABLE_HEADLESS=0 + - ENABLE_JAVA=0 + python: "3.8" + language: python + dist: xenial + - os: linux + stage: s1 + script: skip + env: + - SDIST=1 + - ENABLE_CONTRIB=0 + - ENABLE_HEADLESS=0 + - ENABLE_JAVA=1 python: "3.8" language: python dist: xenial @@ -76,6 +88,18 @@ jobs: - SDIST=1 - ENABLE_CONTRIB=0 - ENABLE_HEADLESS=1 + - ENABLE_JAVA=0 + python: "3.8" + language: python + dist: xenial + - os: linux + stage: s1 + script: skip + env: + - SDIST=1 + - ENABLE_CONTRIB=1 + - ENABLE_HEADLESS=0 + - ENABLE_JAVA=0 python: "3.8" language: python dist: xenial @@ -86,6 +110,18 @@ jobs: - SDIST=1 - ENABLE_CONTRIB=1 - ENABLE_HEADLESS=0 + - ENABLE_JAVA=1 + python: "3.8" + language: python + dist: xenial + - os: linux + stage: s1 + script: skip + env: + - SDIST=1 + - ENABLE_CONTRIB=0 + - ENABLE_HEADLESS=1 + - ENABLE_JAVA=1 python: "3.8" language: python dist: xenial @@ -96,6 +132,7 @@ jobs: - SDIST=1 - ENABLE_CONTRIB=1 - ENABLE_HEADLESS=1 + - ENABLE_JAVA=1 python: "3.8" language: python dist: xenial diff --git a/README.md b/README.md index ddb0104c..13462507 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ The build can be customized with environment variables. In addition to any varia - ``CI_BUILD``. Set to ``1`` to emulate the CI environment build behaviour. Used only in CI builds to force certain build flags on in ``setup.py``. Do not use this unless you know what you are doing. - ``ENABLE_CONTRIB`` and ``ENABLE_HEADLESS``. Set to ``1`` to build the contrib and/or headless version +- ``ENABLE_JAVA``, Set to ``1`` to enable the Java client build. This is disabled by default. - ``CMAKE_ARGS``. Additional arguments for OpenCV's CMake invocation. You can use this to make a custom build. See the next section for more info about manual builds outside the CI environment. diff --git a/setup.py b/setup.py index 64162d68..9826b8d7 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ def main(): minimum_supported_numpy = "1.13.1" build_contrib = get_build_env_var_by_name("contrib") build_headless = get_build_env_var_by_name("headless") + build_java = get_build_env_var_by_name("java") if sys.version_info[:2] >= (3, 6): minimum_supported_numpy = "1.13.3" @@ -121,6 +122,8 @@ def main(): "-DPYTHON3_LIBRARY=%s" % python_lib_path, "-DBUILD_opencv_python3=ON", "-DBUILD_opencv_python2=OFF", + # Disable the Java build by default as it is not needed + "-DBUILD_opencv_java=%s" % build_java, # When off, adds __init__.py and a few more helper .py's. We use our own helper files with a different structure. "-DOPENCV_SKIP_PYTHON_LOADER=ON", # Relative dir to install the built module to in the build tree.