Skip to content
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

Open
MiyamuraMiyako opened this issue Jan 25, 2025 · 2 comments
Open

Add project support Bazel build system. #1167

MiyamuraMiyako opened this issue Jan 25, 2025 · 2 comments

Comments

@MiyamuraMiyako
Copy link

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:

cc_import(
    name = "zlibstatic",
    hdrs = [],
    static_library = "libs/win-x64/zlibstatic.lib",
    visibility = ["//visibility:public"],
)

cc_import(
    name = "curl",
    hdrs = [],
    deps=[":zlibstatic"],
    static_library = "libs/win-x64/libcurl.lib",
    visibility = ["//visibility:public"],
)

cc_import(
    name = "cpr",
    hdrs = glob([
        "src/cpr/*.h",
    ]),
    static_library = "libs/win-x64/cpr.lib",
    deps=[":zlibstatic",":curl"],
    visibility = ["//visibility:public"],
)

cc_binary(
    name = "..........",
    srcs = glob([
        "**/*.cpp",
        "**/*.hpp",
        "**/*.h",
    ]),
    copts = [
        "/utf-8",
        "-std:c++17",
        "-Bv",
        "-W3",
        "-MT",
        "-D_UNICODE",
        "-DUNICODE",
    ],
    includes = ["src"],
    linkopts = [
        "-ENTRY:wWinMainCRTStartup",
        "-SUBSYSTEM:WINDOWS",
        "-NODEFAULTLIB:libcmt.lib",
    ],
    linkstatic = 1,
    deps = [
        ..........
        ":zlibstatic",
        ":curl",
        ":cpr",
        .........
    ],
)

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

@COM8
Copy link
Member

COM8 commented Jan 26, 2025

Sadly I never directly worked with base yet.
Bat some time ago, someone else put in the work to write some bazel rules here: https://github.com/hedronvision/bazel-make-cc-https-easy

I would love to merge a PR adding bazel support if someone is volunteering to maintain it.

@MiyamuraMiyako
Copy link
Author

Okay, I'm also working on how to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants