From 21709b788a650d227ad08e4d2269481f4bdd0531 Mon Sep 17 00:00:00 2001 From: timerix Date: Fri, 31 Mar 2023 17:14:49 +0600 Subject: [PATCH] build scripts updated --- .gitignore | 3 ++- README.md | 14 +++++++++++++- cbuild | 2 +- default.config | 10 ++++++---- imgui | 2 +- imgui_master | 1 - tasks/clean_additions.sh | 2 ++ tasks/pre_build.sh | 3 +++ 8 files changed, 28 insertions(+), 9 deletions(-) delete mode 160000 imgui_master diff --git a/.gitignore b/.gitignore index 4be6400..a8065d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # build results bin/ obj/ +libs/ *.log *.tmp @@ -11,6 +12,6 @@ obj/ *.user *.vcxproj.filters -# other files +# user files .old*/ current.config diff --git a/README.md b/README.md index e114994..fd16220 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,21 @@ GUI is based on [Dear ImGui](https://github.com/ocornut/imgui) and [SDL](https:/ ```shell git clone --recurse-submodules https://github.com/Timerix22/GraphC ``` -2. Install **SDL2** from package manager or compile it from source (read [SDL docs](SDL/docs/README.md)). +2. Install **SDL2** from package manager or compile it from source +```shell +cd SDL2 +./configute +make -j [number of cpu cores] +make install +# on windows +mkdir ../libs +cp ./build/.libs/*.dll ../libs/ +``` +If it didn't work, read [SDL docs](SDL2/docs/README.md) and [INSTALL.txt](SDL2/INSTALL.txt)). + 3. Compile the program ```shell make build_exec ``` + 4. Copy program files from `bin/*` to any directory diff --git a/cbuild b/cbuild index d72aa0c..2bebe76 160000 --- a/cbuild +++ b/cbuild @@ -1 +1 @@ -Subproject commit d72aa0c8098fe2a427e50355250f473d70886502 +Subproject commit 2bebe76c7e14155392a167bdda61113d0039e188 diff --git a/default.config b/default.config index 5449ad4..01a3ea8 100644 --- a/default.config +++ b/default.config @@ -1,6 +1,6 @@ #!/bin/bash CBUILD_VERSION=6 -CONFIG_VERSION=2 +CONFIG_VERSION=3 PROJECT="GraphC" CMP_C="gcc" @@ -26,11 +26,13 @@ OUTDIR="bin" case "$OS" in WINDOWS) EXEC_FILE="$PROJECT.exe" + INCLUDE="-I./imgui -I/usr/include/SDL2" + LINKER_LIBS="-L./$OBJDIR/libs/ -lSDL2 -lopengl32" ;; LINUX) EXEC_FILE="$PROJECT" INCLUDE="-I./imgui -I/usr/include/SDL2" - LINKER_SHARED_LIBS="-lSDL2 -lGL" + LINKER_LIBS="-lSDL2 -lGL" ;; *) error "operating system $OS has no configuration variants" @@ -52,7 +54,7 @@ case "$TASK" in # -fuse-linker-plugin is required to use static libs with lto, it strips away all C_ARGS="-O2 -flto=auto -fuse-linker-plugin -fprofile-use -fprofile-prefix-path=$(realpath $OBJDIR)/objects" CPP_ARGS="$C_ARGS" - LINKER_ARGS="$CPP_ARGS $LINKER_SHARED_LIBS" + LINKER_ARGS="$CPP_ARGS $LINKER_LIBS" PRE_TASK_SCRIPT=tasks/pre_build.sh TASK_SCRIPT=cbuild/default_tasks/build_exec.sh KEREP_BUILD_TASK=build_static_lib @@ -61,7 +63,7 @@ case "$TASK" in build_exec_dbg) C_ARGS="-O0 -g" CPP_ARGS="$C_ARGS" - LINKER_ARGS="$CPP_ARGS $LINKER_SHARED_LIBS" + LINKER_ARGS="$CPP_ARGS $LINKER_LIBS" PRE_TASK_SCRIPT=tasks/pre_build.sh TASK_SCRIPT=cbuild/default_tasks/build_exec.sh KEREP_BUILD_TASK=build_static_lib_dbg diff --git a/imgui b/imgui index ed66d7c..3e08a7e 160000 --- a/imgui +++ b/imgui @@ -1 +1 @@ -Subproject commit ed66d7c4a5bf09743bc9c719e65479c93783f1e6 +Subproject commit 3e08a7e76e7e275e90d22d9081c01e0515d187b0 diff --git a/imgui_master b/imgui_master deleted file mode 160000 index ed66d7c..0000000 --- a/imgui_master +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ed66d7c4a5bf09743bc9c719e65479c93783f1e6 diff --git a/tasks/clean_additions.sh b/tasks/clean_additions.sh index 85a607e..f53cacc 100644 --- a/tasks/clean_additions.sh +++ b/tasks/clean_additions.sh @@ -2,3 +2,5 @@ myprint "${WHITE}deleting .kerep_rebuild.tmp" rm -rf .kerep_rebuild.tmp +myprint "${WHITE}deleting .imgui_rebuild.tmp" +rm -rf .imgui_rebuild.tmp diff --git a/tasks/pre_build.sh b/tasks/pre_build.sh index f21bca4..236b040 100644 --- a/tasks/pre_build.sh +++ b/tasks/pre_build.sh @@ -22,3 +22,6 @@ function handle_static_dependency { handle_static_dependency kerep $KEREP_BUILD_TASK handle_static_dependency imgui $KEREP_BUILD_TASK + +# copy all precompiled libs +cp libs/* $OBJDIR/libs/