A project setup tool for C/C++ projects using make and criterion.
Clone for first installation. You can delete the directory afterwards.
$ git clone https://github.com/GlysVenture/metamake
$ cd metamake
$ make install
[optional]
$ rm -rf ../metamake
if this doesn't work it means you probably don't have a $HOME/.local/bin directory and you don't have access to /usr/bin. Just create $HOME/.local/bin and rerun make install
To update simply do
$ metamake --update
usages:
metamake [options] <new_project_dir>
options:
-n --name <executable_name>
-c --compiler <compiler>
-cpp
metamake [options]
options:
--help
--update
ProjectDirectory
├── Makefile
├── bin
├── include
├── libs
│ ├── Makefile
│ └── some_library
├── src
│ └── main.c
└── tests
├── Makefile
├── criterion-v2.3.2
└── tests.c
Makefile has basic $(NAME), all, clean, fclean and re rules
All source files in src are compiled. Build files are kept in a temporary build directory. Binaries are kept in bin directory
release rule recompiles all with -O3 and -march=native flags
libs directory is where libraries live. Each library should have its own directory with same exact name (excluding lib and .a). Each of these directories should have a Makfile with a default rule that compiles the lib or no Makefile but an .a file. They need also to have .h/.hpp files located in ./include
tests dir is where tests are run and criterion lives. If you do make tests all *.c/.cpp files in the tests directory will be compiled and ran one after the other. An example file with Test is present, but you should check out the criterion repo.
run rule runs the binary. all compiles, tests and then runs.
This is a one and done kind of utility. It is not a build tool. It just sets up Makefiles and directories, maintenance and changes are up to you.
-
Libs implementation might be untested -> to test
-
Only works with static libs (.a archives) -> add better lib struct for all kinds (.a, .so, .dylib, from source or not)
-
Includes are in ./include -> Includes in src or outside?
-
Windows implementation??? (use wsl people!)
-
multiple binaries?
-
only binary project available now -> lib project structure?