mirror of
https://github.com/bazel-contrib/rules_foreign_cc
synced 2024-11-27 02:43:28 +00:00
48 lines
1.2 KiB
Plaintext
48 lines
1.2 KiB
Plaintext
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
|
|
|
|
filegroup(
|
|
name = "all_srcs",
|
|
srcs = glob(
|
|
["**"],
|
|
exclude = ["tests/**"],
|
|
),
|
|
)
|
|
|
|
_CACHE_ENTRIES = {
|
|
"BUILD_CLAR": "off",
|
|
"BUILD_EXAMPLES": "off",
|
|
"BUILD_FUZZERS": "off",
|
|
"BUILD_SHARED_LIBS": "off",
|
|
#"EMBED_SSH_PATH": "$(location @libssh2//:libssh2)",
|
|
"USE_HTTPS": "on",
|
|
}
|
|
|
|
_LINUX_CACHE_ENTRIES = dict(_CACHE_ENTRIES.items() + {
|
|
"CMAKE_C_FLAGS": "$${CMAKE_C_FLAGS:-} -fPIC",
|
|
"REGEX_BACKEND": "pcre2",
|
|
}.items())
|
|
|
|
cmake(
|
|
name = "libgit2",
|
|
cache_entries = select({
|
|
"@platforms//os:linux": _LINUX_CACHE_ENTRIES,
|
|
"//conditions:default": _CACHE_ENTRIES,
|
|
}),
|
|
lib_source = ":all_srcs",
|
|
out_static_libs = select({
|
|
# TODO: I'm guessing at this name. Needs to be checked on windows.
|
|
"@platforms//os:windows": ["git2.lib"],
|
|
"//conditions:default": ["libgit2.a"],
|
|
}),
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"@libssh2",
|
|
"@openssl",
|
|
"@zlib",
|
|
] + select({
|
|
"@platforms//os:linux": ["@pcre"],
|
|
"@platforms//os:macos": ["@iconv_macos//:iconv"],
|
|
"//conditions:default": [],
|
|
}),
|
|
)
|