A small and lightweight C starter application.
- A Hight level programming based on Cello.
- A package manager implemented with CLib.
- A Basic unitTest with asserts.
- A documentation template (not up to date).
The project structure :
.
├── build.sh
├── cello_install.sh
├── clib_install.sh
├── doc
│ └── index.html
├── README.md
├── run.sh
├── run_tests.sh
├── src
│ ├── func.c
│ ├── headers
│ │ └── func.h
│ └── main.c
└── tests
├── assert.h
└── tests.c
Works only for Linux users (Ubuntu/Debian), you just have to run :
# First install cello
bash ./cello_install.sh
# or
make install-cello
# Then install clib
# clib is a packet manager for c libraries
bash ./clib_install.sh
# or
make install-clib
# To search a C-library
# clib search [package-name]
# -
# To Install the C-library
# clib install <user>/<repo>
To build your app in ./src
, you just have to run :
sh ./build.sh
# app.bin will be generated, now you can run it by hitting :
./dist/app.bin
# or make run, will build and execute it
make dev
# replace dev by prod to have an optimized portable executable with no debug logs
A Documentation template is in ./doc
and will be updated !
I implemented a basic assert method in tests to performs some tests on methods in ./src/func.c
, you just have to run :
bash ./run_tests.sh
# Expected ouutput :
# [+] -----------------------------------------------
# [+] Start tests...
# [+]
# [+] > 'test_helloworld()' passed successfully,
# [+] ===============================================
# [+] Reports 1/1 tests passed !
# [+] -----------------------------------------------
Otherwhise, you can use cmocka
, an elegant unit testing framework for C with support for mock objects; install it by running:
# After installed clib
clib install cmocka
Note : You don't need this in this project, it just show you how to create a CLib if you want to !
If you want to create a C-Lib library, you just have to put in the root of your repo a package.json
file with this kind of structure :
{
"name": "repo",
"author": "darker",
"version": "0.0.1",
"repo": "<user>/<repo>",
"description": "The description",
"keywords": ["some", "keywords"],
"license": "MIT",
"src": ["src/main.c", "src/main.h"]
}
- Sanix-darker