Skip to content

Support tool for for easy-to-use, C/C++ libraries that can be effortlessly installed via NPM.

License

Notifications You must be signed in to change notification settings

nodef/cpoach.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

cpoach is a support tool designed to simplify the use of single-file C/C++ libraries. These libraries can be effortlessly installed via npm, making it easier to integrate them into your projects without the hassle of managing build systems (rather, just like #include <stdio.h>), and without including the third-party libraries into the project's version control. This is mainly to facilitate in-class demonstrations and assignments.

The name cpoach is a playful nod to the idea of poaching awesome C/C++ libraries and making them easily accessible for educational purposes. Many of these libraries are listed in r-lyeh/single_file_libs, fffaraz/awesome-cpp, or p-ranav/awesome-hpp. I was listening to Eskil Steenberg's talk on Advanced C, which you should also look into. He also has a collection of C libraries that you may want to explore.

Issues or suggestions regarding a specific library should be directed to the original library repository. However, for issues to the cpoach project, please open an issue here.


Usage

To install cpoach, use the following command:

$ npm i -g cpoach.sh

After installation, you can include the desired libraries in your C/C++ projects. For example, if you want to use the tigr.c library for graphics, follow these steps:

Run:

$ npm i tigr.c

And then include tigr.h as follows:

// main.c
#define TIGR_IMPLEMENTATION
#include <tigr.h>

int main() { /* ... */ }

And then compile with clang or gcc as usual.

$ clang $(cpoach i) main.c  # or, use gcc
$ gcc   $(cpoach i) main.c

Documentation

$ cpoach [command] [options]

Usage: cpoach [command] [options]

Commands:
  i | includes         Generate compiler flags for include paths.

Options:
  --compiler [name]    Specify the compiler (msvc, gcc, clang). Default is gcc.
  --msvc               Shortcut for --compiler msvc.
  --gcc                Shortcut for --compiler gcc.
  --clang              Shortcut for --compiler clang.
  --help               Display help information.


Available Libraries

Below is a categorized list of single-file C/C++ libraries available through the cpoach project:

🍳 Army knives
Package Description
βš™οΈ boost.cxx A collection of high-quality, free, and open-source libraries that extend the functionality of the C++ programming language; Dawes et al. (1998).
βš™οΈ stb.c stb single-file public domain libraries for C/C++; Sean Barrett (2014).
βš™οΈ plibsys.c Highly portable C system library: threads and synchronization primitives, sockets (TCP, UDP, SCTP), IPv4 and IPv6, IPC, hash functions (MD5, SHA-1, SHA-2, SHA-3, GOST), binary trees (RB, AVL) and more. Native code performance; Alexander Saprykin (2010).
βš™οΈ libgb.c gb single-file public domain libraries for C & C++; gingerBill (2015).
βŒ› prideout.c single-file C libraries from Philip Allan Rideout; Philip Rideout (2015).

🍳 High Performance Computing (HPC)
Package Description
βš™οΈ taskflow.cxx A General-purpose Task-parallel Programming System using Modern C++; Tsung-Wei Huang (2018).
βš™οΈ subprocess.c 🐜 Single header process launching solution for C and C++; Neil Henning (2017).
βš™οΈ tinycthread.c Small, portable implementation of the C11 threads API; Evan Nemerson (2012).
βš™οΈ pthreads4w.c POSIX threads API for Windows from https://sourceforge.net/p/pthreads4w; Ben Elliston (1998).
βš™οΈ minicoro.c Single header stackful cross-platform coroutine library in pure C; Eduardo Bart (2021).
βš™οΈ cds_sync.c Single-header C90 collection of synchronization primitives; Cort Stratton (2015).
βš™οΈ buddy_alloc.c A single header buddy memory allocator for C & C++; Stanislav Paskalev (2021).
βš™οΈ rfft.c Reasonably fast Fourier transform in a single header for C and C++; grego (2023).
βš™οΈ xxhash.c Extremely fast non-cryptographic hash algorithm; Yann Collet (2012).
βš™οΈ linmath.c A lean linear math library, aimed at graphics programming. Supports vec3, vec4, mat4x4 and quaternions; Wolfgang Draxinger (2013).
βš™οΈ algebra3.cxx Vector utilities for 2, 3, and 4 element vectors, all inline; Jean-Francois Doue, Paul S. Heckbert, and J. Nagle (1993).
βš™οΈ stb_stats.c Single header file with a bunch of useful statistical functions such as ANOVA, Kruskal-Wallis, T-test, etc; Gerben Voshol (2018).
βš™οΈ cxxgraph.cxx Header-Only C++ Library for Graph Representation and Algorithms; ZigRazor (2020).
βŒ› opencl.c C/C++ language headers for the OpenCL API; The Khronos Group (2013).
βŒ› clew.c The OpenCL Extension Wrangler Library; Martijn Berger (XXXX).
βŒ› bikeshed.c Lock free hierarchical work scheduler; Dan Engelbrecht (2019).
βŒ› jemalloc.c jemalloc is a general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support; Jason Evans (XXXX).
βŒ› genann.c simple neural network library in ANSI C; Lewis Van Winkle (2016).
βŒ› kann.c A lightweight C library for artificial neural networks; Attractive Chaos (2016).
βŒ› robin-map.cxx C++ implementation of a fast hash map and hash set using robin hood hashing; Thibaut Goetghebuer-Planchon (XXXX).
βŒ› uthash.c C macros for hash tables and more; Troy D. Hanson (2005).
βŒ› cephes.c Mirror of the Cephes C source for reference; Stephen L. Moshier (XXXX).
βŒ› hypatia.c A header-only, pure-C math library for 2D/3D graphics (matrix, vector, quaternion) Seeks to be close to C89/C90 compliant for portability. It's like a BLAS, but easier to use; Darryl T. Agostinelli (2015).
βŒ› handmademath.c A simple math library for games and computer graphics. Compatible with both C and C++. Public domain and easy to modify; Ben Visness (2016).
βŒ› ccvector.c A vector and matrix math library; Job Talle (2015).
βŒ› doops.c Single C file event loop; Eduard Suica (2019).
βŒ› ranxoshi256.c Portable, single-file, PRNG library implementing the xoshiro256** algorithm; BareRose (2018).
βŒ› uuid4.c UUID v4 generation in C; GrΓ©gory Pakosz (2019).
βŒ› uuid_h.c Single file, STB-style, "lib" to generate uuid:s; Fredrik Kihlander (2016).
βŒ› range-v3.cxx Range library for C++14/17/20, basis for C++20's std::ranges; Eric Niebler (XXXX).

🍳 Computer Graphics
Package Description
βš™οΈ clay.c High performance UI layout library in C; Nic Barker (2024).
βš™οΈ nuklear.c A single-header ANSI C immediate mode cross-platform GUI library; Micha Mettke (2015).
βš™οΈ microui.c A tiny immediate-mode UI library; rxi (2018).
βš™οΈ tigr.c TIGR - the TIny GRaphics library for Windows, macOS, Linux, iOS and Android.
βš™οΈ rgfw.c A cross platform lightweight single-header simple-to-use window abstraction library for creating graphical programs or libraries; Riley Mabb (2023).
βš™οΈ glfw3.c A multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop; Marcus Geelnard (2002).
βš™οΈ glad.c Vulkan/GL/GLES/EGL/GLX/WGL Loader based on the official specs, using glad by David Herberth (2013).
βš™οΈ vulkan.c Vulkan header files and API registry; The Khronos Group (2018).
βš™οΈ egl.c EGL API and Extension Registry; The Khronos Group (2016).
βš™οΈ voxelizer.c Header only mesh voxelizer in c99; Karim Naaji (2016).
βŒ› sdl3.c Simple DirectMedia Layer; Sam Lantinga (1997).
βŒ› openvr.c OpenVR SDK; Valve Software (XXXX).
βŒ› openmodal.c Dependency free, cross-platform, single header lib to open native file modals; bzt (2023).
βŒ› tinyfiledialogs.c Modal dia logs inc. file open/save (Win/Mac/Linux); Guillaume Vareille (2014).
βŒ› lightmapper.c A C/C++ single-file library for drop-in lightmap baking. Just use your existing OpenGL renderer to bounce light; ands (2016).
βŒ› sdl3.c Simple DirectMedia Layer; Sam Lantinga (1997).
βŒ› glew.c The OpenGL Extension Wrangler Library; Milan Ikits and Marcelo Magallon (2002).
βŒ› rfont.c Simple-to-use single header modular font rendering library written in C; Riley Mabb (2023).

🍳 Terminal utilities
Package Description
βš™οΈ indicators.cxx Activity Indicators for Modern C++; Pranav (2019).
βš™οΈ rang.cxx A Minimal, Header only Modern c++ library for terminal goodies; Abhinav Gauniyal (2016).
βš™οΈ termcolor.cxx Termcolor is a header-only C++ library for printing colored messages to the terminal. Written just for fun with a help of the Force; Ihor Kalnytskyi (2013).
βš™οΈ linenoise.c A small self-contained alternative to readline and libedit; Salvatore Sanfilippo (2010).
βš™οΈ parg.c Parser for argv that works similarly to getopt; JΓΈrgen Ibsen (2015).
βš™οΈ parg.cxx A header only c++ library for parsing command line arguments and generating usage/help output; Brett Robinson (2018).
βš™οΈ cmdline.cxx A Command Line Parser; Hideyuki Tanaka (2009).

🍳 Video
Package Description
βš™οΈ pl_mpeg.c Single file C library for decoding MPEG1 Video and MP2 Audio; Dominic Szablewski (2019).
βŒ› jo_mpeg.c Simple, Minimalistic, No Allocations MPEG writer - without audio; Jon Olick and Wladislav Artsimovich (2016).

🍳 Audio
Package Description
βš™οΈ miniaudio.c Audio playback and capture library written in C, in a single source file; David Reid (2016).
βš™οΈ minimp3.c Minimalistic MP3 decoder single header library; Lion (2018).
βŒ› dr_libs.c Audio decoding libraries for C/C++, each in a single source file; David Reid (2015).
βŒ› tflac.c A single file, freestanding FLAC encoding library in C89; John Regan (2024).
βŒ› pocketmod.c Small ANSI C library for turning ProTracker MOD files into playable PCM audio; rombankzero (2018).
βŒ› atomix.c Portable, single-file, wait-free atomic sound mixing library utilizing SSE-accelerated mixing; BareRose (2018).

🍳 Networking
Package Description
βš™οΈ httplib.cxx A C++ header-only HTTP/HTTPS server and client library; yhirose (2012).
βŒ› crow.cxx A Fast and Easy to use microframework for the web; Jaeseung Ha (2014).
βŒ› mongoose.c Embedded web server, with TCP/IP network stack, MQTT and Websocket; Cesanta Software (2010).
βŒ› webby.c A tiny webserver for game development; Andreas Fredriksson (2012).
βŒ› concord.c A Discord API wrapper library made in C; Cogmasters (2020).

🍳 Compression
Package Description
βš™οΈ lz4.c Extremely Fast Compression algorithm; lz4 (2011).
βš™οΈ zlib.c A massively spiffy yet delicately unobtrusive compression library; Mark Adler (2011).
βš™οΈ dmc_unrar.c A dependency-free, single-file FLOSS unrar library; Sven Hesse (2017).
βŒ› microtar.c A lightweight tar library written in ANSI C; rxi (2016).
βŒ› miniz.c miniz: Single C source file zlib-replacement library, originally from code.google.com/p/miniz; Rich Geldreich (2011).

🍳 Cryptography
Package Description
βŒ› monocypher.c An easy to use, easy to deploy crypto library; Loup Vaillant (2016).

🍳 Serialization
Package Description
βš™οΈ parson.c Lightweight JSON library written in C; Krzysztof Gabis (2012).
βš™οΈ mini.cxx INI file reader and writer; Danijel Durakovic (2018).
βš™οΈ lurlparser.cxx Lightweight URL & URI parser (RFC 1738, RFC 3986); Sergey Kosarevsky (2015).
βŒ› inih.c Simple .INI file parser in C, good for embedded systems; Ben Hoyt (2009).
βŒ› yxml.c Yxml is a small (6 KiB) non-validating yet mostly conforming XML parser written in C; Yorhel (2013).
βŒ› tiny-json.c The tiny-json is a versatile and easy to use json parser in C suitable for embedded systems. It is fast, robust and portable; Rafa Garcia (XXXX).
βŒ› model3d.c 3D model format specification and single header SDK. Supports skeletal animations, voxels and has the best data density; bzt (2019).
βŒ› tinyobjloader.c Header only tiny wavefront .obj loader in pure C99; Syoyo Fujita (2016).
βŒ› fast_obj.c Fast C OBJ parser; Richard Knight (2018).
βŒ› cgltf.c πŸ’  Single-file glTF 2.0 loader and writer written in C99; Johannes Kuhlmann (2018).
βŒ› qr-code-generator.c High-quality QR Code generator library in Java, TypeScript/JavaScript, Python, Rust, C++, C; Nayuki (2016).
βŒ› cmp.c An implementation of the MessagePack serialization format in C / msgpack.org; Charlie Gunyon (2014).
βŒ› libcmdf.c Single-header library for writing CLI applications in C/C++; Ronen Kreimer (2017).
βŒ› kgflags.c kgflags is an easy to use command-line flag parsing library; Krzysztof Gabis (2020).

🍳 Text Processing
Package Description
βš™οΈ peglib.cxx A single file C++ header-only PEG (Parsing Expression Grammars) library; yhirose (2015).
βš™οΈ remimu.c Single-file header-only regex engine, C99/C++11; Alexander Nadeau (2024).
βš™οΈ slre.c Super Light Regular Expressions; Aquefir (2013).
βš™οΈ unformat.cxx Fastest type-safe parsing library in the world for C++14 or C++17 (up to 300x faster than std::regex); Adam Yaxley (2017).
βš™οΈ ggformat.cxx A string formatting library for C++; Michael Savage (2017).
βš™οΈ utf8.c πŸ“š Single header utf8 string functions for C and C++; Neil Henning (2015).
βš™οΈ utf8proc.c A clean C library for processing UTF-8 Unicode data; Steven G. Johnson (2014).
βš™οΈ wcwidth9.c Platform independent, header only, wcwidth with full unicode 9 support; Joshua Rubin (2016).
βŒ› str.c str: yet another string library for C language; Maxim (2020).
βŒ› csplit.c A single header C library to simplify splitting and processing strings; Jakub Wlodek (2019).
βŒ› stmr.c Porter Stemmer algorithm in C; Titus (2014).
βŒ› levenshtein.c Levenshtein algorithm in C; Titus (2015).
βŒ› fmt.cxx A modern formatting library; Victor Zverovich (XXXX)

🍳 Emulation/Scripting
Package Description
βš™οΈ pocketpy.c Portable Python 3.x Interpreter in Modern C for Game Scripting; pocketpy (2022).
βš™οΈ minilua.c Single-file port of Lua, a powerful scripting language; Eduardo Bart (2020).
βš™οΈ my_basic.c A lightweight BASIC interpreter written in standard C in dual files. Aims to be embeddable, extendable and portable; Tony Wang (2014).
βš™οΈ tinyexpr.c Tiny recursive descent expression parser, compiler, and evaluation engine for math expressions; Lewis Van Winkle (2016).
βš™οΈ chasm.c Chasm Runtime Assembler; Aqil Contractor (2025).
βŒ› webview.c Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa) and Edge WebView2 (Windows); Serge Zaitsev (2017).
βŒ› fex.cxx A fast usermode x86 and x86-64 emulator for Arm64 Linux; Ryan Houdek (XXXX).
βŒ› vixl.c AArch32 and AArch64 Runtime Code Generation Library; Linaro (XXXX).
βŒ› v86.c x86 PC emulator and x86-to-wasm JIT, running in the browser; Fabian (XXXX).
βŒ› agnes.c NES emulation library with an easy to use API; Krzysztof Gabis (2019).
βŒ› apelang.c Ape Programming Language; Krzysztof Gabis (2020).
βŒ› softfloat3.c SoftFloat release 3; John Hauser (XXXX).

