More refactoring and bug fixes

- Added `libhttp` and `librest_api` targets to CMakeLists.txt
- Added examples for `libhttp` and `librest_api` in examples directory
- Added `cache` and `add` commands
- Added documentation for `libhttp` and `librest_api`
- Added all available HTTP response codes to REST API
- Changed how `bin/compile.sh` works (must supply args to build)
This commit is contained in:
David Allen 2023-05-27 11:28:58 -06:00
parent 5a73651ad1
commit 8b1f1374d8
23 changed files with 575 additions and 164 deletions

View file

@ -5,7 +5,7 @@ exe=gdpm
static=gdpm.static
tests=gdpm.tests
function test_link(){
function link_exe(){
path=$1
link=$2
if test -f "$path"
@ -19,7 +19,7 @@ function test_link(){
fi
}
function test_strip(){
function strip(){
path=$1
if test -f "$path"
then
@ -28,29 +28,65 @@ function test_strip(){
fi
}
function generate_docs(){
# Generate documentation using `doxygen`
cd ${script_dir}/..
doxygen
}
function strip_all(){
# Strip debug symbols
strip ${script_dir}/../build/gdpm
strip ${script_dir}/../build/gdpm.static
strip ${script_dir}/../build/gdpm.tests
}
function link_all(){
# Create symlinks to executables in build folder if necessary
link_exe $script_dir/../build/gdpm $script_dir/../bin/$exe
link_exe $script_dir/../build/gdpm.static $script_dir/../bin/$static
link_exe $script_dir/../build/gdpm.tests $script_dir/../bin/$tests
}
function clean(){
rm ${script_dir}/../bin/$exe
rm ${script_dir}/../bin/$static
rm ${script_dir}/../bin/$tests
}
# Run this script at project root
#meson configure build
#CXX=clang++ meson compile -C build -j$(proc)
# CMake/ninja build system
mkdir -p build
cmake -B build -S . -D CMAKE_EXPORT_COMPILE_COMMANDS=1 -D CMAKE_BUILD_TYPE=Debug -G Ninja
ninja -C build -j $(nproc)
function build_binaries(){
mkdir -p build
cmake -B build -S . -D CMAKE_EXPORT_COMPILE_COMMANDS=1 -D CMAKE_BUILD_TYPE=Debug -G Ninja
ninja -C build -j $(nproc)
}
# Create symlinks to executables in build folder if necessary
test_link $script_dir/../build/gdpm $script_dir/../bin/$exe
test_link $script_dir/../build/gdpm.static $script_dir/../bin/$static
test_link $script_dir/../build/gdpm.tests $script_dir/../bin/$tests
# Stop if no args
if [ $# -eq 0 ]
then
exit 1
fi
# Handle arguemnts passed in
i=$(($#-1))
while [ $i -ge 0 ];
do
case "$1" in
-a|--all) build_binaries shift;;
-c|--clean) clean shift;;
-d|--docs) generate_docs shift;;
-s|--strip) strip_all shift;;
-l|--link) link_all shift;;
--*) echo "Bad option: $1"
esac
i=$((i-1))
done
exit 0
# Strip debug symbols
test_strip ${script_dir}/../build/gdpm
test_strip ${script_dir}/../build/gdpm.static
test_strip ${script_dir}/../build/gdpm.tests
# Generate documentation using `doxygen`
cd ${script_dir}/..
doxygen