C
Library can be either be used as a STB↗ style single header library1 or as a linked library.
Tested compilers:
- gcc >= 13.3.0
- clang >= 18.1.3
- MSVC >= 19.44.35219.0
Include in a project
Library can be also directly included as in cmake a project.
In an existing project either clone it
git clone https://github.com/Imn0/timber.git libs/timber
or add as a submodule
git submodule add https://github.com/Imn0/timber.git libs/timber
Example CMakeLists.txt to link with a static version
add_subdirectory(libs/timber)
target_link_libraries(${PROJECT_NAME} timber::static)
Single header
-
download
tmb.hfile and place it in your source tree.wget https://raw.githubusercontent.com/Imn0/timber/refs/heads/master/include/tmb/tmb.h -
then use it as follows
#define TMB_LOGGING_IMPLEMENTATION
#include "tmb.h"
int main(void) {
LOG_ERROR("Cannot build river");
}
#define TMB_LOGGING_IMPLEMENTATION is needed in only one .c file, generally your main.
In every other file just include the tmb.h
System install
-
Clone the repository
git clone https://github.com/Imn0/timber.git
cd timber -
Setup cmake
mkdir build
cd build
cmake ..to change the install prefix
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/home/$USER/opt/ -
Compile and install
cmake --build . --target installthen link as normal