build_and_install.md
April 3, 2025 ยท View on GitHub
Install
To install the lib just copy the Amalgamation into your project and include it in your code:
#include "CHashManipulatorOne.c"
If you are on Linux, you can download the lib with:
curl -L https://github.com/OUIsolutions/CHashManipulator/releases/download/0.2.0/CHashManipulatorOne.c -o CHASH_MANIPULATORStudioOne.c
Compile on Linux
To compile the lib in Linux you can use the following command:
gcc main.c -o your_output.out
Compile on Windows
To compile the lib in Windows you can use the following commands
With Microsoft Visual C:
cl.exe examples\example_simple.c /Fe:bin\example_simple.exe
With mingw64:
i686-w64-mingw32-gcc examples\example_simple.c -o bin\example_simple.exe -lws2_32
Build from scratch
For buiding from scratch you need to have darwin installed on your machine. To install darwin:
curl -L https://github.com/OUIsolutions/Darwin/releases/download/0.2.0/darwin.out -o darwin.out && chmod +x darwin.out && sudo mv darwin.out /usr/bin/darwin
Then you can build the project with in the root dir of the project:
darwin run_blueprint build/ --mode folder
It will generate all the releases in the /release dir.
Mocking dependencies or dependencies implementations
The following defines toggle dependencies or just the definitions. It is useful for working with dynamic compilation or mocking dependencies.
// unallow cjson at all
// NOTE: Hiding CJSON will force the lib to use **get_addrinfo** which
// can leak memory in some cases.
#define CHASH_MANIPULATOR_MOCK_CJSON
// unallow cjson definition
#define CHASH_MANIPULATOR_MOCK_CJSON_DEFINE
// unallow CTextEngine
#define CHASH_MANIPULATOR_MOCK_CTEXT_ENGINE
// unallow CTextEngine definition
#define CHASH_MANIPULATOR_MOCK_CJSON_DEFINE
//import the lib only after the flags
#include "CHashManipulatorOne.c"