Windows OpenCV Source Build

This commit is contained in:
alexbeattie42 2023-05-03 14:52:53 +03:00
parent 3c43430348
commit 989d4ffc68

15
third_party/BUILD vendored
View File

@ -92,6 +92,7 @@ OPENCV_MODULES = [
OPENCV_SHARED_LIBS = True
OPENCV_SO_VERSION = "3.4"
OPENCV_DLL_VERSION = "3410"
cmake(
name = "opencv_cmake",
@ -111,6 +112,7 @@ cmake(
"WITH_JPEG": "ON",
"WITH_PNG": "ON",
"WITH_TIFF": "ON",
"WITH_OPENEXR": "OFF",
"WITH_OPENCL": "OFF",
"WITH_WEBP": "OFF",
# Optimization flags
@ -171,22 +173,19 @@ cmake(
"-lpthread",
"-lrt",
],
out_lib_dir = select({
"@bazel_tools//src/conditions:windows": "x64/vc17/lib" if OPENCV_SHARED_LIBS else "x64/vc17/staticlib",
"//conditions:default": "lib"
}),
out_shared_libs = select({
"@bazel_tools//src/conditions:darwin": ["libopencv_%s.%s.dylib" % (module, OPENCV_SO_VERSION) for module in OPENCV_MODULES],
"@bazel_tools//src/conditions:windows": ["opencv_%s%s.dll" % (module, OPENCV_DLL_VERSION) for module in OPENCV_MODULES],
# Only the shared objects listed here will be linked in the directory
# that Bazel adds to the RUNPATH of dependent executables. You cannot
# list both the versioned and unversioned name of the .so, and the
# versioned name is the one that the executables actually reference.
"//conditions:default": ["libopencv_%s.so.%s" % (module, OPENCV_SO_VERSION) for module in OPENCV_MODULES],
}) if OPENCV_SHARED_LIBS else None,
out_static_libs = [
"libopencv_%s.a" % module
for module in OPENCV_MODULES
] if not OPENCV_SHARED_LIBS else None,
out_static_libs = select({
"@bazel_tools//src/conditions:windows": ["opencv_%s%s.lib" % (module, OPENCV_DLL_VERSION) for module in OPENCV_MODULES],
"//conditions:default": ["libopencv_%s.a" % module for module in OPENCV_MODULES] if not OPENCV_SHARED_LIBS else [],
}),
)
alias(