Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/37218 )

Change subject: scons: Fix how directories are handled for protobuf files.
......................................................................

scons: Fix how directories are handled for protobuf files.

There were two issues with how paths were handled for these files.

1. The code in the ProtoBuf class would drop the subdirectory part of
the path name when generating the name of the .cc and .h files the
protoc compiler would output. Since protoc wouldn't generate files
where scons expected, it would fail when it tried to build the .cc.

2. protoc will use the --proto_path and --cpp_out settings to figure
out what path to use for generated files. It will remove the
--proto_path prefix it found the .proto file with from the files path,
and then add the rest to the --cpp_out prefix.

The input files should come from the build directory using symlinks
set up by scons, and the output files should end up alongside them.
That means the --proto_path setting should be the build directory, and
so should --cpp_out. That's fortunately simpler than what was there
before, since it doesn't depend on what the source or targets are.

Change-Id: I69692d2fe3813011982f0c1c9824589a132f93ed
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/37218
Reviewed-by: Nikos Nikoleris <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/SConscript
1 file changed, 5 insertions(+), 4 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/SConscript b/src/SConscript
index 9f82bdc..9797be3 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -399,8 +399,8 @@

         # Currently, we stick to generating the C++ headers, so we
         # only need to track the source and header.
-        self.cc_file = File(modname + '.pb.cc')
-        self.hh_file = File(modname + '.pb.h')
+        self.cc_file = self.tnode.dir.File(modname + '.pb.cc')
+        self.hh_file = self.tnode.dir.File(modname + '.pb.h')


 exectuable_classes = []
@@ -1024,8 +1024,9 @@
         # specify the proto_path to avoid having the generated files
         # include the path.
         env.Command([proto.cc_file, proto.hh_file], proto.tnode,
-                    MakeAction('${PROTOC} --cpp_out ${TARGET.dir} '
-                               '--proto_path ${SOURCE.dir} $SOURCE',
+                    MakeAction('${PROTOC} --cpp_out ${BUILDDIR} '
+                               '--proto_path ${BUILDDIR} '
+                               '${SOURCE.get_abspath()}',
                                Transform("PROTOC")))

         # Add the C++ source file

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37218
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: I69692d2fe3813011982f0c1c9824589a132f93ed
Gerrit-Change-Number: 37218
Gerrit-PatchSet: 4
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to