🍳 Testing/Debugging
Package Description
βš™οΈ debugbreak.c Break into the debugger programmatically; Scott Tsai (2011).
βš™οΈ b_stacktrace.c A minimalistic single-header multi-platform C89 lib for stack tracing; Borislav Stanimirov (2020).
βš™οΈ clove-unit.c Single-Header Unit Testing framework for C (interoperable with C++) with test autodiscovery feature; Federico De Felici (2021).
βš™οΈ rexo.c Neat single-file cross-platform unit testing framework for C/C++; Christopher Crouzet (2018).
βŒ› remotery.c Single C file, Realtime CPU/GPU Profiler with Remote Web Viewer; Celtoys (2014).
βŒ› tracy.cxx Frame profiler; Bartosz Taudul (XXXX).
βŒ› errnoname.c errnoname is a C library that lets us get the symbolic name for each errno integer value; mentalisttraceur (2019).
βŒ› fctx.c C unit testing in a header (works for C++ too!); Ian Blumel (2008).
βŒ› greatest.c A C testing library in 1 file. No dependencies, no dynamic allocation. ISC licensed; Scott Vokes (2012).
βŒ› utest.c πŸ§ͺ single header unit testing framework for C and C++; Neil Henning (2015).
βŒ› minctest.c tiny unit testing framework for ANSI C; Lewis Van Winkle (2015).
βŒ› labrat.c Simple, single-file test harness for C/C++; Alex Thayer (2016).
βŒ› munit.c Β΅nit is a small testing framework for C; Evan Nemerson (2016).

