Reputation: 15916
Suppose I have the following directory layout:
.../
root/
bin/
sdl.dll
src/
main/
main.cpp
BUILD
WORKSPACE
And a BUILD file that says:
cc_binary(
name = "test",
srcs = ["main.cpp"]
)
And my build command line is:
bazel build //main:hello-world --symlink_prefix=/
What do I need to add to my BUILD file such that test.exe (and test.pdb, if applicable) gets copied to bin (alongside sdl.dll)?
I looked at this page and tried using --output_base
but way more stuff than I wanted to.
P.S: In "Visual Studio" term I'm looking to change $(OutDir) or a postbuild from $(OutDir) to ..\bin
Upvotes: 1
Views: 1830
Reputation: 13473
You can't do this with Bazel directly. Bazel does not write to your source directories for hermeticity reasons. The workaround is to use a post-build step script that is either manually run, or by using bazel run
.
Also see: How to write files to current directory instead of bazel-out.
Upvotes: 1