A small C/C++ Builder
Project description
bbee
Very simple C - C++ Builder
I wrote this little script to help me out with little C or C++ codes.
It basically crawls for sources, compiles and links the objects either to executable binary or to static library. (I love static libraries)
Sometimes I do not want to spend time writing Makefile scripts
thus while sending some sample codes to ppl, I include this.
This has a little convention so as long as you keep the convention, things will be successfully built.
Please note that, I did not wrote this little tiny script for big and complex projects, stick to cmake or autotools if you are planning to write sth complex.
Other than that, this script would do the job for you as well;
Quick Start
Simple run the command below to create an empty C project. This will create an empty directory tree with includes, build and source directory as well as a capul.json file already configured. You can create your main.c inside source directory and start by calling bbee command to compile and run.
bbee --create
Or run the command below to create an empty C++ project
bbee --create++
Parameters:
Field Name | Option | Type | Description | Example |
---|---|---|---|---|
name | str | Name of the project | "sample" | |
builder | str | Builder command | "gcc" or "/usr/bin/gcc-7" | |
sources | list | List of sources (directory or files) | ["./source", "main.c"] | |
includes | list | List of includes (dir or files) | ["./include", "/usr/local/includes"] | |
libraries | list | List of libraries to link | ["pthread", "GL", "m"] | |
frameworks | list | List of frameworks to link (MacOS) | ["OpenGL", "GLUT"] | |
library_search_paths | list | List of library directories | ["./libs", "/usr/local/lib"] | |
output | library / binary | str | Output format, binary exec. or a lib | "binary" |
output_dir | str | Where to put the output file(s) | "build" | |
output_name | str | Output file name | "hello_world" or "libmylib.a" | |
cflags | str | gcc extra flags | "-std=gnu99 -Wall -Werror -O3 -g" | |
debug | true / false | bool | BBee Debug Mode on / off | false |
source_extension | str | Extension to crawl for compiling | ".c" | |
run_after_build | bool | Run the binary output file after | false | |
install | list | List of installation directives | See below at "how to make install" |
How to make install
Creating an installation directive is quite easy, just tell what to copy and where to copy it.
If target directory name starts with ! then it will be created with "mkdir -p" command
# This example will copy build/hello_world to /usr/local/bin
[
["build/hello_world", "/usr/local/bin"]
]
# This example will try to copy build/hello_world to first directory it can verify
# if the directory does not exists, it will try the next directory in the list
[
["build/hello_world", ["/usr/local/bin", "/usr/bin"]]
]
# This will copy the headers include folder to includes and copy the library to libs
[
["./includes", "!/usr/local/includes/mylib"],
["build/libmylib.a", ["/usr/local/lib", "/usr/lib"]]
]
Here is a sample capul.json file
{
"name": "Hello World",
"builder": "gcc",
"sources": [
"./src"
],
"includes": [
"./include"
],
"libraries": [
"pthread"
],
"library_search_paths": [
"/usr/local/lib"
],
"frameworks": [
"OpenGL",
"GLUT"
],
"output": "binary",
"output_dir": "build",
"output_name": "hello_world",
"cflags": "",
"debug": true,
"source_extension": ".c",
"run_after_build": False
}
Note: just "sources", "output" fields are mandatory, others are optional.
If you want to contribute, please keep the code a single file and pep8 should pass without errors or warnings .
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.