diff --git a/Makefile b/Makefile index 97e64fa..37ab61e 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ default: build_exec_dbg # creates executable using profile info generated by profile -build_exec: rebuild_all # profile +build_exec: # profile @cbuild/call_task.sh build_exec 2>&1 | tee -a make_raw.log # creates executable with debug info and no optimizations diff --git a/README.md b/README.md index fd16220..a9cd128 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,23 @@ 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 -```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)). +2. Install **SDL2** from package manager or compile it from source. + **If you are using msys, switch to mingw64 shell.** + ```shell + cd dependencies/SDL2 + ./configure + make -j [number of cpu threads] + ``` + Then you can install it systemwide: + ```shell + make install + ``` + or copy to ./libs: + ```shell + mkdir -p ../../libs + cp ./build/.libs/SDL2.dll ../../libs/ + ``` + If it didn't work, read [SDL docs](dependencies/SDL2/docs/README.md) and [INSTALL.txt](dependencies/SDL2/INSTALL.txt). 3. Compile the program ```shell diff --git a/default.config b/default.config index b85ecb1..dbe90ce 100644 --- a/default.config +++ b/default.config @@ -40,12 +40,12 @@ case "$OS" in WINDOWS) EXEC_FILE="$PROJECT.exe" INCLUDE="-I./dependencies/imgui -I./dependencies/SDL2/include" - LINKER_LIBS="-L./$OBJDIR/libs/ -lSDL2 -lopengl32 -lpthread -lws2_32" + LINKER_LIBS="-L./libs/ -l:SDL2.dll -lopengl32 -lpthread -lws2_32" ;; LINUX) EXEC_FILE="$PROJECT" INCLUDE="-I./dependencies/imgui -I./dependencies/SDL2/include" - LINKER_LIBS="-L./$OBJDIR/libs/ -lSDL2 -lGL" + LINKER_LIBS="-L./libs/ -lSDL2 -lGL" ;; *) error "operating system $OS has no configuration variants" @@ -71,7 +71,7 @@ case "$TASK" in # -flto applies more optimizations across object files # -flto=auto is needed to multithreaded copilation # -fuse-linker-plugin is required to use static libs with lto, it strips away all - C_ARGS="-O2 -flto=auto -fuse-linker-plugin" + C_ARGS="-O2 -flto=auto -fuse-linker-plugin -static" #-fprofile-use -fprofile-prefix-path=$(realpath $OBJDIR)/objects CPP_ARGS="$C_ARGS" LINKER_ARGS="$CPP_ARGS $LINKER_LIBS" diff --git a/dependencies/SDL2 b/dependencies/SDL2 index c2ee45f..903d888 160000 --- a/dependencies/SDL2 +++ b/dependencies/SDL2 @@ -1 +1 @@ -Subproject commit c2ee45f5ffbba6ff6962eb24fd117586a38cce5e +Subproject commit 903d888cc31d283ccaaaa7e5b5a324c50a103e87 diff --git a/dependencies/imnodes b/dependencies/imnodes index 83af906..63f942f 160000 --- a/dependencies/imnodes +++ b/dependencies/imnodes @@ -1 +1 @@ -Subproject commit 83af9066dbf8dceef44009ef21ac1d6d042db2a3 +Subproject commit 63f942fae90ab787d50fe4c13c7504be7852aa1d diff --git a/src/gui/main_window.cpp b/src/gui/main_window.cpp index 03b30ba..7320448 100644 --- a/src/gui/main_window.cpp +++ b/src/gui/main_window.cpp @@ -21,6 +21,9 @@ f32 getMainWindowDPI(){ Maybe main_window_open(const char* window_title){ SDL_TRY_ZERO(SDL_Init(SDL_INIT_VIDEO)); + SDL_version v; + SDL_GetVersion(&v); + kprintf("SDL version: %u.%u.%u\n", v.major, v.minor, v.patch); // GL 3.0 + GLSL 130 const char* glsl_version = "#version 130"; SDL_TRY_ZERO( SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0)); diff --git a/tasks/pre_build.sh b/tasks/pre_build.sh index 579e4bd..e200432 100644 --- a/tasks/pre_build.sh +++ b/tasks/pre_build.sh @@ -7,5 +7,14 @@ if [ ! -f libs/fonts_embedded.a ]; then fi fi -# copy all precompiled libs -cp libs/* $OBJDIR/libs/ +set -x +# copy precompiled static libs to objects +cp libs/*.a "$OBJDIR/libs/" + +# copy precompiled shared libs to outdir +if [ $OS == 'WINDOWS' ]; then + cp libs/*.dll "$OUTDIR" +else + cp libs/*.so "$OUTDIR" +fi +set +x