Adrian Herrera has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/64491?usp=email )
Change subject: scons: fix protobuf action for imports
......................................................................
scons: fix protobuf action for imports
The current protoc_action generates declarations that impose the requirement
for .proto files to import from the BUILDDIR. This prevents .proto files to
import themselves relative to their own directory.
For example, if there are two files build/pkg/a.proto and build/pkg/b.proto,
and b.proto imports a.proto, it must do so as "import pkg/a.proto", as
opposed
to "import a.proto"; otherwise, the generated declaration will give rise to
a
compilation error.
This is a problem for EXTRAS where .proto files are gem5-independent, so
they cannot import from gem5's build directory. An example is
https://github.com/ARM-software/ATP-Engine
This commit changes the protoc_action so that declarations are generated
relative to the SOURCE directory. This enables .proto files to import
other .proto files within the same directory.
Note it is not possible to import other .proto files in different
directories, but support for it is not currently necessary.
More details on the proto path:
https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#invocation
Related:
https://gem5-review.googlesource.com/c/public/gem5/+/55903
Change-Id: Ib3e67ae817f8ad0b6803c90d23469267eff16178
Signed-off-by: Adrián Herrera Arcila <adrian.herr...@arm.com>
---
M src/SConscript
1 file changed, 40 insertions(+), 3 deletions(-)
diff --git a/src/SConscript b/src/SConscript
index 63ff3ef..4e7139c 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -250,9 +250,10 @@
root, ext = os.path.splitext(source[0].get_abspath())
return [root + '.pb.cc', root + '.pb.h'], source
-protoc_action = MakeAction('${PROTOC} --cpp_out ${BUILDDIR} '
- '--proto_path ${BUILDDIR} --proto_path ${SOURCE.dir} '
- '${SOURCE.get_abspath()}',
+# To understand these variables and attributes, see:
+#
https://scons.org/doc/production/HTML/scons-man.html#variable_substitution
+protoc_action = MakeAction('${PROTOC} --cpp_out ${TARGET.dir.abspath} '
+ '--proto_path ${SOURCE.dir.abspath} ${SOURCE.abspath}',
Transform("PROTOC"))
protobuf_builder = Builder(action=protoc_action, emitter=protoc_emitter,
src_suffix='.proto')
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/64491?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ib3e67ae817f8ad0b6803c90d23469267eff16178
Gerrit-Change-Number: 64491
Gerrit-PatchSet: 1
Gerrit-Owner: Adrian Herrera <adrian.herr...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org