All Projects → vittorioromeo → unosolo

vittorioromeo / unosolo

Licence: MIT license
Work-in-progress Rust application that converts C++ header-only libraries to single self-contained headers.

Programming Languages

rust
11053 projects
shell
77523 projects

Projects that are alternatives of or similar to unosolo

SimpleCLI
Command Line Interface Library for Arduino
Stars: ✭ 197 (+657.69%)
Mutual labels:  command, line
google streetview
A command line tool and module for Google Street View Image API
Stars: ✭ 77 (+196.15%)
Mutual labels:  command, line
colortest
Quickly show all your terminal colors
Stars: ✭ 66 (+153.85%)
Mutual labels:  command, line
Habitctl
Minimalist command line tool you can use to track and examine your habits.
Stars: ✭ 277 (+965.38%)
Mutual labels:  command, line
Bash Argsparse
An high level argument parsing library for bash
Stars: ✭ 128 (+392.31%)
Mutual labels:  command, line
Neodoc
Beautiful, hand-crafted commandline interfaces for node.js
Stars: ✭ 221 (+750%)
Mutual labels:  command, line
ucollage
An extensible command line image viewer inspired by vim
Stars: ✭ 161 (+519.23%)
Mutual labels:  command, line
Python
Python cheatsheet
Stars: ✭ 25 (-3.85%)
Mutual labels:  command, line
Gql
Very simple CLI for many GraphQL schemas in the cloud. Provides autocompletion for GraphQL queries
Stars: ✭ 101 (+288.46%)
Mutual labels:  command, line
Simplecli
Command Line Interface Library for Arduino
Stars: ✭ 135 (+419.23%)
Mutual labels:  command, line
gab-cmdline
A GABStudios Java library to help with command line parsing.
Stars: ✭ 12 (-53.85%)
Mutual labels:  command, line
CHRLINE
LINE Chrome API
Stars: ✭ 41 (+57.69%)
Mutual labels:  line
RustPlus-Discord-Bot
This is an NodeJS Discord Bot that uses the rustplus.js to interact with Smart Devices in the PC game Rust.
Stars: ✭ 23 (-11.54%)
Mutual labels:  command
Caliburn.Light
The magic-free Caliburn.Light, a powerful framework designed for building applications across current XAML platforms.
Stars: ✭ 64 (+146.15%)
Mutual labels:  command
pyne
LINE for Python
Stars: ✭ 18 (-30.77%)
Mutual labels:  line
comment-box.nvim
✨ Clarify and beautify your comments using boxes and lines.
Stars: ✭ 91 (+250%)
Mutual labels:  line
edit
A stand-alone implementation of the Acme text editor's command language.
Stars: ✭ 29 (+11.54%)
Mutual labels:  command
LINE-Source
Line Application Source
Stars: ✭ 43 (+65.38%)
Mutual labels:  line
artisan-aliases
Save keystrokes and run Artisan commands your way
Stars: ✭ 23 (-11.54%)
Mutual labels:  command
linenotify
Template for LINE Notify service in Golang
Stars: ✭ 18 (-30.77%)
Mutual labels:  line

unosolo

Work-in-progress Rust application that converts C++ header-only libraries to single self-contained headers.

stability license gratipay badge.rust

Disclaimer

This is my first Rust project, mainly created to start getting used to the language. My intention is to improve unosolo as I get better with Rust and the final goal is being able to successfully use it on popular libraries. (If you need a full-fledged customizable preprocessor implementation, check out pcpp.)

I also do not encourage people to create single-header libraries and use those in their projects: they're mainly useful when dealing with very complicated build systems or when experimenting on an online compiler that doesn't allow users to easily import multiple files.

Contributions and code reviews are welcome!

Build instructions

git clone https://github.com/SuperV1234/unosolo
cd unosolo
cargo build
  • cargo run -- args... can be used to build&run unosolo.

  • cargo install can be used to install unosolo on the user's system.

Overview

Given a set of paths containing the C++ header-only library's header files and a "top-level include" file where the graph traversal will start from, unosolo outputs a self-contained single-header version of the library to stdout. Here's the clap-rs auto-generated help:

unosolo 0.1.1
Vittorio Romeo <[email protected]>
transforms a C++ header-only library in a self-contained single header.

USAGE:
    unosolo [FLAGS] [OPTIONS] --topinclude <top_include>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information
    -v, --verbose    Enable verbose mode

OPTIONS:
    -p, --paths <paths>...            Include paths [default: .]
    -t, --topinclude <top_include>    Top-level include file path (entrypoint)

Use cases

scelta

unosolo is currently able to transform scelta, my latest C++17 header-only library, to a single-header version. In fact, I've used unosolo to add two badges to scelta's README that allow users to try the library either on wandbox or on godbolt. This idea was taken from Michael Park's excellent variant implementation: mpark::variant.

The command used to transform scelta was:

unosolo -p"./scelta/include" -v -t"./scelta/include/scelta.hpp" > scelta_single_header.hpp

It produced this abomination.

vrm_core and vrm_pp

Since 0.1.1, unosolo supports multiple library include paths and "absolute #include directives". My vrm_core library, which depends on vrm_pp, can be transformed to a single header as follows:

git clone https://github.com/SuperV1234/vrm_pp.git
git clone https://github.com/SuperV1234/vrm_core.git
unosolo -p"./vrm_pp/include" "./vrm_core/include" -t"./vrm_core/include/vrm/core.hpp" > vrm_core_sh.hpp

It produced this beauty.

boost::hana

A single-header version of boost::hana can be created using unosolo as follows:

git clone https://github.com/boostorg/hana
unosolo -p"./hana/include" -t"./hana/include/boost/hana.hpp" > hana_sh.hpp

I haven't tested it very thorougly, but I compiled the example on hana's README without any hiccups.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].