gdpm/bin/compile.sh
David J. Allen 5a73651ad1 Major refactor and API changes
- Updated `.gitignore` file
- Updated `CMakeLists.txt` to build static exectuable
- Changed some `Doxyfile` configurations to build more robust and complete documentation (WIP)
- Changed how `remote` works to better reflect `git`'s API (WIP)
- Changed how error handling works
- Improved `bin/compile.sh` script
- Improved `bin/lines.sh` script (kinda)
- Removed some instances of `fmt` in favor of `std` string functions
- Restructed style for better readibility
2023-05-22 17:54:45 -06:00

56 lines
1.2 KiB
Bash
Executable file

#!/bin/sh
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
exe=gdpm
static=gdpm.static
tests=gdpm.tests
function test_link(){
path=$1
link=$2
if test -f "$path"
then
echo "Creating link from '$path' to '$link')"
if test -f "$link"
then
rm $link
fi
ln -s $path $link
fi
}
function test_strip(){
path=$1
if test -f "$path"
then
echo "Stripping debug symbols from '$path'"
strip "$path"
fi
}
# 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)
# 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
# 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