mirror of
https://github.com/bazel-contrib/rules_foreign_cc
synced 2024-12-04 08:02:31 +00:00
5163c3cec8
* build OpenSSL using MSVC toolchain on Windows * Display lib name in progress message Before this commit, when building OpenSSL using MSVC, the progress message would display "Building openssl_msvc_". After this commit, the progess message would display "Building openssl". * Add test to verify linkage with OpenSSL libs * Add test to verify linkage with Curl libs Note that linker errors occur in applications that link with libssl and libcrypto if libcrypto comes before libssl on the linker command-line. Swapping the order of libcrypto and libssl in BUILD.openssl.bazel resolved the issue.
57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
|
|
|
|
filegroup(
|
|
name = "all_srcs",
|
|
srcs = glob(["**"]),
|
|
)
|
|
|
|
_CACHE_ENTRIES = {
|
|
"BUILD_CURL_EXE": "off",
|
|
"BUILD_SHARED_LIBS": "off",
|
|
"CMAKE_BUILD_TYPE": "RELEASE",
|
|
"CMAKE_PREFIX_PATH": "$$EXT_BUILD_DEPS$$/openssl",
|
|
"CMAKE_USE_OPENSSL": "on",
|
|
# TODO: ldap should likely be enabled
|
|
"CURL_DISABLE_LDAP": "on",
|
|
"OPENSSL_ROOT_DIR": "$$EXT_BUILD_DEPS$$/openssl",
|
|
}
|
|
|
|
_MACOS_CACHE_ENTRIES = dict(_CACHE_ENTRIES.items() + {
|
|
"CMAKE_AR": "",
|
|
"CMAKE_C_ARCHIVE_CREATE": "",
|
|
}.items())
|
|
|
|
_LINUX_CACHE_ENTRIES = dict(_CACHE_ENTRIES.items() + {
|
|
"CMAKE_C_FLAGS": "-fPIC",
|
|
}.items())
|
|
|
|
cmake(
|
|
name = "curl",
|
|
cache_entries = select({
|
|
"@platforms//os:linux": _LINUX_CACHE_ENTRIES,
|
|
"@platforms//os:macos": _MACOS_CACHE_ENTRIES,
|
|
"//conditions:default": _CACHE_ENTRIES,
|
|
}),
|
|
generate_args = select({
|
|
"@platforms//os:windows": ["-GNinja"],
|
|
"//conditions:default": [],
|
|
}),
|
|
generate_crosstool_file = False,
|
|
lib_source = ":all_srcs",
|
|
linkopts = select({
|
|
"@platforms//os:linux": [
|
|
"-lpthread",
|
|
],
|
|
"//conditions:default": [],
|
|
}),
|
|
out_static_libs = select({
|
|
"@platforms//os:windows": ["libcurl.lib"],
|
|
"//conditions:default": ["libcurl.a"],
|
|
}),
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"@openssl",
|
|
"@zlib",
|
|
],
|
|
)
|