cbuild v7
This commit is contained in:
parent
14e103833a
commit
713c80a93d
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -13,7 +13,7 @@
|
|||||||
url = https://github.com/Timerix22/imgui.git
|
url = https://github.com/Timerix22/imgui.git
|
||||||
branch = docking_cbuild
|
branch = docking_cbuild
|
||||||
[submodule "imgui-node-editor"]
|
[submodule "imgui-node-editor"]
|
||||||
path = dependencies/imgui-node-editor
|
path = dependencies/imgui_node_editor
|
||||||
url = https://github.com/Timerix22/imgui-node-editor.git
|
url = https://github.com/Timerix22/imgui-node-editor.git
|
||||||
branch = develop_cbuild
|
branch = develop_cbuild
|
||||||
[submodule "imnodes"]
|
[submodule "imnodes"]
|
||||||
|
|||||||
55
Makefile
55
Makefile
@ -12,6 +12,31 @@ build_exec: rebuild_all # profile
|
|||||||
build_exec_dbg:
|
build_exec_dbg:
|
||||||
@cbuild/call_task.sh build_exec_dbg 2>&1 | tee make_raw.log
|
@cbuild/call_task.sh build_exec_dbg 2>&1 | tee make_raw.log
|
||||||
|
|
||||||
|
######################################
|
||||||
|
###### Rebuild dependencies #######
|
||||||
|
######################################
|
||||||
|
|
||||||
|
# recompile kerep.a in the next build task
|
||||||
|
rebuild_kerep:
|
||||||
|
@cbuild/rebuild_dep.sh libkerep.a 2>&1 | tee make_raw.log
|
||||||
|
|
||||||
|
# recompile imgui.a in the next build task
|
||||||
|
rebuild_imgui:
|
||||||
|
@cbuild/rebuild_dep.sh libimgui.a 2>&1 | tee make_raw.log
|
||||||
|
|
||||||
|
rebuild_imgui_node_editor:
|
||||||
|
@cbuild/rebuild_dep.sh libimgui-node-editor.a 2>&1 | tee make_raw.log
|
||||||
|
|
||||||
|
rebuild_imnodes:
|
||||||
|
@cbuild/rebuild_dep.sh libimnodes.a 2>&1 | tee make_raw.log
|
||||||
|
|
||||||
|
# writes ttf fonts fron ./fonts/ to C compressed arrays in C source files
|
||||||
|
# builds static library from font arrays definitions
|
||||||
|
embed_fonts:
|
||||||
|
@cbuild/call_task.sh embed_fonts
|
||||||
|
|
||||||
|
rebuild_all: rebuild_kerep rebuild_imgui rebuild_imgui_node_editor rebuild_imnodes embed_fonts
|
||||||
|
|
||||||
######################################
|
######################################
|
||||||
###### Launch tasks #######
|
###### Launch tasks #######
|
||||||
######################################
|
######################################
|
||||||
@ -33,10 +58,18 @@ profile:
|
|||||||
@cbuild/call_task.sh profile 2>&1 | tee make_raw.log
|
@cbuild/call_task.sh profile 2>&1 | tee make_raw.log
|
||||||
|
|
||||||
# compiles program with -pg and runs it with gprof
|
# compiles program with -pg and runs it with gprof
|
||||||
# uses gprof2dot python script to generate function call tree
|
# uses gprof2dot python script to generate function call tree (pip install gprof2dot)
|
||||||
|
# requires graphviz (https://www.graphviz.org/download/source/)
|
||||||
gprof:
|
gprof:
|
||||||
@cbuild/call_task.sh gprof 2>&1 | tee make_raw.log
|
@cbuild/call_task.sh gprof 2>&1 | tee make_raw.log
|
||||||
|
|
||||||
|
# compiles program and runs it with callgrind (part of valgrind)
|
||||||
|
# uses gprof2dot python script to generate function call tree (pip install gprof2dot)
|
||||||
|
# requires graphviz (https://www.graphviz.org/download/source/)
|
||||||
|
# P.S. detailed results can be viewed in KCacheGrind
|
||||||
|
callgrind:
|
||||||
|
@cbuild/call_task.sh callgrind 2>&1 | tee make_raw.log
|
||||||
|
|
||||||
# compiles executable with sanitizers and executes it to find errors and warnings
|
# compiles executable with sanitizers and executes it to find errors and warnings
|
||||||
sanitize:
|
sanitize:
|
||||||
@cbuild/call_task.sh sanitize 2>&1 | tee make_raw.log
|
@cbuild/call_task.sh sanitize 2>&1 | tee make_raw.log
|
||||||
@ -59,23 +92,3 @@ fix_log:
|
|||||||
| sed 's/ H //g' \
|
| sed 's/ H //g' \
|
||||||
| sed 's/\[3gH //g' \
|
| sed 's/\[3gH //g' \
|
||||||
> make_fixed.log
|
> make_fixed.log
|
||||||
|
|
||||||
# recompile kerep.a in the next build task
|
|
||||||
rebuild_kerep:
|
|
||||||
@tasks/rebuild_lib.sh kerep
|
|
||||||
|
|
||||||
# recompile imgui.a in the next build task
|
|
||||||
rebuild_imgui:
|
|
||||||
@tasks/rebuild_lib.sh imgui
|
|
||||||
|
|
||||||
rebuild_imgui-node-editor:
|
|
||||||
@tasks/rebuild_lib.sh imgui-node-editor
|
|
||||||
rebuild_imnodes:
|
|
||||||
@tasks/rebuild_lib.sh imnodes
|
|
||||||
|
|
||||||
# writes ttf fonts fron ./fonts/ to C compressed arrays in C source files
|
|
||||||
# builds static library from font arrays definitions
|
|
||||||
embed_fonts:
|
|
||||||
@cbuild/call_task.sh embed_fonts
|
|
||||||
|
|
||||||
rebuild_all: rebuild_kerep rebuild_imgui rebuild_imgui-node-editor rebuild_imnodes embed_fonts
|
|
||||||
|
|||||||
2
cbuild
2
cbuild
@ -1 +1 @@
|
|||||||
Subproject commit 60fa8c11c2673a10f8afbe37bcea13c9be3317b8
|
Subproject commit 574ce6eab3b65e05888adad95a0211f532dd1125
|
||||||
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
CBUILD_VERSION=6
|
CBUILD_VERSION=7
|
||||||
CONFIG_VERSION=4
|
CONFIG_VERSION=6
|
||||||
|
|
||||||
PROJECT="GraphC"
|
PROJECT="GraphC"
|
||||||
CMP_C="gcc"
|
CMP_C="gcc"
|
||||||
@ -14,6 +14,19 @@ SRC_CPP="$(find src -name '*.cpp')"
|
|||||||
#TESTS_C="$( find tests -name '*.c')"
|
#TESTS_C="$( find tests -name '*.c')"
|
||||||
#TESTS_CPP="$(find tests -name '*.cpp')"
|
#TESTS_CPP="$(find tests -name '*.cpp')"
|
||||||
|
|
||||||
|
# dir with dependeicy dirs
|
||||||
|
DEPS_BASEDIR="dependencies"
|
||||||
|
# EXAMPLE: "dependency_dir='build_task out_dir lib_file'
|
||||||
|
# other_depndency_dir=..."
|
||||||
|
# Dependencies must be declared on separate lines
|
||||||
|
# Values can be override by resetting one of dependencies:
|
||||||
|
# DEPS="$DEPS
|
||||||
|
# dependency_dir='...'"
|
||||||
|
DEPS="kerep='build_static_lib bin libkerep.a'
|
||||||
|
imgui='build_static_lib bin libimgui.a'
|
||||||
|
imnodes='build_static_lib bin libimnodes.a'
|
||||||
|
imgui_node_editor='build_static_lib bin libimgui-node-editor.a'"
|
||||||
|
|
||||||
# OBJDIR structure:
|
# OBJDIR structure:
|
||||||
# ├── objects - dir where compiled *.o files are stored. cleans every call of build task
|
# ├── objects - dir where compiled *.o files are stored. cleans every call of build task
|
||||||
# ├── profile - dir where gcc *.gcda profiling info files stored
|
# ├── profile - dir where gcc *.gcda profiling info files stored
|
||||||
@ -26,13 +39,13 @@ OUTDIR="bin"
|
|||||||
case "$OS" in
|
case "$OS" in
|
||||||
WINDOWS)
|
WINDOWS)
|
||||||
EXEC_FILE="$PROJECT.exe"
|
EXEC_FILE="$PROJECT.exe"
|
||||||
INCLUDE="-I./imgui -I/usr/include/SDL2"
|
INCLUDE="-I./dependencies/imgui -I./dependencies/SDL2/include"
|
||||||
LINKER_LIBS="-L./$OBJDIR/libs/ -lSDL2 -lopengl32"
|
LINKER_LIBS="-L./$OBJDIR/libs/ -lSDL2 -lopengl32 -lpthread -lws2_32"
|
||||||
;;
|
;;
|
||||||
LINUX)
|
LINUX)
|
||||||
EXEC_FILE="$PROJECT"
|
EXEC_FILE="$PROJECT"
|
||||||
INCLUDE="-I./imgui -I/usr/include/SDL2"
|
INCLUDE="-I./dependencies/imgui -I./dependencies/SDL2/include"
|
||||||
LINKER_LIBS="-lSDL2 -lGL"
|
LINKER_LIBS="-L./$OBJDIR/libs/ -lSDL2 -lGL"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
error "operating system $OS has no configuration variants"
|
error "operating system $OS has no configuration variants"
|
||||||
@ -126,11 +139,28 @@ case "$TASK" in
|
|||||||
POST_TASK_SCRIPT=cbuild/default_tasks/exec.sh
|
POST_TASK_SCRIPT=cbuild/default_tasks/exec.sh
|
||||||
DEPS_BUILD_TASK=build_static_lib
|
DEPS_BUILD_TASK=build_static_lib
|
||||||
;;
|
;;
|
||||||
|
# compiles program and runs it with callgrind (part of valgrind)
|
||||||
|
# uses gprof2dot python script to generate function call tree (pip install gprof2dot)
|
||||||
|
# requires graphviz (https://www.graphviz.org/download/source/)
|
||||||
|
# P.S. detailed results can be viewed in KCacheGrind
|
||||||
|
callgrind)
|
||||||
|
OUTDIR="$OUTDIR/callgrind"
|
||||||
|
# -pg adds code to executable, that generates file containing function call info (gmon.out)
|
||||||
|
C_ARGS="-O2 -flto=auto -fuse-linker-plugin"
|
||||||
|
CPP_ARGS="$C_ARGS"
|
||||||
|
LINKER_ARGS="$CPP_ARGS"
|
||||||
|
PRE_TASK_SCRIPT=tasks/pre_build.sh
|
||||||
|
TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
|
||||||
|
POST_TASK_SCRIPT=cbuild/default_tasks/callgrind.sh
|
||||||
|
;;
|
||||||
# deletes generated files
|
# deletes generated files
|
||||||
clean)
|
clean)
|
||||||
TASK_SCRIPT=cbuild/default_tasks/clean.sh
|
TASK_SCRIPT=cbuild/default_tasks/clean.sh
|
||||||
POST_TASK_SCRIPT=tasks/clean_additions.sh
|
POST_TASK_SCRIPT=tasks/clean_additions.sh
|
||||||
;;
|
;;
|
||||||
|
# nothing to do
|
||||||
|
no_task)
|
||||||
|
;;
|
||||||
# unknown task
|
# unknown task
|
||||||
*)
|
*)
|
||||||
error "task <$TASK> not found"
|
error "task <$TASK> not found"
|
||||||
|
|||||||
2
dependencies/imgui
vendored
2
dependencies/imgui
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 109735a0d10c55d95c569bae2aa4c2adbfcf9056
|
Subproject commit 00263d9c22ab255d1886493c7f058d9e22128dd3
|
||||||
1
dependencies/imgui-node-editor
vendored
1
dependencies/imgui-node-editor
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit 50ba2846746af233922da40694380fd090b304ab
|
|
||||||
1
dependencies/imgui_node_editor
vendored
Submodule
1
dependencies/imgui_node_editor
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 50f39362c22fb7d21312adb07cea66d56da3166a
|
||||||
2
dependencies/imnodes
vendored
2
dependencies/imnodes
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 1bff83fbd0fe749b28df5af6844ec0e036320305
|
Subproject commit 83af9066dbf8dceef44009ef21ac1d6d042db2a3
|
||||||
2
dependencies/kerep
vendored
2
dependencies/kerep
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 53cf9875e6785a30b2313cf294acb89061a92713
|
Subproject commit dd5788f72a909b602592da7861ba717d529be9f3
|
||||||
@ -4,7 +4,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../kerep/src/base/base.h"
|
#include "../../dependencies/kerep/src/base/base.h"
|
||||||
|
|
||||||
Maybe main_window_open(const char* window_title);
|
Maybe main_window_open(const char* window_title);
|
||||||
Maybe main_window_loop_start();
|
Maybe main_window_loop_start();
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "SDL2/SDL.h"
|
#include "../../dependencies/SDL2/include/SDL.h"
|
||||||
#include "SDL2/SDL_opengl.h"
|
#include "../../dependencies/SDL2/include/SDL_opengl.h"
|
||||||
#include "../../imgui/imgui.h"
|
#include "../../dependencies/imgui/imgui.h"
|
||||||
#include "../../imgui/backends/imgui_impl_sdl2.h"
|
#include "../../dependencies/imgui/backends/imgui_impl_sdl2.h"
|
||||||
#include "../../imgui/backends/imgui_impl_opengl3.h"
|
#include "../../dependencies/imgui/backends/imgui_impl_opengl3.h"
|
||||||
#include "../../kerep/src/Filesystem/filesystem.h"
|
#include "../../dependencies/kerep/src/Filesystem/filesystem.h"
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Fonts //
|
// Fonts //
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "gui_internal.hpp"
|
#include "gui_internal.hpp"
|
||||||
#include "../../imgui-node-editor/imgui_node_editor.h"
|
#include "../../dependencies/imgui_node_editor/imgui_node_editor.h"
|
||||||
namespace NE = ax::NodeEditor;
|
namespace NE = ax::NodeEditor;
|
||||||
|
|
||||||
NE::EditorContext* editor_context=nullptr;
|
NE::EditorContext* editor_context=nullptr;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "gui_internal.hpp"
|
#include "gui_internal.hpp"
|
||||||
#include "../../imnodes/imnodes.h"
|
#include "../../dependencies/imnodes/imnodes.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|||||||
10
src/main.c
10
src/main.c
@ -1,4 +1,4 @@
|
|||||||
#include "../kerep/src/base/base.h"
|
#include "../dependencies/kerep/src/base/base.h"
|
||||||
#include "gui/gui.h"
|
#include "gui/gui.h"
|
||||||
|
|
||||||
void kt_initGraphCTypes(){
|
void kt_initGraphCTypes(){
|
||||||
@ -9,7 +9,7 @@ int main(const int argc, const char* const* argv){
|
|||||||
if(setlocale(LC_CTYPE, "C.UTF-8")!=0)
|
if(setlocale(LC_CTYPE, "C.UTF-8")!=0)
|
||||||
kprintf("\e[93msetlocale failed!\n");
|
kprintf("\e[93msetlocale failed!\n");
|
||||||
|
|
||||||
kt_beginInit();
|
kt_beginInit(true);
|
||||||
kt_initKerepTypes();
|
kt_initKerepTypes();
|
||||||
kt_initGraphCTypes();
|
kt_initGraphCTypes();
|
||||||
kt_endInit();
|
kt_endInit();
|
||||||
@ -19,9 +19,9 @@ int main(const int argc, const char* const* argv){
|
|||||||
kprintf(" %s", argv[i]);
|
kprintf(" %s", argv[i]);
|
||||||
kprintf("\n");
|
kprintf("\n");
|
||||||
|
|
||||||
tryLast(main_window_open("GraphC"),_1);
|
tryLast(main_window_open("GraphC"),_1, ;);
|
||||||
tryLast(main_window_loop_start(),_2);
|
tryLast(main_window_loop_start(),_2, ;);
|
||||||
tryLast(main_window_close(),_3);
|
tryLast(main_window_close(),_3, ;);
|
||||||
|
|
||||||
kt_free();
|
kt_free();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
#!/usr/bin/bash
|
#!/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 fonts/generated
|
||||||
try_delete_dir_or_file libs/fonts_embedded.a
|
try_delete_dir_or_file libs/fonts_embedded.a
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd fonts
|
cd fonts
|
||||||
SRC_C=""
|
SRC_C=""
|
||||||
HEADER="generated/fonts_embedded.h"
|
HEADER="generated/fonts_embedded.h"
|
||||||
@ -30,17 +29,12 @@ mkdir -p src/generated/
|
|||||||
cp -v fonts/$HEADER src/$HEADER
|
cp -v fonts/$HEADER src/$HEADER
|
||||||
myprint "${GREEN}font arrays external definitions have been written to ${CYAN}src/$HEADER"
|
myprint "${GREEN}font arrays external definitions have been written to ${CYAN}src/$HEADER"
|
||||||
|
|
||||||
|
# delete old objects
|
||||||
clean_dir "$OBJDIR/objects"
|
clean_dir "$OBJDIR/objects"
|
||||||
myprint "${BLUE}hiding libs"
|
|
||||||
mv "$OBJDIR/libs" "$OBJDIR/libs_"
|
|
||||||
mkdir -p "$OBJDIR/libs"
|
|
||||||
# compiling
|
# compiling
|
||||||
compile_c "$C_ARGS" "$SRC_C"
|
compile_c "$C_ARGS" "$SRC_C"
|
||||||
pack_static_lib "$STATIC_LIB_FILE"
|
pack_static_lib "$STATIC_LIB_FILE"
|
||||||
rm -rf $OUTDIR/fonts_embedded.a
|
# moving lib file
|
||||||
myprint "${BLUE}restoring libs"
|
mv "$OUTDIR/$STATIC_LIB_FILE" libs/
|
||||||
rm -rf "$OBJDIR/libs"
|
mkdir -p "libs"
|
||||||
mv "$OBJDIR/libs_" "$OBJDIR/libs"
|
myprint "$OUTDIR/$STATIC_LIB_FILE -> libs/"
|
||||||
|
|
||||||
cp "$OBJDIR/out/fonts_embedded.a" libs/
|
|
||||||
myprint "$OBJDIR/out/fonts_embedded.a -> libs/"
|
|
||||||
|
|||||||
@ -1,35 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# if $lib_project.a doesn't exist or rebuild_* task was executed, builds static lib
|
# compile fonts
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ ! -f libs/fonts_embedded.a ]; then
|
if [ ! -f libs/fonts_embedded.a ]; then
|
||||||
if ! make embed_fonts; then
|
if ! make embed_fonts; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
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
|
# copy all precompiled libs
|
||||||
cp libs/* $OBJDIR/libs/
|
cp libs/* $OBJDIR/libs/
|
||||||
|
|||||||
@ -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"
|
|
||||||
Loading…
Reference in New Issue
Block a user