Skip to content

FloofyPlasma/smelt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smelt

A fast, simple build tool for C projects. Inspired by cargo. Just add a smelt.toml

Warning

Work in progress. Not ready for production use.

Features

  • Simple TOML manifest
  • Incremental builds with content hashing
  • Parallel compilation
  • Git, pkg-config and local dependency management
  • Lockfile support for dependency pinning
  • Debug/release profiles
  • compile_commands.json generation for compatible LSP

Installation

git clone https://github.com/floofyplasma/smelt
cd smelt
gcc src/cmd/build.c src/cmd/ccflags.c src/cmd/clean.c src/cmd/init.c \
    src/core/process_posix.c src/core/stringvec.c src/pkg/deps.c \
    src/pkg/registry.c src/project/cache.c src/project/compdb.c src/project/lock.c \
    src/project/manifest.c src/main.c vendor/tomlc17.c vendor/xxhash.c vendor/ya_getopt.c \
    -Isrc -Ivendor -std=c17 -o smelt

Usage

smelt init          # scaffold new project
smelt build         # debug build (default)
smelt build release # release build
smelt run           # build and run
smelt clean         # remove build artifacts
smelt update        # re-fetch dependencies
smelt add <url> <file1> [file2 ...]  # add git dependency
smelt add --pkg-config <name>        # add pkg-config dependency
smelt add <local/path>               # add local smelt-aware dependency

Dependencies

Git dependency (header-only or source drop-in)

smelt add https://github.com/Cyan4973/xxHash xxhash.h xxhash.c
smelt add https://github.com/cktan/tomlc17 src/tomlc17. src/tomlc17.h

Files are copied to vendor/, .c files auto-added to build, vendor/ auto-added to include paths.

Local dependency (smelt-aware)

If a local library has its own smelt.toml, smelt reads it automatically:

smelt add ../mylib

Sources are compiled incrementally alongside your project.

pkg-config dependency

smelt add --pkg-config sdl2

Include flags and linker flags are automatically applied.

Roadmap

  • smelt test command
  • Package registry with build recipes for some popular libs (SDL3, raylib, sqlite, etc.)

License

MIT, see LICENSE for details.

About

A fast, simple build tool for C projects. Inspired by cargo. Just add a smelt.toml

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages