cbuild v7

This commit is contained in:
2024-02-22 01:15:34 +06:00
parent 14e103833a
commit 713c80a93d
18 changed files with 98 additions and 92 deletions

View File

@@ -1,6 +1,4 @@
#!/usr/bin/bash
for tmpfile in $(ls -a | grep -e '\.rebuild.*\.tmp'); do
try_delete_dir_or_file "$tmpfile"
done
try_delete_dir_or_file fonts/generated
try_delete_dir_or_file libs/fonts_embedded.a

View File

@@ -1,5 +1,4 @@
#!/bin/bash
cd fonts
SRC_C=""
HEADER="generated/fonts_embedded.h"
@@ -30,17 +29,12 @@ mkdir -p src/generated/
cp -v fonts/$HEADER src/$HEADER
myprint "${GREEN}font arrays external definitions have been written to ${CYAN}src/$HEADER"
# delete old objects
clean_dir "$OBJDIR/objects"
myprint "${BLUE}hiding libs"
mv "$OBJDIR/libs" "$OBJDIR/libs_"
mkdir -p "$OBJDIR/libs"
# compiling
compile_c "$C_ARGS" "$SRC_C"
pack_static_lib "$STATIC_LIB_FILE"
rm -rf $OUTDIR/fonts_embedded.a
myprint "${BLUE}restoring libs"
rm -rf "$OBJDIR/libs"
mv "$OBJDIR/libs_" "$OBJDIR/libs"
cp "$OBJDIR/out/fonts_embedded.a" libs/
myprint "$OBJDIR/out/fonts_embedded.a -> libs/"
# moving lib file
mv "$OUTDIR/$STATIC_LIB_FILE" libs/
mkdir -p "libs"
myprint "$OUTDIR/$STATIC_LIB_FILE -> libs/"

View File

@@ -1,35 +1,11 @@
#!/bin/bash
# if $lib_project.a doesn't exist or rebuild_* task was executed, builds static lib
function handle_static_dependency {
local lib_project="$1"
local lib_build_task="$2"
if [ ! -f "$OBJDIR/libs/$lib_project.a" ] || [ -f .rebuild_$lib_project.tmp ]; then
[[ -z "$lib_build_task" ]] && error "lib_build_task is empty"
myprint "${BLUE}making $lib_project task <$lib_build_task>"
cd $lib_project
if ! make "$lib_build_task"; then
exit 1
fi
cd ..
cp $lib_project/bin/$lib_project.a $OBJDIR/libs/
myprint "${GREEN}copied ${CYAN}$lib_project.a"
rm -f .rebuild_$lib_project.tmp
fi
}
# compile fonts
if [ ! -f libs/fonts_embedded.a ]; then
if ! make embed_fonts; then
exit 1
fi
fi
handle_static_dependency kerep $DEPS_BUILD_TASK
handle_static_dependency imgui $DEPS_BUILD_TASK
handle_static_dependency imgui-node-editor $DEPS_BUILD_TASK
handle_static_dependency imnodes $DEPS_BUILD_TASK
# copy all precompiled libs
cp libs/* $OBJDIR/libs/

View File

@@ -1,5 +0,0 @@
#!/bin/bash
source cbuild/colors.sh
source cbuild/functions.sh
touch ".rebuild_$1.tmp"
myprint "${YELLOW}$1.a will be rebuilt in the next build task"