Update Rules Foreign CC To Current Version

This commit is contained in:
alexbeattie42 2023-05-03 12:44:19 +03:00
parent 3789156a41
commit 3c43430348
2 changed files with 15 additions and 9 deletions

View File

@ -45,12 +45,13 @@ http_archive(
) )
http_archive( http_archive(
name = "rules_foreign_cc", name = "rules_foreign_cc",
strip_prefix = "rules_foreign_cc-0.1.0", sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.1.0.zip", strip_prefix = "rules_foreign_cc-0.9.0",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.9.0.tar.gz",
) )
load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies") load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
rules_foreign_cc_dependencies() rules_foreign_cc_dependencies()

15
third_party/BUILD vendored
View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
licenses(["notice"]) # Apache License 2.0 licenses(["notice"]) # Apache License 2.0
@ -70,8 +71,6 @@ alias(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake_external")
# Note: this determines the order in which the libraries are passed to the # Note: this determines the order in which the libraries are passed to the
# linker, so if library A depends on library B, library B must come _after_. # linker, so if library A depends on library B, library B must come _after_.
# Hence core is at the bottom. # Hence core is at the bottom.
@ -94,7 +93,7 @@ OPENCV_SHARED_LIBS = True
OPENCV_SO_VERSION = "3.4" OPENCV_SO_VERSION = "3.4"
cmake_external( cmake(
name = "opencv_cmake", name = "opencv_cmake",
# Values to be passed as -Dkey=value on the CMake command line; # Values to be passed as -Dkey=value on the CMake command line;
# here are serving to provide some CMake script configuration options # here are serving to provide some CMake script configuration options
@ -140,6 +139,8 @@ cmake_external(
# ccache would be able to work across sandboxed Bazel builds, either. # ccache would be able to work across sandboxed Bazel builds, either.
# In any case, Bazel does its own caching of the rule's outputs. # In any case, Bazel does its own caching of the rule's outputs.
"ENABLE_CCACHE": "OFF", "ENABLE_CCACHE": "OFF",
"CMAKE_OSX_ARCHITECTURES": "x86_64;arm64",
"CMAKE_OSX_DEPLOYMENT_TARGET": "10.15",
}, },
lib_source = "@opencv//:all", lib_source = "@opencv//:all",
linkopts = [] if OPENCV_SHARED_LIBS else [ linkopts = [] if OPENCV_SHARED_LIBS else [
@ -170,7 +171,11 @@ cmake_external(
"-lpthread", "-lpthread",
"-lrt", "-lrt",
], ],
shared_libraries = select({ 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:darwin": ["libopencv_%s.%s.dylib" % (module, OPENCV_SO_VERSION) for module in OPENCV_MODULES],
# Only the shared objects listed here will be linked in the directory # Only the shared objects listed here will be linked in the directory
# that Bazel adds to the RUNPATH of dependent executables. You cannot # that Bazel adds to the RUNPATH of dependent executables. You cannot
@ -178,7 +183,7 @@ cmake_external(
# versioned name is the one that the executables actually reference. # 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], "//conditions:default": ["libopencv_%s.so.%s" % (module, OPENCV_SO_VERSION) for module in OPENCV_MODULES],
}) if OPENCV_SHARED_LIBS else None, }) if OPENCV_SHARED_LIBS else None,
static_libraries = [ out_static_libs = [
"libopencv_%s.a" % module "libopencv_%s.a" % module
for module in OPENCV_MODULES for module in OPENCV_MODULES
] if not OPENCV_SHARED_LIBS else None, ] if not OPENCV_SHARED_LIBS else None,