how can I make Bazel to recognize other types of header files?

904 views
Skip to first unread message

Diego

unread,
Jun 1, 2017, 12:58:22 AM6/1/17
to bazel-discuss
I have a local repository for SOL2 library, which is an external library wrapper for Lua. One of its files is including a file with the "inl" extension, but it is just a C header file. The problem is I can't include it in the srcs of the local repo or else Bazel will complain.

source file:

#ifdef __cplusplus
extern "C" {
#endif
#include "compatibility/5.1.0.h"
#include "compatibility/5.0.0.h"
#include "compatibility/5.x.x.h"
#include "compatibility/5.x.x.inl"
#ifdef __cplusplus
}
#endif

WORKSPACE file:

new_local_repository(
name = "sol2",
path = "../lib/sol2",
build_file_content = """
cc_library(
name = "sol2",
srcs = glob([
"sol/*.hpp",
"sol/compatibility/*.h",
"sol/compatibility/*.hpp",
"sol/compatibility/*.inl",
]),
hdrs = ["sol.hpp"],
deps = ["//external:lua"],
visibility = ["//visibility:public"],
)
""",
)

ERROR: /home/diego/.cache/bazel/_bazel_diego/8789a25bbb5d0dbd8f367c540d06e5d7/external/sol2/BUILD:4:9: in srcs attribute of cc_library rule @sol2//:sol2: file '@sol2//:sol/compatibility/5.x.x.inl' is misplaced here (expected .cc, .cpp, .cxx, .c++, .C, .c, .h, .hh, .hpp, .hxx, .inc, .S, .s, .asm, .a, .lib, .pic.a, .lo, .pic.lo, .so, .dylib, .dll, .o or .pic.o).
ERROR: /home/diego/.cache/bazel/_bazel_diego/8789a25bbb5d0dbd8f367c540d06e5d7/external/sol2/BUILD:4:9: in srcs attribute of cc_library rule @sol2//:sol2: '@sol2//:sol/compatibility/5.x.x.inl' does not produce any cc_library srcs files (expected .cc, .cpp, .cxx, .c++, .C, .c, .h, .hh, .hpp, .hxx, .inc, .S, .s, .asm, .a, .lib, .pic.a, .lo, .pic.lo, .so, .dylib, .dll, .o or .pic.o).


--
https://github.com/thinlizzy/ - C++11 and C++14 open source wrappers and libraries for various purposes (XML, image, webserver... and even a MTG implementation)
http://baudejogos.net - o único site brasileiro decente de jogos

Austin Schuh

unread,
Jun 1, 2017, 1:15:25 AM6/1/17
to Diego, bazel-discuss

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAA5%3Di_HMMUvBbspXnr-M9nHC7Mi0_KteGhaqtdOPbDHq95k%2BbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Diego

unread,
Jun 1, 2017, 6:37:52 PM6/1/17
to Austin Schuh, bazel-discuss
sweet! thanks :)

To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages