Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A straight-forward build tool.

Building from source

You only need a C++ compiler, and some patience, the project is made of one source file that includes multiple header files with implementation in them:

g++ src/main.cc -o mkc

If you have a mkc instance already then compile it using the mkc instance you have by running:

mkc

The output binary file will be at build/nur.

You can add more optimization:

g++ src/main.cc -o mkc -O3
# Or
mkc -O 3

CLI options

Usage: mkc [options]

Config:
  init                    Create example config and initialize current directory
  --config <file>         Load configuration from file
  --watch                 Watch project directory for changes and rebuild.
  --run                   Run the executable after compilation
  --exclude <file>        Exclude directory or specific file
  --exclude-fmt           Exclude a file extension (eg: .c)
  -r, --root <dir>        Set project root directory (default: .)
  -o, --output <name>     Specify output executable name
  -j, --jobs <num>        Number of parallel compilation jobs
  -c, --clean             Rebuild all files

Compiler Options:
  --compiler <compiler>   Specify compiler (default: g++)
  -I <dir>                Add include directory
  -D <define>             Add preprocessor define
  -O <level>              Optimization level (0, 1, 2, 3, s)
  -f <flag>               Add compiler flag
  -l <lib>                Link library
  -L <dir>                Add library search path
  --unity <name>          Set unity build to true, auto-generate translation unit
  --link-flags            Add arbitrary flags for the linker
  --shared                Use when creating a shared object

Log Options:
  -h, --help              Show this help message
  -s, --silent            Suppress all non-error output
  -v, --verbose           Enable verbose logging
  -d, --debug-log         Enable debug logging (highest verbosity)
  --error-nums            Enable line number in build error log
  --benchmark             Print time elapsed while building
  --dry-run               Scan, print sources & headers, and exit
  --dry-run-toml          Scan and print sources in toml array format
  --benchmark-msg         Note to be added beside benchmark in the logfile
  --immediate             Force flushing all logs

Examples:
  mkc -j 4 -O 3                  # Parallel release build with -O3
  mkc --watch --run             # Watch, rebuild and run on changes

Example mkc_config.toml

# mkc example config file
# Generated by command: mkc init

[project]
# Compiler to use (g++, clang++, gcc, etc..)
compiler = "g++"
# Name used for final executables or library
target_name = "app" 
# Enable unity build. 
# Automatically generates a unity file combining all sources into one compilation unit.
unity_build = false
# Build as shared library (.so) instead of executable
shared = false
# Compilation flags
compile_flags = [
  "-std=c++23",
  "-Wall",
  "-Wextra",
  "-O2",           # Optimization
  "-g",            # Debug symbols
  "-fsanitize=address"  # AddressSanitizer
]
# Linker flags
link_flags = [
  "-lpthread",     # Link pthread
  "-lm",           # Link math library
  "-fsanitize=address"  # Must match compile flags
]
[paths]
# Explicitly list source files (optional, overrides auto-discovery)
sources = [
  "src/main.cpp",
  "src/utils.cpp"
]
# Added as -I when compiling objects
includes = [
  "include",
  "third_party/some_lib/include"
]
# Directories or specific files to exclude from recursive scan.
exclude_dirs = [
  "examples",
  "tests"
]
# File extensions to exclude from recursive scan.
exclude_exts = [
  ".c"
]
# Static lib to be compiled as a dependency with the project
[[paths.static_lib]]
name = "mylib.a"
sources = ["../deps/foo.cpp", "../deps/bar.cpp"]
include_dirs = ["../deps/include"]
[pkg]
# pkg-config dependencies (e.g., GTK, SDL2)
deps = [
  "gtk4",
  "sdl2"
]

Releases

Packages

Contributors

Languages