Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amalgamation script, single-header cmake target & release script #42

Merged
merged 49 commits into from
Nov 14, 2024

Conversation

rsore
Copy link
Owner

@rsore rsore commented Nov 14, 2024

Description

The biggest feature of this development branch is the file amalgamate.py. It is responsible for analyzing the source headers of the project, resolving the correct topological ordering of them, and generating an amalgamated single-header version of the entire library. It accepts several command-line argument options for customizing the output.

I have also expanded the root CMakeLists.txt configuration. Previously there was a simple CLArgs interface target which made available all the headers of the library. Now, there are three targets; CLArgs_internal_source, CLArgs_internal_amalgamated and CLArgs. CLArgs_internal_source is the same as the previous CLArgs target. CLArgs_internal_amalgamated makes available the generated amalgamated header file containing the entirely library in one. To accomplish this I utilize CMake's execute_process(), add_custom_command() and add_custom_target() functions to make the header generation part of the build system.

Finally, I also implemented a release script. This script uses amalgamate.py as a python module to generate the amalgamated header file. It also generated a much simpler CMakeLists.txt, omitting any references to tests or examples and which only provides one target, CLArgs, which is the single-header version of the library. Additionally it includes a copy of the license, and the README file. This release script lives pretty isolated at the moment, but in the future I plan on creating a CI workflow that will use the script whenever a version tag is committed and release a new Github release for that version.

How Has This Been Tested?

  • All tests link with CLArgs_internal_source, and so the tests work the same as before. They all still pass.
  • The basic example has been adjusted to link with CLArgs_internal_amalgamated, showcasing the library used as a single-header library. This builds and runs the same as before
  • Client-code testing has been done manually with a test project, fetching the CLArgs library using CMake's FetchContent function.

rsore added 30 commits October 26, 2024 02:16
…d and CLArgs, the last of which is an alias for one of the other two, based on user-provided option
…nks with source or amalgamated conditionally
…bled with option --no-generated-file-warning
@rsore rsore added the feature New feature label Nov 14, 2024
Copy link

clang-tidy review says "All clean, LGTM! 👍"

@rsore rsore merged commit 0454e21 into main Nov 14, 2024
6 checks passed
@rsore rsore deleted the amalgamate branch November 14, 2024 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant