Skip to content

assembler-0/autocc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

85 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ AUTOCC

A fast, minimal low-level build system with intelligent target management

License Version Build Status


๐ŸŽŠ What's new? (v0.1.6-2)

  • Optimization - Introduce parallel processing to many functions.
  • Enhanced execution pipeline - Safer and faster execution.
  • Added target types - Extend capability for future upgrades.
  • Refactored codebase - A Cleaner, more efficient codebase.
  • Added new fields in user configuration - Adapting new changes.
  • Install targets safer - Smarter installation.

โœจ Features

  • ๐ŸŽฏ Incremental Builds - For lightning fast rebuilds
  • โšก Parallel Compilation - Multi-threaded compilation by default
  • ๐ŸŽช Multi-Target Support - Build multiple targets from a single project with target-specific configurations
  • โœ… Multi-Target Type - Build multiple executable/dynamic libraries/static libraries from a single file;
  • ๐Ÿ”ง Smart Auto-detection - Automatically discovers local headers, system libraries, and build targets
  • ๐Ÿ“Š Extensible Knowledge Base - Uses JSON database for library detection rules that update without recompilation
  • ๐Ÿง  Pre-Compiled Headers - Automatically generates PCH for common headers to speed up compilation
  • ๐ŸŽฏ Target Discovery - Intelligently discovers main() functions and suggests build targets
  • ๐Ÿค– Automated setup - with autoconfig setting up a project becomes easy
  • โœ… TUI-Based selector - using edit to edit configuration files without any external edtior

๐Ÿƒโ€โ™‚๏ธ Quick Start

Prerequisites

cmake >= 3.30
C++23 standard support 
fmt library
xxhash library
OpenSSL library
git

Installation

# Clone the repository
git clone https://github.com/assembler-0/autocc.git
cd autocc

# Build with cmake
mkdir build && cd build
cmake .. && make # -DWALL=ON for all possible warnings -DARM=ON for no optimization -DNUSE_TUI=ON for disabling ftxui

# Or if you already have autocc:
autocc setup && autocc

ZSH autocompletion

# to install _autocc completetion for zsh, in the project ROOT, run:
chmod + x ./zsh/install.sh && ./zsh/install.sh 
# to uninstall
chmod + x ./zsh/install.sh && ./zsh/uninstall.sh 

target_compile_definitions()

target_compile_definitions(autocc PUBLIC
        # -DLOG_DISABLE -- disable logging
        # -DLOG_DISABLE_INFO -- disable info
        # -DLOG_DISABLE_COLORS -- disable colors
        -DLOG_ENABLE_FILE # -- enable file logging
        # -DLOG_DISABLE_TIMESTAMP -- disable timestamps
        # -DVERBOSE -- enable verbose logging
)

๐Ÿ“‹ Sample Workflow

1. Initial Setup & Target Discovery

# Generate config with intelligent target discovery
autocc autoconfig   # or 'autocc ac', use --default to skip all and use builtin configuration
# This will:
# - Scan your project for main() functions
# - Suggest build targets automatically
# - Detect headers and libraries
# - Create autocc.toml with smart defaults
autocc edit # or 'autocc select'
# this edits sources to build

2. Sync Configuration

autocc setup       # or 'autocc sync' or 'autocc sc'
# Converts autocc.toml to internal build cache

3. Build Your Project

# Build default target
autocc

# Build specific target
autocc my_target

# Build with target name
autocc test_suite

4. Install your project

# install default target (may need root privileges)
autocc install # for default target
# install specific target 
autocc install my_target
# install all targets 
autocc install <target> --prefix=<path to install> # to install to a specific path

โš™๏ธ Configuration (autocc.toml)

Basic Configuration

# AUTOCC 0.1.6
# CONFIGURATION FILE 'autocc.toml' IS WRITTEN BY AUTOCC 0.1.6, MAKE SURE YOU HAVE AN APPROPRIATE AUTOCC BUILD.
# COPYRIGHT (C) assembler-0 2025
[compilers]
ar = 'ar'  # your archiver
as = 'nasm'  # your assembler
cc = 'clang'  # your C compiler
cxx = 'clang++' # your C++ compiler
launcher = 'ccache' # your launcer
sl = 'clang++'  # your dynamic linker

[features]
use_pch = true  # use precompiled header

[paths]
exclude_patterns = []  # global exclude pattern
include_dirs = [ 'include', '.', 'include/imgui', 'include/imgui/backends' ] # global include directories

[project]
build_dir = '.autocc_build'  # project build directory
default_target = 'sift' # default target

[[targets]]
cflags = '-std=c11' # cflags
cxxflags = '-std=c++23' # c++ flags
exclude_patterns = [] # target exclude patten
external_libs = [ '-ldl', '-lz', '-llzma', '-lpthread', '-lm', '-lglfw', '-lGL' ] # external library
ldflags = '' # Linker flags
main_file = './src/main.cpp' # main file
name = 'main' # target name
output_name = 'main' # target output name
sources = [
    './asm/3np1.asm',
    './asm/aesDEC.asm',
    './asm/aesENC.asm',
    './asm/avx.asm',
    './asm/branch.asm',
    # snip...
    './src/lzma.module.cpp',
    './src/main.cpp',
    './src/systemMonitor.manage.cpp'
]
type = 'SLibrary' # Or 'Executable' 'SLibrary' 'DLlibrary'

โœ… Available Commands

AutoCC 0.1.6-2 compiled on Aug  5 2025 at 13:14:43

Usage: autocc [command] (target_name)

Commands:
  <none> or <target>   Builds the default target, or a specified target.
  ac/autoconfig        Creates 'autocc.toml' via an interactive prompt.
  setup/sync/sc        Converts 'autocc.toml' to the internal build cache.
  edit/select          Open a TUI to visually select source files for targets (could be disabled).
  clean                Removes the build directory.
  wipe                 Removes all autocc generated files (cache, build dir, db).
  fetch                Download/update the library detection database.
  version              Show current version and build date.
  help                 Shows this help message.
  install <target>     Install specified target to system binary dir.
Flags:
  --default            For 'autocc autoconfig', use default settings.
  --prefix             For 'autocc install', install to a specific path.

๐ŸŽฏ Target System

AutoCC's target system allows you to build multiple executables from a single project:

Automatic Target Discovery

  • Main Detection: Scans for main() functions automatically
  • Pattern Recognition: Identifies test files, benchmark files, etc.
  • Smart Suggestions: Recommends source files for each target
  • Interactive Setup: Guides you through target configuration

Target Features

  • Isolated Builds: Each target compiles only its specified sources
  • Custom Output Names: Different executable names per target
  • Target-Specific Excludes: Fine-grained control over what gets compiled
  • Default Target: Set which target builds with just autocc

๐Ÿค Contributing

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and test thoroughly
  4. Ensure all targets build: autocc test && autocc benchmark
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to your branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Project Structure

autocc/
โ”œโ”€โ”€ zsh/    
โ”‚   โ”œโ”€โ”€ install.sh           # Install script for _autocc
โ”‚   โ”œโ”€โ”€ uninstall.sh         # Uninstall script for _autocc
โ”‚   โ””โ”€โ”€ _autocc              # auto suggestions for zsh
โ”œโ”€โ”€ include/       
โ”‚   โ”œโ”€โ”€ httplib.h            # http for downloading
โ”‚   โ”œโ”€โ”€ json.hpp             # json for caching and db
โ”‚   โ”œโ”€โ”€ toml.hpp             # toml for config
โ”‚   โ”œโ”€โ”€ utils.hpp            # Utility functions
โ”‚   โ””โ”€โ”€ log.hpp              # Logging system
โ”œโ”€โ”€ autocc.cc                # autocc main C++ file
โ”œโ”€โ”€ autocc.base.json         # Library detection database
โ”œโ”€โ”€ pvs.sh                   # Shell script for PVS-Studio static analyzer
โ”œโ”€โ”€ autocc.toml              # Autocc configuration
โ”œโ”€โ”€ CMakeLists.txt           # CMake configuration
โ””โ”€โ”€ ...                      # Misc. files

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.


๐Ÿ“ž Support


โญ Star this project if you find it helpful!

About

A fast, minimal and automatic build system for C/C++

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

โšก