private-octopus / picoquic

Minimal implementation of the QUIC protocol
MIT License
523 stars 153 forks source link

[Documentation] Building (and Rebuilding) single targets #1604

Closed notBroman closed 5 months ago

notBroman commented 6 months ago

To build a single target defined in CMakeLists.txt the command cmake --build . --target <target_name> can be used this makes (re)building targets easier. This will rebuild the target and it's dependencies (if anything has changed). Since this works for all executables defined in CMakeLists.txt I'm unsure how to add this to the documentation. Nonetheless this would be useful to mention somewhere, seeing as independent building is mentioned in sample/README.md.

For example to (re)build only the sample in sample/ the command cmake --build . --target picoquic_sample can be used. The command was run from the top most directory (the oneCMakeLists.txt is in).

example.png
huitema commented 6 months ago

If I understand correctly, you would like to document the build process. That sounds like a good idea. How about preparing a PR to add something like .../doc/building_picoquic.md? I would be happy to review a PR.

notBroman commented 6 months ago

Would the goal be to replace the 'Building Picoquic' section in the README.md or just expand on it? There are also tidbits about building in some of the target directories e.g. sample/README.md, I would aim to put all the information in one place wherever possible. To what extent this is sensible or possible I am not sure of yet and would appreciate input on.

huitema commented 6 months ago

Let's do a two step. First merely add a reference in the README.md, then remove what we believe is redundant or unneeded.

RichLogan commented 6 months ago

@notBroman Apologies if I've make the wrong assumption here, but I was just reading through this and when you say:

For example to (re)build only the sample in sample/ the command cmake --build . --target picoquic_sample can be used. The command was run from the top most directory (the one CMakeLists.txt is in).

It sounds like you're doing / advocating an in source build, which are generally something we should avoid when using CMake to avoid polluting the source directory with build files.

Better to use a dedicated build directory and run build commands pointing to or in said build directory. e.g generating using cmake -S <picoquic_root> -B <your_build_directory> (or something like cd <picoquic_root>;mkdir <your_build_directory>;cd <your_build_directory>;cmake ..), and then cmake --build <your_build_directory> --target picoquic_sample.

(Can substitute . depending on what directory you're currently in, but your build dir shouldn't be the repo dir).