Skip to content

AntumDeluge/bin2header

Repository files navigation

Binary to Header

Description

Converter for binary files to C/C++ headers.

bin2header takes any file as an argument and converts its binary data into a source header file for use in C/C++ applications. The data is stored as a character array.

See manpage for usage information.

Licensing

MIT

Downloads

Building

CMake (recommended)

To configure & build run cmake <path_to_source> && cmake --build ./.

Example of building from source root directory:

cmake ./ && cmake --build ./

Example of building from sub-directory in source root:

mkdir build
cd build
cmake ../ && cmake --build ./

After building is complete, files can be installed with:

cmake --install ./

To get a list of available CMake configuration options run cmake -LA <path_to_source>.

Notable CMake configuration options:

  • CMAKE_INSTALL_PREFIX: target directory where files are installed with cmake --install
  • STATIC: link to dependencies statically (default: OFF, native only)
  • EMBED_ICON: (Windows only) add icon resource to PE32 executable (default: OFF, native only)
  • NATIVE: build native executable (set to "OFF" to configure for Python script) (default: ON)

Example of building on Windows with MinGW:

mkdir build-win32 && cd build-win32
cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DSTATIC=ON -DEMBED_ICON=ON ../
cmake --build ./
cmake --install ./

'configure' Script

USAGE: ./configure [--help] [--type=TYPE] [--static]

Options:
--help        Show this help text
--type=TYPE   Set to "b" (default) for binary executable "s" for Python script
--static      Create statically linked executable (binary only)
  • To build native binary, run: ./configure && make
  • To build static native binary, run: ./configure --static && make
  • To build python version, run: ./configure --type=s && make

Acknowledgements

See: list of contributors

This project uses cxxopts.