AutoCMakefileGenerator generates can generate a Makefile as well as a simple Debugging Setup for C and C++ automatically based on a small configuration json file.
Features
The extension adds a new command to your VSCode that allows you to automatically generate a very basic Makefile for your C and C++ Applications, just based on a small bit of json you have to provide. It can also generate a simple debugging setup in VSCode.
Create a 'autoMakefile.json' in your workspace root directory.
Add all the necessary information:
lang: The language of your application | 'c' or 'cpp'
name: The name of your output file, which will be created in the root directory | any valid filename as string
flags: The compiler flags you want to attach to the compiler call | an array of any compiler flag without the -
output: The path of the directory where all the .o files will be stored. If the given directory does not exist it will be created. | any valid directory path as string
libs: The paths to any valid libraries you want to attach to the compiler call. | an array of any valid paths to external libraries
dirs: All the paths to directories which contain source code eiter directly or in a subdirecotry | an array of any valid directory names
Run the 'Generate Makefile'-Command by pressing Crtl + Shift + P (Cmd + Shift + P on Mac).
If everything is correct there should be Makefile generated in your project root directory.
Run 'make' in your terminal to compile all your specified source code into a single file also in your project root directory.
'make clean' removes all .o and output files.
To generate the Debugging Setup run the 'Enable Debugging'-Command by pressing Crtl + Shift + P (Cmd + Shift + P on Mac) For this to work there must already be an autoMakefile.json and you have to set the '-g' compiler flag.
A '.vscode' Folder should have been created in your root directory, containing a 'launch.json' and a 'tasks.json'.
The Debugging should now be startable by going to the 'Run and Debug'-Tab in VSCode.
Example Config JSON
Known Issues
This Extension does not work on Windows, as it utalizes a unix only command. It is also only tested in single folder workspaces. The debugging setup may not work on other operating systems, than MacOS, which was the only test platform.
Release Notes
1.0.1
Initial release of AutoCMakefileGenerator
1.0.2
Minor Bug Fixes
1.0.3
Fixed CPP Makefile Template
1.0.4
Added CPP Library Support and Compiler Flag Config Option