diff --git a/doc/js_tutorials/js_setup/js_intro/js_intro.markdown b/doc/js_tutorials/js_setup/js_intro/js_intro.markdown index 416aa3ded5..01a123c5f4 100644 --- a/doc/js_tutorials/js_setup/js_intro/js_intro.markdown +++ b/doc/js_tutorials/js_setup/js_intro/js_intro.markdown @@ -13,7 +13,7 @@ OpenCV.js: OpenCV for the JavaScript programmer Web is the most ubiquitous open computing platform. With HTML5 standards implemented in every browser, web applications are able to render online video with HTML5 video tags, capture webcam video via WebRTC API, and access each pixel of a video frame via canvas API. With abundance of available multimedia content, web developers are in need of a wide array of image and vision processing algorithms in JavaScript to build innovative applications. This requirement is even more essential for emerging applications on the web, such as Web Virtual Reality (WebVR) and Augmented Reality (WebAR). All of these use cases demand efficient implementations of computation-intensive vision kernels on web. -[Emscripten](http://kripken.github.io/emscripten-site) is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated from C/C++ using clang, and compiles that into asm.js or WebAssembly that can execute directly inside the web browsers. . Asm.js is a highly optimizable, low-level subset of JavaScript. Asm.js enables ahead-of-time compilation and optimization in JavaScript engine that provide near-to-native execution speed. WebAssembly is a new portable, size- and load-time-efficient binary format suitable for compilation to the web. WebAssembly aims to execute at native speed. WebAssembly is currently being designed as an open standard by W3C. +[Emscripten](https://emscripten.org/) is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated from C/C++ using clang, and compiles that into asm.js or WebAssembly that can execute directly inside the web browsers. . Asm.js is a highly optimizable, low-level subset of JavaScript. Asm.js enables ahead-of-time compilation and optimization in JavaScript engine that provide near-to-native execution speed. WebAssembly is a new portable, size- and load-time-efficient binary format suitable for compilation to the web. WebAssembly aims to execute at native speed. WebAssembly is currently being designed as an open standard by W3C. OpenCV.js is a JavaScript binding for selected subset of OpenCV functions for the web platform. It allows emerging web applications with multimedia processing to benefit from the wide variety of vision functions available in OpenCV. OpenCV.js leverages Emscripten to compile OpenCV functions into asm.js or WebAssembly targets, and provides a JavaScript APIs for web application to access them. The future versions of the library will take advantage of acceleration APIs that are available on the Web such as SIMD and multi-threaded execution. @@ -42,4 +42,4 @@ Below is the list of contributors of OpenCV.js bindings and tutorials. - Gang Song (GSoC student, Shanghai Jiao Tong University) - Wenyao Gan (Student intern, Shanghai Jiao Tong University) - Mohammad Reza Haghighat (Project initiator & sponsor, Intel Corporation) -- Ningxin Hu (Students' supervisor, Intel Corporation) \ No newline at end of file +- Ningxin Hu (Students' supervisor, Intel Corporation) diff --git a/doc/js_tutorials/js_setup/js_setup/js_setup.markdown b/doc/js_tutorials/js_setup/js_setup/js_setup.markdown index 55fd40fb7e..7dfe1b05e4 100644 --- a/doc/js_tutorials/js_setup/js_setup/js_setup.markdown +++ b/doc/js_tutorials/js_setup/js_setup/js_setup.markdown @@ -7,12 +7,12 @@ You don't have to build your own copy if you simply want to start using it. Refe Installing Emscripten ----------------------------- -[Emscripten](https://github.com/kripken/emscripten) is an LLVM-to-JavaScript compiler. We will use Emscripten to build OpenCV.js. +[Emscripten](https://github.com/emscripten-core/emscripten) is an LLVM-to-JavaScript compiler. We will use Emscripten to build OpenCV.js. @note While this describes installation of required tools from scratch, there's a section below also describing an alternative procedure to perform the same build using docker containers which is often easier. -To Install Emscripten, follow instructions of [Emscripten SDK](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html). +To Install Emscripten, follow instructions of [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html). For example: @code{.bash} @@ -21,24 +21,29 @@ For example: ./emsdk activate latest @endcode -@note -To compile to [WebAssembly](http://webassembly.org), you need to install and activate [Binaryen](https://github.com/WebAssembly/binaryen) with the `emsdk` command. Please refer to [Developer's Guide](http://webassembly.org/getting-started/developers-guide/) for more details. -After install, ensure the `EMSCRIPTEN` environment is setup correctly. +After install, ensure the `EMSDK` environment is setup correctly. For example: @code{.bash} source ./emsdk_env.sh -echo ${EMSCRIPTEN} +echo ${EMSDK} @endcode -The version 1.39.16 of emscripten is verified for latest WebAssembly. Please check the version of emscripten to use the newest features of WebAssembly. +Modern versions of Emscripten requires to use `emcmake` / `emmake` launchers: + +@code{.bash} +emcmake sh -c 'echo ${EMSCRIPTEN}' +@endcode + + +The version 2.0.10 of emscripten is verified for latest WebAssembly. Please check the version of Emscripten to use the newest features of WebAssembly. For example: @code{.bash} ./emsdk update -./emsdk install 1.39.16 -./emsdk activate 1.39.16 +./emsdk install 2.0.10 +./emsdk activate 2.0.10 @endcode Obtaining OpenCV Source Code @@ -71,8 +76,7 @@ Building OpenCV.js from Source For example, to build in `build_js` directory: @code{.bash} - cd opencv - python ./platforms/js/build_js.py build_js + emcmake python ./opencv/platforms/js/build_js.py build_js @endcode @note @@ -82,14 +86,14 @@ Building OpenCV.js from Source For example, to build wasm version in `build_wasm` directory: @code{.bash} - python ./platforms/js/build_js.py build_wasm --build_wasm + emcmake python ./opencv/platforms/js/build_js.py build_wasm --build_wasm @endcode -# [Optional] To build the OpenCV.js loader, append `--build_loader`. For example: @code{.bash} - python ./platforms/js/build_js.py build_js --build_loader + emcmake python ./opencv/platforms/js/build_js.py build_js --build_loader @endcode @note @@ -114,7 +118,7 @@ Building OpenCV.js from Source For example: @code{.bash} - python ./platforms/js/build_js.py build_js --build_doc + emcmake python ./opencv/platforms/js/build_js.py build_js --build_doc @endcode @note @@ -124,7 +128,14 @@ Building OpenCV.js from Source For example: @code{.bash} - python ./platforms/js/build_js.py build_js --build_test + emcmake python ./opencv/platforms/js/build_js.py build_js --build_test + @endcode + +-# [optional] To enable OpenCV contrib modules append `--cmake_option="-DOPENCV_EXTRA_MODULES_PATH=/path/to/opencv_contrib/modules/"` + + For example: + @code{.bash} + python ./platforms/js/build_js.py build_js --cmake_option="-DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules" @endcode -# [optional] To enable OpenCV contrib modules append `--cmake_option="-DOPENCV_EXTRA_MODULES_PATH=/path/to/opencv_contrib/modules/"` @@ -193,7 +204,7 @@ node tests.js For example: @code{.bash} - python ./platforms/js/build_js.py build_js --build_wasm --threads + emcmake python ./opencv/platforms/js/build_js.py build_js --build_wasm --threads @endcode The default threads number is the logic core number of your device. You can use `cv.parallel_pthreads_set_threads_num(number)` to set threads number by yourself and use `cv.parallel_pthreads_get_threads_num()` to get the current threads number. @@ -205,7 +216,7 @@ node tests.js For example: @code{.bash} - python ./platforms/js/build_js.py build_js --build_wasm --simd + emcmake python ./opencv/platforms/js/build_js.py build_js --build_wasm --simd @endcode The simd optimization is experimental as wasm simd is still in development. @@ -229,7 +240,7 @@ node tests.js For example: @code{.bash} - python ./platforms/js/build_js.py build_js --build_wasm --simd --build_wasm_intrin_test + emcmake python ./opencv/platforms/js/build_js.py build_js --build_wasm --simd --build_wasm_intrin_test @endcode For wasm intrinsics tests, you can use the following function to test all the cases: @@ -257,7 +268,7 @@ node tests.js For example: @code{.bash} - python ./platforms/js/build_js.py build_js --build_perf + emcmake python ./opencv/platforms/js/build_js.py build_js --build_perf @endcode To run performance tests, launch a local web server in \/bin folder. For example, node http-server which serves on `localhost:8080`. @@ -278,25 +289,25 @@ Building OpenCV.js with Docker Alternatively, the same build can be can be accomplished using [docker](https://www.docker.com/) containers which is often easier and more reliable, particularly in non linux systems. You only need to install [docker](https://www.docker.com/) on your system and use a popular container that provides a clean well tested environment for emscripten builds like this, that already has latest versions of all the necessary tools installed. -So, make sure [docker](https://www.docker.com/) is installed in your system and running. The following shell script should work in linux and MacOS: +So, make sure [docker](https://www.docker.com/) is installed in your system and running. The following shell script should work in Linux and MacOS: @code{.bash} git clone https://github.com/opencv/opencv.git cd opencv -docker run --rm --workdir /code -v "$PWD":/code "trzeci/emscripten:latest" python ./platforms/js/build_js.py build +docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk emcmake python3 ./dev/platforms/js/build_js.py build_js @endcode In Windows use the following PowerShell command: @code{.bash} -docker run --rm --workdir /code -v "$(get-location):/code" "trzeci/emscripten:latest" python ./platforms/js/build_js.py build +docker run --rm --workdir /src -v "$(get-location):/src" "emscripten/emsdk" emcmake python3 ./dev/platforms/js/build_js.py build_js @endcode @warning -The example uses latest version of emscripten. If the build fails you should try a version that is known to work fine which is `1.38.32` using the following command: +The example uses latest version of emscripten. If the build fails you should try a version that is known to work fine which is `2.0.10` using the following command: @code{.bash} -docker run --rm --workdir /code -v "$PWD":/code "trzeci/emscripten:sdk-tag-1.38.32-64bit" python ./platforms/js/build_js.py build +docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk:2.0.10 emcmake python3 ./dev/platforms/js/build_js.py build_js @endcode ### Building the documentation with Docker @@ -304,10 +315,11 @@ docker run --rm --workdir /code -v "$PWD":/code "trzeci/emscripten:sdk-tag-1.38. To build the documentation `doxygen` needs to be installed. Create a file named `Dockerfile` with the following content: ``` -FROM trzeci/emscripten:sdk-tag-1.38.32-64bit +FROM emscripten/emsdk:2.0.10 -RUN apt-get update -y -RUN apt-get install -y doxygen +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends doxygen \ + && rm -rf /var/lib/apt/lists/* ``` Then we build the docker image and name it `opencv-js-doc` with the following command (that needs to be run only once): @@ -319,5 +331,5 @@ docker build . -t opencv-js-doc Now run the build command again, this time using the new image and passing `--build_doc`: @code{.bash} -docker run --rm --workdir /code -v "$PWD":/code "opencv-js-doc" python ./platforms/js/build_js.py build --build_doc +docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) "opencv-js-doc" emcmake python3 ./dev/platforms/js/build_js.py build_js --build_doc @endcode diff --git a/doc/js_tutorials/js_setup/js_usage/js_usage.markdown b/doc/js_tutorials/js_setup/js_usage/js_usage.markdown index 80f7f7c21e..e2191e6d41 100644 --- a/doc/js_tutorials/js_setup/js_usage/js_usage.markdown +++ b/doc/js_tutorials/js_setup/js_usage/js_usage.markdown @@ -129,7 +129,7 @@ function onOpenCvReady() { @endcode -@note You have to call delete method of cv.Mat to free memory allocated in Emscripten's heap. Please refer to [Memory management of Emscripten](https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management) for details. +@note You have to call delete method of cv.Mat to free memory allocated in Emscripten's heap. Please refer to [Memory management of Emscripten](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management) for details. Try it ------ @@ -137,4 +137,4 @@ Try it -\endhtmlonly \ No newline at end of file +\endhtmlonly diff --git a/doc/tutorials/introduction/windows_install/windows_install.markdown b/doc/tutorials/introduction/windows_install/windows_install.markdown index 0eff40dd13..877ca86992 100644 --- a/doc/tutorials/introduction/windows_install/windows_install.markdown +++ b/doc/tutorials/introduction/windows_install/windows_install.markdown @@ -55,12 +55,12 @@ cd /c/lib @code{.bash} #!/bin/bash -e myRepo=$(pwd) -CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64" +CMAKE_GENERATOR_OPTIONS=-G"Visual Studio 16 2019" +#CMAKE_GENERATOR_OPTIONS=-G"Visual Studio 15 2017 Win64" +#CMAKE_GENERATOR_OPTIONS=(-G"Visual Studio 16 2019" -A x64) # CMake 3.14+ is required if [ ! -d "$myRepo/opencv" ]; then echo "cloning opencv" git clone https://github.com/opencv/opencv.git - mkdir -p Build/opencv - mkdir -p Install/opencv else cd opencv git pull --rebase @@ -69,16 +69,17 @@ fi if [ ! -d "$myRepo/opencv_contrib" ]; then echo "cloning opencv_contrib" git clone https://github.com/opencv/opencv_contrib.git - mkdir -p Build/opencv_contrib else cd opencv_contrib git pull --rebase cd .. fi RepoSource=opencv -pushd Build/$RepoSource -CMAKE_OPTIONS='-DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF -DINSTALL_CREATE_DISTRIB=ON' -cmake -G"$CMAKE_CONFIG_GENERATOR" $CMAKE_OPTIONS -DOPENCV_EXTRA_MODULES_PATH="$myRepo"/opencv_contrib/modules -DCMAKE_INSTALL_PREFIX="$myRepo"/install/"$RepoSource" "$myRepo/$RepoSource" +mkdir -p build_opencv +pushd build_opencv +CMAKE_OPTIONS=(-DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF -DINSTALL_CREATE_DISTRIB=ON) +set -x +cmake "${CMAKE_GENERATOR_OPTIONS[@]}" "${CMAKE_OPTIONS[@]}" -DOPENCV_EXTRA_MODULES_PATH="$myRepo"/opencv_contrib/modules -DCMAKE_INSTALL_PREFIX="$myRepo/install/$RepoSource" "$myRepo/$RepoSource" echo "************************* $Source_DIR -->debug" cmake --build . --config debug echo "************************* $Source_DIR -->release" @@ -89,15 +90,15 @@ popd @endcode In this script I suppose you use VS 2015 in 64 bits @code{.bash} -CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64" +CMAKE_GENERATOR_OPTIONS=-G"Visual Studio 14 2015 Win64" @endcode - and opencv will be installed in c:/lib/install + and opencv will be installed in c:/lib/install/opencv @code{.bash} --DCMAKE_INSTALL_PREFIX="$myRepo"/install/"$RepoSource" "$myRepo/$RepoSource" +-DCMAKE_INSTALL_PREFIX="$myRepo/install/$RepoSource" @endcode with no Perf tests, no tests, no doc, no CUDA and no example @code{.bash} -CMAKE_OPTIONS='-DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF' +CMAKE_OPTIONS=(-DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF) @endcode -# In git command line enter following command : @code{.bash} diff --git a/modules/core/include/opencv2/core/bindings_utils.hpp b/modules/core/include/opencv2/core/bindings_utils.hpp index f693dc8c65..92f27f0e87 100644 --- a/modules/core/include/opencv2/core/bindings_utils.hpp +++ b/modules/core/include/opencv2/core/bindings_utils.hpp @@ -58,6 +58,12 @@ String dumpCString(const char* argument) return cv::format("String: %s", argument); } +CV_WRAP static inline +String dumpString(const String& argument) +{ + return cv::format("String: %s", argument.c_str()); +} + CV_WRAP static inline AsyncArray testAsyncArray(InputArray argument) { diff --git a/modules/imgproc/src/color.hpp b/modules/imgproc/src/color.hpp index e4a5052892..3f3b634790 100644 --- a/modules/imgproc/src/color.hpp +++ b/modules/imgproc/src/color.hpp @@ -104,6 +104,7 @@ inline int dstChannels(int code) return 4; case COLOR_BGRA2BGR: case COLOR_RGBA2BGR: case COLOR_RGB2BGR: + case COLOR_YUV2RGB: case COLOR_YUV2BGR: case COLOR_RGB2YUV: case COLOR_BGR2YUV: case COLOR_BGR5652BGR: case COLOR_BGR5552BGR: case COLOR_BGR5652RGB: case COLOR_BGR5552RGB: case COLOR_GRAY2BGR: case COLOR_YUV2BGR_NV21: case COLOR_YUV2RGB_NV21: case COLOR_YUV2BGR_NV12: case COLOR_YUV2RGB_NV12: diff --git a/modules/js/generator/embindgen.py b/modules/js/generator/embindgen.py index 7eddb11ba2..c803ca475b 100644 --- a/modules/js/generator/embindgen.py +++ b/modules/js/generator/embindgen.py @@ -778,15 +778,13 @@ class JSWrapperGenerator(object): self.bindings+=binding # generate code for the classes and their methods - class_list = list(self.classes.items()) - - for name, class_info in class_list: + for name, class_info in sorted(self.classes.items()): class_bindings = [] if not name in white_list: continue # Generate bindings for methods - for method_name, method in class_info.methods.items(): + for method_name, method in sorted(class_info.methods.items()): if method.cname in ignore_list: continue if not method.name in white_list[method.class_name]: @@ -824,7 +822,7 @@ class JSWrapperGenerator(object): # Generate bindings for properties - for property in class_info.props: + for property in sorted(class_info.props): _class_property = class_property_enum_template if property.tp in type_dict else class_property_template class_bindings.append(_class_property.substitute(js_name=property.name, cpp_name='::'.join( [class_info.cname, property.name]))) diff --git a/modules/photo/test/test_hdr.cpp b/modules/photo/test/test_hdr.cpp index 2ac09dbecb..198b83470c 100644 --- a/modules/photo/test/test_hdr.cpp +++ b/modules/photo/test/test_hdr.cpp @@ -227,7 +227,11 @@ TEST(Photo_CalibrateDebevec, regression) diff = diff.mul(1.0f / response); double max; minMaxLoc(diff, NULL, &max); - ASSERT_FALSE(max > 0.1); +#if defined(__arm__) || defined(__aarch64__) + ASSERT_LT(max, 0.131); +#else + ASSERT_LT(max, 0.1); +#endif } TEST(Photo_CalibrateRobertson, regression) diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index feea5e76f2..7894653dc0 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -993,15 +993,31 @@ PyObject* pyopencv_from(const std::string& value) template<> bool pyopencv_to(PyObject* obj, String &value, const ArgInfo& info) { - CV_UNUSED(info); if(!obj || obj == Py_None) + { return true; + } std::string str; if (getUnicodeString(obj, str)) { value = str; return true; } + else + { + // If error hasn't been already set by Python conversion functions + if (!PyErr_Occurred()) + { + // Direct access to underlying slots of PyObjectType is not allowed + // when limited API is enabled +#ifdef Py_LIMITED_API + failmsg("Can't convert object to 'str' for '%s'", info.name); +#else + failmsg("Can't convert object of type '%s' to 'str' for '%s'", + obj->ob_type->tp_name, info.name); +#endif + } + } return false; } diff --git a/modules/python/test/test_misc.py b/modules/python/test/test_misc.py index f9a350d160..9ab85be46c 100644 --- a/modules/python/test/test_misc.py +++ b/modules/python/test/test_misc.py @@ -314,7 +314,7 @@ class Arguments(NewOpenCVTests): def test_parse_to_cstring_convertible(self): try_to_convert = partial(self._try_to_convert, cv.utils.dumpCString) - for convertible in ('s', 'str', str(123), ('char'), np.str('test1'), np.str_('test2')): + for convertible in ('', 's', 'str', str(123), ('char'), np.str('test1'), np.str_('test2')): expected = 'string: ' + convertible actual = try_to_convert(convertible) self.assertEqual(expected, actual, @@ -326,6 +326,20 @@ class Arguments(NewOpenCVTests): with self.assertRaises((TypeError), msg=get_no_exception_msg(not_convertible)): _ = cv.utils.dumpCString(not_convertible) + def test_parse_to_string_convertible(self): + try_to_convert = partial(self._try_to_convert, cv.utils.dumpString) + for convertible in (None, '', 's', 'str', str(123), np.str('test1'), np.str_('test2')): + expected = 'string: ' + (convertible if convertible else '') + actual = try_to_convert(convertible) + self.assertEqual(expected, actual, + msg=get_conversion_error_msg(convertible, expected, actual)) + + def test_parse_to_string_not_convertible(self): + for not_convertible in ((12,), ('t', 'e', 's', 't'), np.array(['123', ]), + np.array(['t', 'e', 's', 't']), 1, True, False): + with self.assertRaises((TypeError), msg=get_no_exception_msg(not_convertible)): + _ = cv.utils.dumpString(not_convertible) + class SamplesFindFile(NewOpenCVTests): diff --git a/platforms/js/README.md b/platforms/js/README.md index 1db8a84a4b..17c17ee1f7 100644 --- a/platforms/js/README.md +++ b/platforms/js/README.md @@ -1,11 +1,11 @@ Building OpenCV.js by Emscripten ==================== -[Download and install Emscripten](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html). +[Download and install Emscripten](https://emscripten.org/docs/getting_started/downloads.html). Execute `build_js.py` script: ``` -python /platforms/js/build_js.py +emcmake python /platforms/js/build_js.py ``` If everything is fine, a few minutes later you will get `/bin/opencv.js`. You can add this into your web pages. diff --git a/platforms/js/build_js.py b/platforms/js/build_js.py index e02884fb74..8012552215 100644 --- a/platforms/js/build_js.py +++ b/platforms/js/build_js.py @@ -208,15 +208,19 @@ class Builder: #=================================================================================================== if __name__ == "__main__": + log.basicConfig(format='%(message)s', level=log.DEBUG) + opencv_dir = os.path.abspath(os.path.join(SCRIPT_DIR, '../..')) emscripten_dir = None if "EMSCRIPTEN" in os.environ: emscripten_dir = os.environ["EMSCRIPTEN"] + else: + log.warning("EMSCRIPTEN environment variable is not available. Please properly activate Emscripten SDK and consider using 'emcmake' launcher") parser = argparse.ArgumentParser(description='Build OpenCV.js by Emscripten') parser.add_argument("build_dir", help="Building directory (and output)") parser.add_argument('--opencv_dir', default=opencv_dir, help='Opencv source directory (default is "../.." relative to script location)') - parser.add_argument('--emscripten_dir', default=emscripten_dir, help="Path to Emscripten to use for build") + parser.add_argument('--emscripten_dir', default=emscripten_dir, help="Path to Emscripten to use for build (deprecated in favor of 'emcmake' launcher)") parser.add_argument('--build_wasm', action="store_true", help="Build OpenCV.js in WebAssembly format") parser.add_argument('--disable_wasm', action="store_true", help="Build OpenCV.js in Asm.js format") parser.add_argument('--threads', action="store_true", help="Build OpenCV.js with threads optimization") @@ -240,13 +244,15 @@ if __name__ == "__main__": args = parser.parse_args() - log.basicConfig(format='%(message)s', level=log.DEBUG) log.debug("Args: %s", args) os.environ["OPENCV_JS_WHITELIST"] = args.config + if 'EMMAKEN_JUST_CONFIGURE' in os.environ: + del os.environ['EMMAKEN_JUST_CONFIGURE'] # avoid linker errors with NODERAWFS message then using 'emcmake' launcher + if args.emscripten_dir is None: - log.info("Cannot get Emscripten path, please specify it either by EMSCRIPTEN environment variable or --emscripten_dir option.") + log.error("Cannot get Emscripten path, please use 'emcmake' launcher or specify it either by EMSCRIPTEN environment variable or --emscripten_dir option.") sys.exit(-1) builder = Builder(args) diff --git a/platforms/winpack_dldt/2021.2/20200413-dldt-pdb.patch b/platforms/winpack_dldt/2021.2/20200413-dldt-pdb.patch new file mode 100644 index 0000000000..081c3c04f6 --- /dev/null +++ b/platforms/winpack_dldt/2021.2/20200413-dldt-pdb.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1f981ed2..90eb500a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,6 +22,9 @@ endif() + + project(OpenVINO) + ++set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /FS") ++set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") ++ + set(OpenVINO_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + set(IE_MAIN_SOURCE_DIR ${OpenVINO_MAIN_SOURCE_DIR}/inference-engine) + list(APPEND CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake") diff --git a/platforms/winpack_dldt/2021.2/20200604-dldt-disable-multidevice.patch b/platforms/winpack_dldt/2021.2/20200604-dldt-disable-multidevice.patch new file mode 100644 index 0000000000..b4d1ef9bfe --- /dev/null +++ b/platforms/winpack_dldt/2021.2/20200604-dldt-disable-multidevice.patch @@ -0,0 +1,13 @@ +diff --git a/inference-engine/src/CMakeLists.txt b/inference-engine/src/CMakeLists.txt +index 0ba0dd78..7d34e7cb 100644 +--- a/inference-engine/src/CMakeLists.txt ++++ b/inference-engine/src/CMakeLists.txt +@@ -26,7 +26,7 @@ endif() + + add_subdirectory(hetero_plugin) + +-add_subdirectory(multi_device) ++#add_subdirectory(multi_device) + + add_subdirectory(transformations) + diff --git a/platforms/winpack_dldt/2021.2/20201217-dldt-disable-unused-targets.patch b/platforms/winpack_dldt/2021.2/20201217-dldt-disable-unused-targets.patch new file mode 100644 index 0000000000..7e0c57eb63 --- /dev/null +++ b/platforms/winpack_dldt/2021.2/20201217-dldt-disable-unused-targets.patch @@ -0,0 +1,250 @@ +diff --git a/inference-engine/CMakeLists.txt b/inference-engine/CMakeLists.txt +index a3e4f74c..190305a6 100644 +--- a/inference-engine/CMakeLists.txt ++++ b/inference-engine/CMakeLists.txt +@@ -69,7 +69,7 @@ if(ENABLE_TESTS) + add_subdirectory(tests) + endif() + +-add_subdirectory(tools) ++#add_subdirectory(tools) + + function(ie_build_samples) + # samples should be build with the same flags as from OpenVINO package, +@@ -88,7 +88,7 @@ endfunction() + + # gflags and format_reader targets are kept inside of samples directory and + # they must be built even if samples build is disabled (required for tests and tools). +-ie_build_samples() ++#ie_build_samples() + + file(GLOB_RECURSE SAMPLES_SOURCES samples/*.cpp samples/*.hpp samples/*.h) + add_cpplint_target(sample_cpplint +@@ -179,7 +179,7 @@ endif() + # Developer package + # + +-ie_developer_export_targets(format_reader) ++#ie_developer_export_targets(format_reader) + ie_developer_export_targets(${NGRAPH_LIBRARIES}) + + # for Template plugin +@@ -187,7 +187,7 @@ if(NGRAPH_INTERPRETER_ENABLE) + ie_developer_export_targets(ngraph_backend interpreter_backend) + endif() + +-ie_developer_export() ++#ie_developer_export() + + configure_file( + "${IE_MAIN_SOURCE_DIR}/cmake/developer_package_config.cmake.in" +diff --git a/inference-engine/cmake/add_ie_target.cmake b/inference-engine/cmake/add_ie_target.cmake +index 35b96542..48dacfb3 100644 +--- a/inference-engine/cmake/add_ie_target.cmake ++++ b/inference-engine/cmake/add_ie_target.cmake +@@ -91,7 +91,7 @@ function(addIeTarget) + if (ARG_TYPE STREQUAL EXECUTABLE) + add_executable(${ARG_NAME} ${all_sources}) + elseif(ARG_TYPE STREQUAL STATIC OR ARG_TYPE STREQUAL SHARED) +- add_library(${ARG_NAME} ${ARG_TYPE} ${all_sources}) ++ add_library(${ARG_NAME} ${ARG_TYPE} EXCLUDE_FROM_ALL ${all_sources}) + else() + message(SEND_ERROR "Invalid target type ${ARG_TYPE} specified for target name ${ARG_NAME}") + endif() +diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt +index f012a038..5204fb6a 100644 +--- a/inference-engine/src/inference_engine/CMakeLists.txt ++++ b/inference-engine/src/inference_engine/CMakeLists.txt +@@ -99,7 +99,7 @@ add_cpplint_target(${TARGET_NAME}_plugin_api_cpplint FOR_SOURCES ${plugin_api_sr + + # Create object library + +-add_library(${TARGET_NAME}_obj OBJECT ++add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL + ${LIBRARY_SRC} + ${LIBRARY_HEADERS} + ${PUBLIC_HEADERS}) +@@ -162,7 +162,7 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) + + # Static library used for unit tests which are always built + +-add_library(${TARGET_NAME}_s STATIC ++add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL + $ + $ + ${IE_STATIC_DEPENDENT_FILES}) +diff --git a/inference-engine/src/legacy_api/CMakeLists.txt b/inference-engine/src/legacy_api/CMakeLists.txt +index fab2f68d..864953a1 100644 +--- a/inference-engine/src/legacy_api/CMakeLists.txt ++++ b/inference-engine/src/legacy_api/CMakeLists.txt +@@ -22,7 +22,7 @@ endif() + + # Create object library + +-add_library(${TARGET_NAME}_obj OBJECT ++add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL + ${LIBRARY_SRC} + ${PUBLIC_HEADERS}) + +diff --git a/inference-engine/src/mkldnn_plugin/CMakeLists.txt b/inference-engine/src/mkldnn_plugin/CMakeLists.txt +index f52926d6..dd039e29 100644 +--- a/inference-engine/src/mkldnn_plugin/CMakeLists.txt ++++ b/inference-engine/src/mkldnn_plugin/CMakeLists.txt +@@ -194,7 +194,7 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) + + # add test object library + +-add_library(${TARGET_NAME}_obj OBJECT ${SOURCES} ${HEADERS}) ++add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL ${SOURCES} ${HEADERS}) + + target_include_directories(${TARGET_NAME}_obj PRIVATE $ + $ +diff --git a/inference-engine/src/preprocessing/CMakeLists.txt b/inference-engine/src/preprocessing/CMakeLists.txt +index d47dfb35..a9046654 100644 +--- a/inference-engine/src/preprocessing/CMakeLists.txt ++++ b/inference-engine/src/preprocessing/CMakeLists.txt +@@ -101,7 +101,7 @@ endif() + + # Create object library + +-add_library(${TARGET_NAME}_obj OBJECT ++add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL + ${LIBRARY_SRC} + ${LIBRARY_HEADERS}) + +@@ -153,7 +153,7 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) + + # Static library used for unit tests which are always built + +-add_library(${TARGET_NAME}_s STATIC ++add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL + $) + + set_ie_threading_interface_for(${TARGET_NAME}_s) +diff --git a/inference-engine/src/vpu/common/CMakeLists.txt b/inference-engine/src/vpu/common/CMakeLists.txt +index bd97c2c6..d89cdaa5 100644 +--- a/inference-engine/src/vpu/common/CMakeLists.txt ++++ b/inference-engine/src/vpu/common/CMakeLists.txt +@@ -5,7 +5,7 @@ + file(GLOB_RECURSE SOURCES *.cpp *.hpp *.h) + + function(add_common_target TARGET_NAME STATIC_IE) +- add_library(${TARGET_NAME} STATIC ${SOURCES}) ++ add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES}) + + ie_faster_build(${TARGET_NAME} + UNITY +@@ -62,7 +62,7 @@ add_common_target("vpu_common_lib" FALSE) + + # Unit tests support for graph transformer + if(WIN32) +- add_common_target("vpu_common_lib_test_static" TRUE) ++ #add_common_target("vpu_common_lib_test_static" TRUE) + else() + add_library("vpu_common_lib_test_static" ALIAS "vpu_common_lib") + endif() +diff --git a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt +index 797ef975..0cc5a65a 100644 +--- a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt ++++ b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt +@@ -5,7 +5,7 @@ + file(GLOB_RECURSE SOURCES *.cpp *.hpp *.h *.inc) + + function(add_graph_transformer_target TARGET_NAME STATIC_IE) +- add_library(${TARGET_NAME} STATIC ${SOURCES}) ++ add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES}) + + set_ie_threading_interface_for(${TARGET_NAME}) + +@@ -63,7 +63,7 @@ add_graph_transformer_target("vpu_graph_transformer" FALSE) + + # Unit tests support for graph transformer + if(WIN32) +- add_graph_transformer_target("vpu_graph_transformer_test_static" TRUE) ++ #add_graph_transformer_target("vpu_graph_transformer_test_static" TRUE) + else() + add_library("vpu_graph_transformer_test_static" ALIAS "vpu_graph_transformer") + endif() +diff --git a/inference-engine/thirdparty/CMakeLists.txt b/inference-engine/thirdparty/CMakeLists.txt +index fa2a4d02..c2ca41cd 100644 +--- a/inference-engine/thirdparty/CMakeLists.txt ++++ b/inference-engine/thirdparty/CMakeLists.txt +@@ -61,11 +61,11 @@ else() + target_include_directories(pugixml INTERFACE "$") + endif() + +-add_subdirectory(stb_lib) ++#add_subdirectory(stb_lib) + add_subdirectory(ade) + add_subdirectory(fluid/modules/gapi) + +-set_target_properties(ade fluid stb_image PROPERTIES FOLDER thirdparty) ++set_target_properties(ade fluid PROPERTIES FOLDER thirdparty) + + # developer package + +diff --git a/inference-engine/thirdparty/mkldnn.cmake b/inference-engine/thirdparty/mkldnn.cmake +index 0c2e936e..f36e7beb 100644 +--- a/inference-engine/thirdparty/mkldnn.cmake ++++ b/inference-engine/thirdparty/mkldnn.cmake +@@ -117,7 +117,7 @@ if(WIN32) + endif() + endif() + +-add_library(${TARGET} STATIC ${HDR} ${SRC}) ++add_library(${TARGET} STATIC EXCLUDE_FROM_ALL ${HDR} ${SRC}) + set_ie_threading_interface_for(${TARGET}) + + if(GEMM STREQUAL "OPENBLAS") +diff --git a/inference-engine/thirdparty/pugixml/CMakeLists.txt b/inference-engine/thirdparty/pugixml/CMakeLists.txt +index 8bcb2801..380fb468 100644 +--- a/inference-engine/thirdparty/pugixml/CMakeLists.txt ++++ b/inference-engine/thirdparty/pugixml/CMakeLists.txt +@@ -41,7 +41,7 @@ if(BUILD_SHARED_LIBS) + else() + add_library(pugixml STATIC ${SOURCES}) + if (MSVC) +- add_library(pugixml_mt STATIC ${SOURCES}) ++ #add_library(pugixml_mt STATIC ${SOURCES}) + #if (WIN32) + # set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") + # set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") +diff --git a/ngraph/core/builder/CMakeLists.txt b/ngraph/core/builder/CMakeLists.txt +index 4c5a4766..6f5f2535 100644 +--- a/ngraph/core/builder/CMakeLists.txt ++++ b/ngraph/core/builder/CMakeLists.txt +@@ -28,7 +28,7 @@ source_group("src" FILES ${LIBRARY_SRC}) + source_group("include" FILES ${PUBLIC_HEADERS}) + + # Create shared library +-add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS}) ++add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${LIBRARY_SRC} ${PUBLIC_HEADERS}) + + if(COMMAND ie_faster_build) + ie_faster_build(${TARGET_NAME} +diff --git a/ngraph/core/reference/CMakeLists.txt b/ngraph/core/reference/CMakeLists.txt +index 2fa49195..ce68fdc8 100644 +--- a/ngraph/core/reference/CMakeLists.txt ++++ b/ngraph/core/reference/CMakeLists.txt +@@ -28,7 +28,7 @@ source_group("src" FILES ${LIBRARY_SRC}) + source_group("include" FILES ${PUBLIC_HEADERS}) + + # Create shared library +-add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS}) ++add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${LIBRARY_SRC} ${PUBLIC_HEADERS}) + + if(COMMAND ie_faster_build) + ie_faster_build(${TARGET_NAME} +diff --git a/openvino/itt/CMakeLists.txt b/openvino/itt/CMakeLists.txt +index 766521a1..04240a89 100644 +--- a/openvino/itt/CMakeLists.txt ++++ b/openvino/itt/CMakeLists.txt +@@ -56,7 +56,7 @@ if(ENABLE_PROFILING_ITT) + endif() + endif() + +-add_library(${TARGET_NAME} STATIC ${SOURCES}) ++add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES}) + + add_library(openvino::itt ALIAS ${TARGET_NAME}) + diff --git a/platforms/winpack_dldt/2021.2/20201218-dldt-vs-version.patch b/platforms/winpack_dldt/2021.2/20201218-dldt-vs-version.patch new file mode 100644 index 0000000000..4d60de77e2 --- /dev/null +++ b/platforms/winpack_dldt/2021.2/20201218-dldt-vs-version.patch @@ -0,0 +1,16 @@ +diff --git a/cmake/vs_version/vs_version.cmake b/cmake/vs_version/vs_version.cmake +index d857e2e4..453903fd 100644 +--- a/cmake/vs_version/vs_version.cmake ++++ b/cmake/vs_version/vs_version.cmake +@@ -22,9 +22,9 @@ if(IE_VS_VER_HAS_VERSION) + endif() + + set(IE_VS_VER_PRODUCTVERSION_STR "${CI_BUILD_NUMBER}") +-set(IE_VS_VER_PRODUCTNAME_STR "OpenVINO toolkit") ++set(IE_VS_VER_PRODUCTNAME_STR "OpenVINO toolkit (for OpenCV Windows package)") + set(IE_VS_VER_COPYRIGHT_STR "Copyright (C) 2018-2020, Intel Corporation") +-set(IE_VS_VER_COMMENTS_STR "https://docs.openvinotoolkit.org/") ++set(IE_VS_VER_COMMENTS_STR "https://github.com/opencv/opencv/wiki/Intel%27s-Deep-Learning-Inference-Engine-backend") + + # + # ie_add_vs_version_file(NAME diff --git a/platforms/winpack_dldt/2021.2/build.config.py b/platforms/winpack_dldt/2021.2/build.config.py new file mode 100644 index 0000000000..ebb0cb1a64 --- /dev/null +++ b/platforms/winpack_dldt/2021.2/build.config.py @@ -0,0 +1,3 @@ +os.environ['CI_BUILD_NUMBER'] = '2021.2.0-opencv_winpack_dldt' + +cmake_vars['ENABLE_V10_SERIALIZE'] = 'ON' diff --git a/platforms/winpack_dldt/2021.2/patch.config.py b/platforms/winpack_dldt/2021.2/patch.config.py new file mode 100644 index 0000000000..76b16544db --- /dev/null +++ b/platforms/winpack_dldt/2021.2/patch.config.py @@ -0,0 +1,4 @@ +applyPatch('20201217-dldt-disable-unused-targets.patch') +applyPatch('20200413-dldt-pdb.patch') +applyPatch('20200604-dldt-disable-multidevice.patch') +applyPatch('20201218-dldt-vs-version.patch') diff --git a/platforms/winpack_dldt/2021.2/sysroot.config.py b/platforms/winpack_dldt/2021.2/sysroot.config.py new file mode 100644 index 0000000000..0862e1e08e --- /dev/null +++ b/platforms/winpack_dldt/2021.2/sysroot.config.py @@ -0,0 +1,54 @@ +sysroot_bin_dir = prepare_dir(self.sysrootdir / 'bin') +copytree(self.build_dir / 'install', self.sysrootdir / 'ngraph') +#rm_one(self.sysrootdir / 'ngraph' / 'lib' / 'ngraph.dll') + +build_config = 'Release' if not self.config.build_debug else 'Debug' +build_bin_dir = self.build_dir / 'bin' / 'intel64' / build_config + +def copy_bin(name): + global build_bin_dir, sysroot_bin_dir + copytree(build_bin_dir / name, sysroot_bin_dir / name) + +dll_suffix = 'd' if self.config.build_debug else '' +def copy_dll(name): + global copy_bin, dll_suffix + copy_bin(name + dll_suffix + '.dll') + copy_bin(name + dll_suffix + '.pdb') + +copy_bin('cache.json') +copy_dll('clDNNPlugin') +copy_dll('HeteroPlugin') +copy_dll('inference_engine') +copy_dll('inference_engine_ir_reader') +copy_dll('inference_engine_legacy') +copy_dll('inference_engine_transformations') # runtime +copy_dll('inference_engine_lp_transformations') # runtime +copy_dll('MKLDNNPlugin') # runtime +copy_dll('myriadPlugin') # runtime +#copy_dll('MultiDevicePlugin') # runtime, not used +copy_dll('ngraph') +copy_bin('plugins.xml') +copy_bin('pcie-ma2x8x.elf') +copy_bin('usb-ma2x8x.mvcmd') + +copytree(self.srcdir / 'inference-engine' / 'temp' / 'tbb' / 'bin', sysroot_bin_dir) +copytree(self.srcdir / 'inference-engine' / 'temp' / 'tbb', self.sysrootdir / 'tbb') + +sysroot_ie_dir = prepare_dir(self.sysrootdir / 'deployment_tools' / 'inference_engine') +sysroot_ie_lib_dir = prepare_dir(sysroot_ie_dir / 'lib' / 'intel64') + +copytree(self.srcdir / 'inference-engine' / 'include', sysroot_ie_dir / 'include') +if not self.config.build_debug: + copytree(self.build_dir / 'install' / 'lib' / 'ngraph.lib', sysroot_ie_lib_dir / 'ngraph.lib') + copytree(build_bin_dir / 'inference_engine.lib', sysroot_ie_lib_dir / 'inference_engine.lib') + copytree(build_bin_dir / 'inference_engine_ir_reader.lib', sysroot_ie_lib_dir / 'inference_engine_ir_reader.lib') + copytree(build_bin_dir / 'inference_engine_legacy.lib', sysroot_ie_lib_dir / 'inference_engine_legacy.lib') +else: + copytree(self.build_dir / 'install' / 'lib' / 'ngraphd.lib', sysroot_ie_lib_dir / 'ngraphd.lib') + copytree(build_bin_dir / 'inference_engined.lib', sysroot_ie_lib_dir / 'inference_engined.lib') + copytree(build_bin_dir / 'inference_engine_ir_readerd.lib', sysroot_ie_lib_dir / 'inference_engine_ir_readerd.lib') + copytree(build_bin_dir / 'inference_engine_legacyd.lib', sysroot_ie_lib_dir / 'inference_engine_legacyd.lib') + +sysroot_license_dir = prepare_dir(self.sysrootdir / 'etc' / 'licenses') +copytree(self.srcdir / 'LICENSE', sysroot_license_dir / 'dldt-LICENSE') +copytree(self.sysrootdir / 'tbb/LICENSE', sysroot_license_dir / 'tbb-LICENSE') diff --git a/platforms/winpack_dldt/build_package.py b/platforms/winpack_dldt/build_package.py index 05991da6b4..817b4a9b5c 100644 --- a/platforms/winpack_dldt/build_package.py +++ b/platforms/winpack_dldt/build_package.py @@ -151,6 +151,9 @@ def git_apply_patch(src_dir, patch_file): assert os.path.exists(patch_file), patch_file execute(cmd=['git', 'apply', '--3way', '-v', '--ignore-space-change', str(patch_file)], cwd=src_dir) execute(cmd=['git', '--no-pager', 'diff', 'HEAD'], cwd=src_dir) + os.environ['GIT_AUTHOR_NAME'] = os.environ['GIT_COMMITTER_NAME']='build' + os.environ['GIT_AUTHOR_EMAIL'] = os.environ['GIT_COMMITTER_EMAIL']='build@opencv.org' + execute(cmd=['git', 'commit', '-am', 'apply opencv patch'], cwd=src_dir) #=================================================================================================== @@ -278,6 +281,13 @@ class BuilderDLDT: OUTPUT_ROOT=str(self.build_dir), # 2020.4+ ) + self.build_config_file = str(self.cpath / 'build.config.py') # Python 3.5 may not handle Path + if os.path.exists(str(self.build_config_file)): + with open(self.build_config_file, 'r') as f: + cfg = f.read() + exec(compile(cfg, str(self.build_config_file), 'exec')) + log.info('DLDT processed build configuration script') + cmd += [ '-D%s=%s' % (k, v) for (k, v) in cmake_vars.items() if v is not None] if self.config.cmake_option_dldt: cmd += self.config.cmake_option_dldt @@ -445,8 +455,8 @@ class Builder: def main(): dldt_src_url = 'https://github.com/openvinotoolkit/openvino' - dldt_src_commit = '2021.1' - dldt_release = '2021010000' + dldt_src_commit = '2021.2' + dldt_release = '2021020000' build_cache_dir_default = os.environ.get('BUILD_CACHE_DIR', '.build_cache') build_subst_drive = os.environ.get('BUILD_SUBST_DRIVE', None)