{"id":13732340,"url":"https://github.com/vittorioromeo/unosolo","last_synced_at":"2025-03-25T04:31:25.494Z","repository":{"id":147654150,"uuid":"95361473","full_name":"vittorioromeo/unosolo","owner":"vittorioromeo","description":"Work-in-progress Rust application that converts C++ header-only libraries to single self-contained headers.","archived":false,"fork":false,"pushed_at":"2019-05-06T16:20:37.000Z","size":30,"stargazers_count":26,"open_issues_count":5,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-28T23:08:17.199Z","etag":null,"topics":["command","cpp","line","rust","tool"],"latest_commit_sha":null,"homepage":"https://vittorioromeo.info","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vittorioromeo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-06-25T13:29:36.000Z","updated_at":"2021-07-09T19:37:19.000Z","dependencies_parsed_at":"2023-04-09T07:15:29.738Z","dependency_job_id":null,"html_url":"https://github.com/vittorioromeo/unosolo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vittorioromeo%2Funosolo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vittorioromeo%2Funosolo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vittorioromeo%2Funosolo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vittorioromeo%2Funosolo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vittorioromeo","download_url":"https://codeload.github.com/vittorioromeo/unosolo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213757428,"owners_count":15634177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command","cpp","line","rust","tool"],"created_at":"2024-08-03T02:01:53.683Z","updated_at":"2024-08-03T02:09:27.620Z","avatar_url":"https://github.com/vittorioromeo.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# unosolo\n\n\u003e **Work-in-progress Rust application that converts C++ header-only libraries to single self-contained headers.**\n\n[![stability][badge.stability]][stability]\n[![license][badge.license]][license]\n[![gratipay][badge.gratipay]][gratipay]\n![badge.rust](https://img.shields.io/badge/rust-nightly-ff69b4.svg?style=flat-square)\n\n[badge.stability]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square\n[badge.license]: http://img.shields.io/badge/license-mit-blue.svg?style=flat-square\n[badge.gratipay]: https://img.shields.io/gratipay/user/SuperV1234.svg?style=flat-square\n\n[stability]: http://github.com/badges/stability-badges\n[license]: https://github.com/SuperV1234/unosolo/blob/master/LICENSE\n[gratipay]: https://gratipay.com/~SuperV1234/\n\n\n## Disclaimer\n\nThis 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](https://pypi.python.org/pypi/pcpp).)*\n\nI 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.\n\n*Contributions and code reviews are welcome!*\n\n\n\n## Build instructions\n\n```bash\ngit clone https://github.com/SuperV1234/unosolo\ncd unosolo\ncargo build\n```\n\n* `cargo run -- args...` can be used to build\u0026run `unosolo`.\n\n* `cargo install` can be used to install `unosolo` on the user's system.\n\n\n\n## Overview\n\nGiven 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`](https://github.com/kbknapp/clap-rs) auto-generated help:\n\n```\nunosolo 0.1.1\nVittorio Romeo \u003cvittorio.romeo@outlook.com\u003e\ntransforms a C++ header-only library in a self-contained single header.\n\nUSAGE:\n    unosolo [FLAGS] [OPTIONS] --topinclude \u003ctop_include\u003e\n\nFLAGS:\n    -h, --help       Prints help information\n    -V, --version    Prints version information\n    -v, --verbose    Enable verbose mode\n\nOPTIONS:\n    -p, --paths \u003cpaths\u003e...            Include paths [default: .]\n    -t, --topinclude \u003ctop_include\u003e    Top-level include file path (entrypoint)\n```\n\n\n## Use cases\n\n### `scelta`\n\n`unosolo` is currently able to transform [**`scelta`**](https://github.com/SuperV1234/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](https://wandbox.org/permlink/wSA55OCJz17k7Jtz) or [on godbolt](https://godbolt.org/g/4sQtkM). This idea was taken from Michael Park's excellent variant implementation: [`mpark::variant`](https://github.com/mpark/variant).\n\nThe command used to transform `scelta` was:\n\n```bash\nunosolo -p\"./scelta/include\" -v -t\"./scelta/include/scelta.hpp\" \u003e scelta_single_header.hpp\n```\n\nIt produced [this abomination](https://gist.github.com/SuperV1234/a5af0a8b92f75d83085a8e5fccf71d6a).\n\n\n\n### `vrm_core` and `vrm_pp`\n\nSince 0.1.1, `unosolo` supports multiple library include paths and \"absolute `#include` directives\". My [**`vrm_core`**](https://github.com/SuperV1234/vrm_core) library, which depends on [**`vrm_pp`**](https://github.com/SuperV1234/vrm_pp), can be transformed to a single header as follows:\n\n```bash\ngit clone https://github.com/SuperV1234/vrm_pp.git\ngit clone https://github.com/SuperV1234/vrm_core.git\nunosolo -p\"./vrm_pp/include\" \"./vrm_core/include\" -t\"./vrm_core/include/vrm/core.hpp\" \u003e vrm_core_sh.hpp\n```\n\nIt produced [this beauty](https://gist.github.com/SuperV1234/4f9ae8f99da72288c73ca643b101ed20).\n\n\n\n### `boost::hana`\n\nA single-header version of [**`boost::hana`**](https://github.com/boostorg/hana) can be created using `unosolo` as follows:\n\n```bash\ngit clone https://github.com/boostorg/hana\nunosolo -p\"./hana/include\" -t\"./hana/include/boost/hana.hpp\" \u003e hana_sh.hpp\n```\n\nI haven't tested it very thorougly, but I compiled [the example on `hana`'s README](https://github.com/boostorg/hana#overview) without any hiccups.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvittorioromeo%2Funosolo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvittorioromeo%2Funosolo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvittorioromeo%2Funosolo/lists"}