A CLI tool to bundle / amagamate C/C++ files into a single file.
This tool helps in renaming symbols (functions, variables, types) in C/C++ source files to avoid name collisions when bundling / amalgamating multiple source files into one. It uses libclang to parse the source files and generate a CSV file listing all symbols, which can then be edited to specify new names for the symbols. Finally, it produces a bundled source file with the renamed symbols. It currently works on Windows, and requires amalgamate.exe (from rindeal/Amalgamate) to be installed.
$ npm i -g bundle-cxx.sh$ bundle-cxx [options] <command> [args]
Commands:
list-symbols <source-file> Generate a Symbols CSV file from the source file.
bundle <source-file> Bundle the source file by renaming symbols and amalgamating.
Options:
--help Show this help information.
-c, --csv <symbols-file> Specify the Symbols CSV file path.
-o, --output <output-file> Specify the output file path.
<args> Additional arguments for libclang or amalgamate.# Generate a Symbols CSV file from a source file.
$ bundle-cxx list-symbols mysource.cxx --csv mysource_symbols.csv -DMYSOURCE_IMPLEMENTATION
# Now edit `mysource_symbols.csv` to rename symbols as needed.
# The `filename_line` in the CSV indicates where each symbol is defined.
# The `display_name` is the original symbol name.
# The `new_display_name` is where you can specify the new name for the symbol.
# Finally, bundle the source file using the edited Symbols CSV file.
$ bundle-cxx bundle mysource.cxx -c mysource_symbols.csv -o mysource_bundled.cxx