A tool I've made for project management (Creating/Building)
- Project configuration
- Different build strategies [
dummy,c_console,cpp_console,c_static_lib,c_shared_lib,cpp_static_lib,cpp_shared_lib]. The list can (and will) change over time - Project templates
- Compiler that supports C99
- Make
MPT Usage: mpt [command] [args]
| Command | Description |
|---|---|
| info | - Show current version |
| help | - Help command |
| gen-cf [target] | - Generate 'compile_flags.txt' based on 'flags' and 'includes' fields |
| build [target] | - Build target |
| run [target] | - Build and run target |
| template [template_name] [dir] | - Make template based on directory |
| new [template] [project name] | - Make new project from template |
TIP: if you don't need any output (besides errors) to be shown, add
--silentflag at the end of command
- Project configuration is stored in 'Project' file
- Project file syntax:
strategy="..."
[target_1]
compiler="..."
flags="..."
ldflags="..."
sources="dir1:dir2:dirn"
subprojects="dir1:dir2:dirn"
includes="dir1:dir2:dirn"
makedirs="dir1:dir2:dirn"
output="..."
post_cmd="..."
init_cmd="..."
[target_n]
...- Defaults for each parameter:
compiler="cc"
flags="-O3 -std=c23 -c"
ldflags="-O3"
sources="src"
includes=""
subprojects=""
makedirs="obj"
output="name of directory"
post_cmd=""
init_cmd=""NOTE:
- 'obj' directory must exist (unless you use 'dummy' build strategy)
- First parameter in any Project file must be 'strategy'
- Templates are stored in '/path/to/mpt/binary/templates'
- In this repository, there are such templates as:
c_console,cpp_consolec_shared_lib,cpp_shared_lib,c_static_lib,cpp_static_lib,c_raylib - Template syntax:
[dir1]
type="dir"
[dir1/dir2]
type="dir"
[dirN]
type="dir"
[file1]
type="file"
content="..."
[dir1/file1]
type="file"
content="..."
[dirN/.../fileN]
type="file"
content="..."
...NOTE:
- Directories are created EXACTLY in the same order as specified in template, not recursively
NOTE: MPT V1 makes process of making templates way easier using
mpt templatecommand.Let's say you have a directory with this structure and you want to turn it into template:
project1 ├── obj ├── Project └── src ├── main.c └── very_useful_functionality ├── test.c └── test.hNow you can just type this command:
$ mpt new my_awesome_template project1and MPT will create
my_awesome_templatefile with ready-to-use project template
- Linux
- Mac OS
- Windows
$ git clone https://github.com/Ict00/mpt$ cd mpt && makeNOTE: If you don't have
clanginstalled, change 'CC' field inMakefileto any other compiler you have (e.g,cc)
Step 3 (Optional). Put mpt binary (and templates directory) into directory that's listed in PATH variable (for better experience)
$ mpt new c_console my_awesome_c_project
$ cd my_awesome_c_project
$ mpt build
$ ./my_awesome_c_project # <- output binary (name and location can be changed in 'Project' file)