-
Notifications
You must be signed in to change notification settings - Fork 972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add project support Bazel build system. #1167
Comments
Sadly I never directly worked with bazel yet. I would love to merge a PR adding bazel support if someone is volunteering to maintain it. |
Okay, I'm also working on how to do this. |
Progress notes: Since #1182 , cpr can be full statically linked on Windows. Bazel projects can use rules_foreign_cc to build cpr: third-party/cpr/repositories.MODULE.bazel: new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
all_content = """
filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])
"""
new_git_repository(
name = "cpr",
build_file_content = all_content,
remote = "https://github.com/libcpr/cpr",
commit = "c121ee0cece3878c5eaa69cfa571a23f75c94336",
) third-party/cpr/BUILD.bazel: load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
exports_files(["repositories.MODULE.bazel"])
package(default_visibility = ["//visibility:public"])
cmake(
name = "cpr",
cache_entries = select({
"//conditions:default": {
"CPR_USE_SYSTEM_CURL": "OFF",
"BUILD_SHARED_LIBS": "OFF",
},
}),
lib_source = "@cpr//:all",
out_include_dir = "include",
out_lib_dir = "lib",
out_static_libs = [
"zlibstatic.lib",
"libcurl.lib",
"cpr.lib",
],
visibility = ["//visibility:public"],
) Next I will look into how to make cpr itself support Bazel builds. |
Is your feature request related to a problem?
I try build static library directly, but lib files can't use in my bazel project.
log cpr.lib(threadpool.obj) : error LNK2019: ���������ⲿ���� _Cnd_timedwait_for������ "public: __cdecl <lambda_eba37c162f1e7731b0928a0b0fca0ed0>::operator()(void)const " (??R<lambda_eba37c162f1e7731b0928a0b0fca0ed0>@@QEBA@XZ) �������˸÷��� cpr.lib(async.obj) : error LNK2019: ���������ⲿ���� __std_init_once_link_alternate_names_and_abort������ "public: __cdecl std::_Init_once_completer::~_Init_once_completer(void)" (??1_Init_once_completer@std@@QEAA@XZ) �������˸÷���
I can't find the reason yet.
this is my
BUILD.bazel
file's some content:Possible Solution
If cpr support bazel directly, maybe it will be easier to use. But I can't successfully convert the cmake project to a bazel project yet.
Alternatives
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: