1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2024-02-26 18:05:36 +03:00
73 changed files with 1706 additions and 95 deletions
@@ -1,6 +1,7 @@
plugins {
id 'com.android.library'
id 'maven-publish'
id 'kotlin-android'
}
android {
@@ -1,4 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.library' version '7.3.0' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
}
+1 -1
View File
@@ -9,7 +9,7 @@ cmake_common_vars = {
# Docs: https://developer.android.com/studio/releases/gradle-plugin
'ANDROID_GRADLE_PLUGIN_VERSION': '7.3.1',
'GRADLE_VERSION': '7.5.1',
'KOTLIN_PLUGIN_VERSION': '1.5.20',
'KOTLIN_PLUGIN_VERSION': '1.8.20',
}
ABIs = [
ABI("2", "armeabi-v7a", None, ndk_api_level=ANDROID_NATIVE_API_LEVEL, cmake_vars=cmake_common_vars),
+10 -5
View File
@@ -84,7 +84,6 @@ class Builder:
"-DPYTHON_DEFAULT_EXECUTABLE=%s" % sys.executable,
"-DENABLE_PIC=FALSE", # To workaround emscripten upstream backend issue https://github.com/emscripten-core/emscripten/issues/8761
"-DCMAKE_BUILD_TYPE=Release",
"-DCMAKE_TOOLCHAIN_FILE='%s'" % self.get_toolchain_file(),
"-DCPU_BASELINE=''",
"-DCMAKE_INSTALL_PREFIX=/usr/local",
"-DCPU_DISPATCH=''",
@@ -144,6 +143,8 @@ class Builder:
"-DBUILD_PERF_TESTS=ON"]
if self.options.cmake_option:
cmd += self.options.cmake_option
if not self.options.cmake_option or all(["-DCMAKE_TOOLCHAIN_FILE" not in opt for opt in self.options.cmake_option]):
cmd.append("-DCMAKE_TOOLCHAIN_FILE='%s'" % self.get_toolchain_file())
if self.options.build_doc:
cmd.append("-DBUILD_DOCS=ON")
else:
@@ -193,6 +194,7 @@ class Builder:
flags += self.options.build_flags
if self.options.webnn:
flags += "-s USE_WEBNN=1 "
flags += "-s EXPORTED_FUNCTIONS=\"['_malloc', '_free']\""
return flags
def config(self):
@@ -223,10 +225,12 @@ if __name__ == "__main__":
opencv_dir = os.path.abspath(os.path.join(SCRIPT_DIR, '../..'))
emscripten_dir = None
if "EMSCRIPTEN" in os.environ:
if "EMSDK" in os.environ:
emscripten_dir = os.path.join(os.environ["EMSDK"], "upstream", "emscripten")
elif "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")
log.warning("EMSCRIPTEN/EMSDK 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)")
@@ -255,7 +259,8 @@ if __name__ == "__main__":
help="Specify configuration file with own list of exported into JS functions")
parser.add_argument('--webnn', action="store_true", help="Enable WebNN Backend")
args = parser.parse_args()
transformed_args = ["--cmake_option=%s".format(arg) if arg[:2] == "-D" else arg for arg in sys.argv[1:]]
args = parser.parse_args(transformed_args)
log.debug("Args: %s", args)
@@ -265,7 +270,7 @@ if __name__ == "__main__":
del os.environ['EMMAKEN_JUST_CONFIGURE'] # avoid linker errors with NODERAWFS message then using 'emcmake' launcher
if args.emscripten_dir is None:
log.error("Cannot get Emscripten path, please use 'emcmake' launcher or 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/EMSDK environment variable or --emscripten_dir option.")
sys.exit(-1)
builder = Builder(args)