mirror of
https://github.com/bazel-contrib/rules_foreign_cc
synced 2024-11-30 16:42:07 +00:00
49 lines
1.3 KiB
Plaintext
49 lines
1.3 KiB
Plaintext
|
load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake_external")
|
||
|
|
||
|
filegroup(
|
||
|
name = "all_srcs",
|
||
|
srcs = glob(
|
||
|
["**"],
|
||
|
exclude = ["tests/**"],
|
||
|
),
|
||
|
)
|
||
|
|
||
|
_CACHE_ENTRIES = {
|
||
|
"BUILD_CLAR": "off",
|
||
|
"BUILD_EXAMPLES": "off",
|
||
|
"BUILD_FUZZERS": "off",
|
||
|
"BUILD_SHARED_LIBS": "off",
|
||
|
"CMAKE_PREFIX_PATH": "$EXT_BUILD_DEPS/pcre;$EXT_BUILD_DEPS/openssl;$EXT_BUILD_DEPS/libssh2;$EXT_BUILD_DEPS/zlib;${CMAKE_PREFIX_PATH:-}",
|
||
|
"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": "pcre",
|
||
|
}.items())
|
||
|
|
||
|
cmake_external(
|
||
|
name = "libgit2",
|
||
|
cache_entries = select({
|
||
|
"@platforms//os:linux": _LINUX_CACHE_ENTRIES,
|
||
|
"//conditions:default": _CACHE_ENTRIES,
|
||
|
}),
|
||
|
lib_source = ":all_srcs",
|
||
|
static_libraries = 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",
|
||
|
"@zlib",
|
||
|
"@openssl",
|
||
|
] + select({
|
||
|
"@platforms//os:linux": ["@pcre"],
|
||
|
"@platforms//os:macos": ["@iconv"],
|
||
|
"//conditions:default": [],
|
||
|
}),
|
||
|
)
|