Keyboard and brain got a little misconnected there. The first 2 sentences of item 3, which are missing some things I meant to fill in, can be replaced with the text from item 5.
Just to reset what I think are some misconceptions here:
- CMake, despite having the verb "Make" in its name, doesn't make the application. CMake makes something (depends on the platform, i.e. a Makefile or ninja build file or Visual Studio solution\project files) that then allows you to make the application, this is the "generator" specified when running CMake. CMake can also create some source files, e.g. config.h for use when making the application.
- The CMake generation produces build artefacts that have multiple targets to make the distinct parts of a complex application such as Wireshark.
- There is a build target , that will generate all the asn1 based dissectors. Each dissector also has its own specific target, e.g. . This isn't run from the top level Wireshark target as we don't need to degenerate the asn1 dissectors on each build, only when something in them changes.
- The method to specify a build target vary with the build mechanism. For VisualStudio you can specify the project file or the solution file with a /t:xxx argument to specify the target (each project file is a target). Pascal has shown how it's done for Ninja builds.
- There is a target for each asn1 based dissector; "generate_dissector-foo" and a target to generate all the asn1 dissectors, "asn1".
- The magic part of CMake that invokes asn2wrs to generate the dissectors from the asn1 files (and other bits) is in cmake\modules\UserAsn2Wrs.cmake and this is invoked in each dissectors specific CMakeLists.txt via the CMake macro ASN2WRS(). The asn1 target is generated by the CMakeLists.txt in epan/dissectors/asn1 and simply adds each generated dissector target as a dependency of the asn1 target.
Hi Vicent,
I should give that a try. What version of Windows and tools are you using? I’m beat. I need to do something that works soon.
No need to install Windows; it works the same way on Linux. Go to your build folder and run:
ninja epan/dissectors/asn1/foo/generate_dissector-foo
Assuming you are using ninja, otherwise replace it by make.
The target should have been created iby running CMake after the addition of the CMakeListsCustom.txt file.
Best regards.
Hi,
I don’t think they are generated what will be generated are the files needed to DO the generation.
On windows the next step is to run
msbuild /m /p:Configuration=RelWithDebInfo epan\dissectors\asn1\h248\generate_dissector-h248.vcxproj
which will the generate the .c and .h files
Regards
Anders
Correct insofar as there are no generated files associated with asn1/foo directory. Namely, packet-foo.c and packet-foo.h did not get generated. But maybe that's not definitive proof that asn1/foo dissector did not get built. How else can I confirm the dissector was or was not built? Open Wireshark and attempt to apply "foo" as a display filter? It's not there.
Hi,
So you are saying that if you create foo dir like
epan/dissectors/asn1/foo/
Rename and update the custom cmake file to
set(CUSTOM_ASN1_SRC_DIR
foo
)
And place your source file and cmake.txt in the foo dir then rerun the cmake process
Nothing happens?
Try to delete the build dir before rerunning cmake again?
I’m not sure on linux if the generate cmake file ends up under the build dir or in the source dir.
Regards
Anders
I tried renaming ./epan/dissectors/asn1/CMakeListsCustom.txt.example to CMakeListsCustom.txt with an entry as follows:
# Add a list of your custom asn1 dissectors here
set(CUSTOM_ASN1_SRC_DIR
foo
)
Again, the build did not update any targets even with that change. But this is progress because that underscores the Step by Step instructions need to be updated to something that works. Any more ideas?
I need help building the simple ASN.1 UDP-based dissector example (foo); specifically, I need help building the generate_dissector-*proto* target (Step #6 below). I'm certainly missing something here.
(c) I created directory "foo" by extracting the attachment (foo.tgz) in epan/dissectors/asn1/
(d) There is a CMakeListsCustom.txt.example file in epan/dissectors/asn1 which already contains an entry for "foo".
(e) Since I don't know what to do in Step #6, I build Wireshare (using cmake), but no build targets get updated.
If the solution to this problem belongs in the Wireshark documentation, I would be glad to help update the documentation. Namely, I don't understand the usage of the 5 (five) CMakeListsCustom.txt.example files inWireshark source code.
The CMakeListsCustom.txt.example files are just that, examples. You need to copy or rename them to CMakeListsCustom.txt (without the .example) for them to have any effect (and edit them appropriately to add the dissector name to the list, not commented out.)
CMake is configured to look for the files by that name.
--
--