Skip to content

Commit

Permalink
Merge pull request #9 from DouglasWebster/main
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
DouglasWebster authored Sep 29, 2023
2 parents e2d4c4a + 3cc11fd commit 950c94d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,22 @@ The source folder is set up with the three directories.

The CMakeLists.txt file in the campaign year folder does the following if CMake configuration is triggered:

1. Scans for any folders with the pattern **dayxx** where the xx is the 3 digit day number.
1. Scans for any folders with the pattern **dayxx** where the xx is the 2 digit day number.
2. For every folder found it checks for the existence of a CMakeLists.txt file in that folder.
3. If the folder does not contain a CMakeLists.txt file then it copies the starter CMakeLists.txt file from *configured_files* into that folder.
4. The discovered folders are added to the list of add_subdirectories.

The CMakeLists.txt file in the day folders do the following if CMake configuration is triggered:

1. checks if the folder has a header file named *day_xx.hpp* where *xx* is the day no. If not it creates the header file from the day_details.hpp.in file in the configured_files folder.
2. checks if there is a main.cpp file. If not it creates it from day_main.cpp.in in the configured_files folder, setting the include header file to day_xx.hpp.
3. sets the executable to **yyyy**-day**dd** where *yyyy* is the campaign year and *dd* is the day no and sets main.cpp as the initial source file.
2. checks if the folder has a header file named *day_xx.cpp* where *xx* is the day no. If not it creates the header file from the day_details.cpp.in file in the configured_files folder.
3. checks if there is a main.cpp file. If not it creates it from day_main.cpp.in in the configured_files folder, setting the include header file to day_xx.hpp.
4. sets the executable to **yyyy**-day**dd** where *yyyy* is the campaign year and *dd* is the day no and sets main.cpp as the initial source file.

The above sequence means that, once a campaign year folder has been set up and the default CMakeLists.txt file copied into it, all that is necessary to start a new problem day is to create that days folder. If it follows the naming convention then doing a CMake clean reconfigure will populate the new folder with the basic starting files and have the executable registered with CMake.

Of course, once the CMakeLists.txt files are created then the user is free to re-configure them to their individual needs.

I realise that this is probably overkill for coding Advent of Code problems and a simple command line instruction would probably be sufficient. But maybe for some of you, like me, it may help a little way in understanding how the [cpp-best-practices](https://github.com/cpp-best-practices/cmake_template) template works.

Happy coding and I hope this at least takes some of the burden of setting up the build system away.
Happy coding and I hope this at least takes some of the burden of setting up the build system away.

0 comments on commit 950c94d

Please sign in to comment.