Replies: 1 comment
-
I haven't yet found good documentation on bazel+vcpkg, so I'll share my working example (for linux and windows).
new_local_repository(
name = "gmp",
path = "./tools/vcpkg/packages",
build_file = "gmp.BUILD",
)
cc_library(
name = "lib",
srcs = select({
"@bazel_tools//src/conditions:windows": glob(["mpir_x64-windows-static/lib/**/mpir.lib"]),
"@bazel_tools//src/conditions:darwin": glob(["gmp_x64-osx/lib/**/*.a"]),
"//conditions:default": glob(["gmp_x64-linux/lib/**/*.a"]),
}),
hdrs = select({
"@bazel_tools//src/conditions:windows": glob(["mpir_x64-windows-static/include/**/*.h"]),
"@bazel_tools//src/conditions:darwin": glob(["gmp_x64-osx/include/**/*.h"]),
"//conditions:default": glob(["gmp_x64-linux/include/**/*.h"]),
}),
includes = select({
"@bazel_tools//src/conditions:windows": ["mpir_x64-windows-static/include/"],
"@bazel_tools//src/conditions:darwin": ["gmp_x64-osx/include/"],
"//conditions:default": ["gmp_x64-linux/include/"],
}),
visibility = ["//visibility:public"],
linkstatic = 1
)
cc_test(
name = "my_test",
srcs = ["manydeps_gmp.test.cpp"],
deps = ["@catch2//:catch2_main", "@gmp//:lib"]
)
I also provide working example with CMake, for a comparison. Good luck! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Tried looking for some sample of using a vcpkg installed library from a bazel project but no luck, has anyone tried this?
Beta Was this translation helpful? Give feedback.
All reactions