From 989d4ffc688c1975e0ffe8e772c151c473c3f8fd Mon Sep 17 00:00:00 2001 From: alexbeattie42 Date: Wed, 3 May 2023 14:52:53 +0300 Subject: [PATCH] Windows OpenCV Source Build --- third_party/BUILD | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/third_party/BUILD b/third_party/BUILD index 9a2068599..59168ff53 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -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(