🍳 Others
Package Description
βš™οΈ units.cxx A compile-time, header-only, dimensional analysis and unit conversion library built on C++14 with no dependencies; Nic Holthaus (2016).
βš™οΈ magic_enum.cxx Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code; Daniil Goncharov (2019).
βš™οΈ nameof.cxx Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum; Daniil Goncharov (2016).
βš™οΈ scope_guard.cxx Scope Guard & Defer C++; Daniil Goncharov (2018).
βš™οΈ semver.cxx Semantic Versioning for modern C++; Daniil Goncharov (2018).
βš™οΈ hedley.c A C/C++ header to help move #ifdefs out of your code; Evan Nemerson (2016).
βš™οΈ catch2.cxx A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch); Martin HoΕ™eňovskΓ½ (2010).
βš™οΈ macroarg.c Manage arguments of macros in C.
βŒ› endianness.c Simple public domain header to get endianess at compile time on a variety of platforms; rofl0r (2017).
βŒ› asap.cxx A C++ header-only library for creating, displaying, iterating and manipulating dates; Leonardo Guilherme de Freitas (2017).
βŒ› canvas_ity.cxx A tiny, single-header canvas-like 2D rasterizer for C++; Andrew Kensler (2022).
βŒ› cds_job.cxx C++11 lock-free job queue; Cort Stratton (2016).
βŒ› cimg.cxx The CImg Library is a small and open-source C++ toolkit for image processing; GREYC (2018).
βŒ› cista.cxx Cista is a simple, high-performance, zero-copy C++ serialization & reflection library; Felix GΓΌndling (2018).
βŒ› cpp-mmaplib.cxx A single file C++11 header-only memory mapped file library; yhirose (2016).
βŒ› cpp-unicodelib.cxx A C++17 header-only Unicode library. (Unicode 16.0.0); yhirose (2016).
βŒ› debug-draw.cxx Immediate-mode, renderer agnostic, lightweight debug drawing API; Guilherme Lampert (2015).
βŒ› doctest.cxx The fastest feature-rich C++11/14/17/20/23 single-header testing framework; Viktor Kirilov (2016).
βŒ› flags.cxx β›³ Simple, extensible, header-only C++17 argument parser released into the public domain; sailormoon (2016).
βŒ› hippomocks.cxx Single-header mocking framework; Peter Bindels (2008).
βŒ› imgui.cxx Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies; Omar (2014).
βŒ› immediate2d.cxx A C++ drawing framework for Windows that makes simple graphics programming as fun and easy as the days when computers booted directly to a BASIC prompt; Nicholas Piegdon (2017).
βŒ› inja.cxx A Template Engine for Modern C++; Berscheid (2017).
βŒ› jargsparser.cxx A head-only arguments parser(argsparser) c++11 lib; Zhengqiao Wang (2022).
βŒ› json.cxx JSON for Modern C++; Niels Lohmann (2013).
βŒ› linalg.cxx linalg.h is a single header, public domain, short vector math library for C++; Sterling Orsten (2016).
βŒ› lurlparser.cxx Lightweight URL & URI parser (RFC 1738, RFC 3986); Sergey Kosarevsky (2015).
βŒ› micropather.cxx MicroPather is a path finder and A* solver (astar or a-star) written in platform independent C++ that can be easily integrated into existing code. MicroPather focuses on being a path finding engine for video games but is a generic A* solver; Lee Thomason (2012).
βŒ› microprofile.cxx microprofile is an embeddable profiler; Jonas Meyer (2013).
βŒ› mini-yaml.cxx Single header YAML 1.0 C++11 serializer/deserializer; Jimmie Bergmann (2018).
βŒ› obfuscate.cxx Guaranteed compile-time string literal obfuscation header-only library for C++14; Adam Yaxley (2017).
βŒ› programoptions.cxx Single-header program options parsing library for C++11; Fytch (2017).
βŒ› pugixml.cxx Light-weight, simple and fast XML parser for C++ with XPath support; Arseny Kapoulkine (2006).
βŒ› random.cxx Random for modern C++ with convenient API; Illia (2017).
βŒ› simple-svg.cxx Easy to use SVG library for C++ (fork of legacy Google code project archive); Adi Shavit (2015).
βŒ› str_view.cxx Null-termination-aware string-view class for C++; Adam Sawicki (2018).
βŒ› str.cxx Lightweight C++ string type with a configurable local buffer; Omar (2015).
βŒ› swarmz.cxx A free, header-only C++ swarming (flocking) library for real-time applications; Michael (2016).
βŒ› tinyformat.cxx Minimal, type safe printf replacement library for C++; Claire Foster (2011).
βŒ› tinyobjloader.cxx Tiny but powerful single file wavefront obj loader; tinyobjloader (2012).
βŒ› tinyply.cxx 🌍 C++11 ply 3d mesh format importer & exporter; Dimitri Diakopoulos (2015).
βŒ› tinythread.cxx Cross-platform implementation of the C++11 Threads API; Marcus Geelnard (2010).
βŒ› tinyxml2.cxx TinyXML2 is a simple, small, efficient, C++ XML parser that can be easily integrated into other programs; Lee Thomason (2011).
βŒ› tomlplusplus.cxx Header-only TOML config file parser and serializer for C++17; Mark Gillard (2020).
βŒ› trompeloeil.cxx Header only C++14 mocking framework; BjΓΆrn Fahller (2014).
βŒ› utl.cxx Collection of self-contained header-only libraries for C++17; DmitriBogdanov (2023).
βŒ› visit_struct.cxx A miniature library for struct-field reflection in C++; Chris Beck (2016).
βŒ› vulkanmemoryallocator.cxx Easy to integrate Vulkan memory allocation library; GPUOpen Libraries & SDKs (2017).
βŒ› xatlas.cxx Mesh parameterization / UV unwrapping library; Jonathan Young (2016).




ORG

About

Support tool for for easy-to-use, C/C++ libraries that can be effortlessly installed via NPM.

Resources

License

Stars

Watchers

Forks

Contributors