I'm new to using bazel
and I don't know how to make the path of my includes not have to be a full path. You can see the comment in src/main/main.c
file.
My directory tree:
.
├── WORKSPACE
├── src
│ ├── lib
│ │ ├── BUILD
│ │ └── mytypes.h
│ └── main
│ ├── BUILD
│ └── main.c
└── test
└── BUILD
src/lib/mytypes.h
file:
#ifndef MYTYPES_H
#define MYTYPES_H
typedef unsigned char byte_t;
#endif
src/lib/BUILD
file:
cc_library(
name = "mytypes",
#srcs = glob(["*.c"]),
hdrs = glob(["*.h"]),
visibility = ["//src/main:__pkg__"],
)
src/main/main.c
file:
#include <stdio.h>
#include "src/lib/mytypes.h" // I would like to use: #include "mytypes.h"
int main(int argc, char **argv)
{
byte_t byte = 0xAF;
printf("%X\n", byte);
return 0;
}
src/main/BUILD
file:
cc_library(
name = "mytypes",
#srcs = glob(["*.c"]),
hdrs = glob(["*.h"]),
visibility = ["//src/main:__pkg__"],
)
WORKSPACE
file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_google_googletest",
sha256 = "7b100bb68db8df1060e178c495f3cbe941c9b058",
strip_prefix = "googletest-release-1.11.0",
urls = ["https://github.com/google/googletest/archive/release-1.11.0.tar.gz"],
)