Graham Bloice

I've now got tshark to build from a VS solution file, had to do some hacks
to get there though, patch files attached for others to peruse, as I'm not
sure if they are the optimal solutions:

   3. As mentioned in my previous message, the VS solution chops out every
   8192nd byte from the command line passed to make-dissector-reg.py.  My
   patch (make-reg.patch) gets CMake to write out the required source file
   list to a file and modifies the python script to read in the file.  The
   python changes *should* be backwards compatible.

Me: Small fix to UseMakeDissectorReg.cmake (elseif() -> else())

svn path=/trunk/; revision=53654
This commit is contained in:
Jörg Mayer 2013-11-29 19:57:00 +00:00
parent d99fdfda63
commit fb22ecce8d
2 changed files with 27 additions and 7 deletions

View File

@ -2,14 +2,25 @@
# $Id$
#
MACRO(REGISTER_DISSECTOR_FILES _outputfile _registertype )
set( _sources ${ARGN} )
if(${_registertype} STREQUAL "dissectors" )
set( _makeregistertype "dissectorsinfile" )
set( _ftmp "${CMAKE_CURRENT_BINARY_DIR}/_regc.tmp" )
file(REMOVE ${_ftmp})
foreach(f ${ARGN})
file(APPEND ${_ftmp} "${f}\n")
endforeach()
set( _sources ${_ftmp} )
else()
set( _makeregistertype ${_registertype} )
set( _sources ${ARGN} )
endif()
ADD_CUSTOM_COMMAND(
OUTPUT
${_outputfile}
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_SOURCE_DIR}/tools/make-dissector-reg.py
${CMAKE_CURRENT_SOURCE_DIR}
${_registertype}
${_makeregistertype}
${_sources}
DEPENDS
${_sources}

View File

@ -32,7 +32,7 @@ srcdir = sys.argv[1]
# "dissectors", we build a register.c for libwireshark.
#
registertype = sys.argv[2]
if registertype == "plugin" or registertype == "plugin_wtap":
if registertype in ("plugin", "plugin_wtap"):
final_filename = "plugin.c"
cache_filename = None
preamble = """\
@ -42,7 +42,7 @@ if registertype == "plugin" or registertype == "plugin_wtap":
* Generated automatically from %s.
*/
""" % (sys.argv[0])
elif registertype == "dissectors":
elif registertype in ("dissectors", "dissectorsinfile"):
final_filename = "register.c"
cache_filename = "register-cache.pkl"
preamble = """\
@ -64,10 +64,19 @@ else:
#
# All subsequent arguments are the files to scan.
# All subsequent arguments are the files to scan
# or the name of a file containing the files to scan
#
files = sys.argv[3:]
if registertype == "dissectorsinfile":
try:
with open(sys.argv[3]) as f:
files = [line.rstrip() for line in f]
except IOError:
print(("Unable to open input file '%s'" % sys.argv[3]))
sys.exit(1)
else:
files = sys.argv[3:]
# Create the proper list of filenames
filenames = []
for file in files: