To install the lib just copy the Amalgamation into your project and include it in your code:
#include "CWebStudioOne.c"
If you are on Linux, you can download the lib with:
curl -L https://github.com/OUIsolutions/CWebStudio/releases/download/4.0.0/CWebStudioOne.c -o CWebStudioOne.c
To compile the lib in Linux you can use the following command:
gcc main.c -o your_output.out
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
For building from scratch you need to have darwin installed on your machine. To install darwin:
curl -L https://github.com/OUIsolutions/Darwin/releases/download/0.13.0/darwin_linux_bin.out -o darwin.out && chmod +x darwin.out && sudo mv darwin.out /usr/local/bin/darwin
Then you can build the project with in the root dir of the project:
darwin install
darwin run_blueprint --target all
of if you are building in dir mode , you can just perform the silverchain organization and macro builds with:
It will generate all the releases in the /release dir.
darwin install
darwin run_blueprint --target dir_project
The following defines toggle dependencies or just the definitions. It is useful for working with dynamic compilation or mocking dependencies.
// unallow universal socket definition
#define CWEB_MOCK_UNIVERSAL_SOCKET_DEFINE
// unallow universal socket at all
#define CWEB_MOCK_UNIVERSAL_SOCKET
// unallow cjson at all
// NOTE: Hiding CJSON will force the lib to use **get_addrinfo** which
// can leak memory in some cases.
#define CWEB_MOCK_CJSON
// unallow cjson definition
#define CWEB_MOCK_CJSON_DEFINE
// unallow universal garbage collector
#define CWEB_MOCK_UNIVERSAL_GARBAGE
// unallow universal garbage collector definition
#define CWEB_MOCK_UNIVERSAL_GARBAGE_DEFINE
// import the lib only after the flags
#include "CWebStudioOne.c"