Closed madhurajith closed 3 years ago
you can update to dev, xmake update -s dev
and try {proto_public = true}
add_files("src/**.proto", {rules = "protobuf.c", proto_public = true})
Does it work?
Yes, I can confirm it compiles now.
One small issue though. Protobuf include path does not appear in the compile_commands.json generated by vscode. Is that something easy to fix?
{ "directory": "/Users/ruki/projects/personal/xmake/tests/projects/c/protobuf", "arguments": ["/usr/local/bin/ccache", "/usr/bin/xcrun", "-sdk", "macosx", "clang", "-c", "-Qun used-arguments", "-arch", "x86_64", "-mmacosx-version-min=10.15", "-isysroot", "/Applications/Xco de.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk", "-fvisibilit y=hidden", "-O3", "-Ibuild/.gens/test/macosx/x86_64/release/rules/protobuf/src", "-I", "/Users/ru ki/.xmake/packages/p/protobuf-c/1.3.1/f025d1e2f6944ee8a7b62ad011126f67/include", "-I", "/Users/ru ki/.xmake/packages/p/protobuf-cpp/3.15.5/6c4662c08c5f4cee8a4a04ec43f24434/include", "-DNDEBUG", " -o", "build/.objs/test/macosx/x86_64/release/src/main.c.o", "src/main.c"], "file": "src/main.c" }]
It works for me.
"-Ibuild/.gens/test/macosx/x86_64/release/rules/protobuf/src",
rule("protobuf.cpp") add the _gens/** folder to the target's include directories.
However there is no easy way of declaring the _gens/** directory as a public include directory.
This is required for libraries with protobuf files in them.
It would be great if there was an option in the rule to export the include directory.