Attention is currently required from: Gabe Black.
Hello Gabe Black,
I'd like you to do a code review. Please visit
https://gem5-review.googlesource.com/c/public/gem5/+/37275
to review the following change.
Change subject: scons: Consolidate the ProtoBuf code.
......................................................................
scons: Consolidate the ProtoBuf code.
The ProtoBuf support in src/SConscript was split into two parts, one
where the ProtoBuf sources were declared, and the other where scons was
told how to buld the .cc and .hh files and the .cc was added to the
build.
As far as I can tell, there was no real reason to have things split up
like that, at least not currently. This change moves everything into
the ProtoBuf class definition, and this should behave the same as
before but be a little easier to understand and maintain.
Change-Id: I02320f50ece53d90c14b5062bd6b1167210f46c3
---
M src/SConscript
1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/src/SConscript b/src/SConscript
index 50bf072..79be943 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -393,6 +393,9 @@
'''Specify the source file, and any tags'''
super(ProtoBuf, self).__init__(source, tags, add_tags)
+ if not env['HAVE_PROTOC'] or not env['HAVE_PROTOBUF']:
+ error('Got protobuf to build, but lacks support!')
+
# Get the file name and the extension
modname,ext = self.extname
assert ext == 'proto'
@@ -402,6 +405,19 @@
self.cc_file = self.tnode.dir.File(modname + '.pb.cc')
self.hh_file = self.tnode.dir.File(modname + '.pb.h')
+ # Use both the source and header as the target, and the .proto
+ # file as the source. When executing the protoc compiler, also
+ # specify the proto_path to avoid having the generated files
+ # include the path.
+ env.Command([self.cc_file, self.hh_file], self.tnode,
+ MakeAction('${PROTOC} --cpp_out ${BUILDDIR} '
+ '--proto_path ${BUILDDIR} $SOURCE',
+ Transform("PROTOC")))
+
+ # Add the C++ source file
+ Source(self.cc_file, tags=self.tags,
+ append={'CXXFLAGS': '-Wno-array-bounds'})
+
exectuable_classes = []
class ExecutableMeta(type):
@@ -1016,24 +1032,6 @@
env.Depends(cc_file, depends + extra_deps)
Source(cc_file)
-# Build all protocol buffers if we have got protoc and protobuf available
-if env['HAVE_PROTOC'] and env['HAVE_PROTOBUF']:
- for proto in ProtoBuf.all:
- # Use both the source and header as the target, and the .proto
- # file as the source. When executing the protoc compiler, also
- # 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 ${BUILDDIR} '
- '--proto_path ${BUILDDIR} $SOURCE',
- Transform("PROTOC")))
-
- # Add the C++ source file
- Source(proto.cc_file, tags=proto.tags,
- append={'CXXFLAGS': '-Wno-array-bounds'})
-elif ProtoBuf.all:
- error('Got protobuf to build, but lacks support!')
-
#
# Handle debug flags
#
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37275
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: I02320f50ece53d90c14b5062bd6b1167210f46c3
Gerrit-Change-Number: 37275
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Attention: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s