← All tasks
cppsonic-pi-net/sonic-pi #3083Not a task: not reproduced

IMGUI do not find correct path to font file

envgap__sonic-pi-net__sonic-pi-3083

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
8733f5a2ac75c5cc0171d8e78ee7e8153b970d6b
Manifest
app/CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

sonic-pi-net/sonic-pi #3083 · read the original issue
Latest commit on May 9 (60f962) - “Release - label v4 BETA-6” imgui do not start after build:

`./app/build/gui/imgui/sonic-pi-imgui  

[API] [INFO ] : Initialising Daemon

sonic-pi-imgui: /home/mikael/work/sonic-pi/app/gui/imgui/core/imgui_draw.cpp:1978: ImFont* ImFontAtlas::AddFontFromFileTTF(const char*, float, const ImFontConfig*, const ImWchar*): Assertion `(0) && "Could not load font file!"' failed.`



Most probably is commit 88bdb2 - "ImGui - use install root prefix instead of source tree prefix" the cause.

The APP_INSTALL_ROOT in app/gui/imgui/CMakeLists.txt is using the APP_ROOT as default. Unfortunately this is redefined earlier in the same file 'set(APP_ROOT ${CMAKE_CURRENT_LIST_DIR})' from previously being set in the CMakeLists.txt in app directory.



It works if I define APP_INSTALL_ROOT in app/CMakeLists.txt after (APP_ROOT) define instead.

```

if (NOT APP_INSTALL_ROOT)

    set(APP_INSTALL_ROOT ${APP_ROOT})

endif()

```



And change in app/gui/imgui/CMakeLists.txt from

```

if (APP_INSTALL_ROOT)

    target_compile_definitions(${APP_NAME} PRIVATE APP_INSTALL_ROOT="${APP_INSTALL_ROOT}")

else()

    target_compile_definitions(${APP_NAME} PRIVATE APP_INSTALL_ROOT="${APP_ROOT}")

endif()

```

to just

`target_compile_definitions(${APP_NAME} PRIVATE APP_INSTALL_ROOT="${APP_INSTALL_ROOT}")`



However, when looking in the main.cpp file it assumes knowledge on where the imgui directory is with respect to the app directory (gui/imgui) when finding put the file path. So maybe better to change there instead?

```

-    io.Fonts->AddFontFromFileTTF(APP_INSTALL_ROOT "/gui/imgui/res/Cousine-Regular.ttf", 16.0f * vdpi);

+    io.Fonts->AddFontFromFileTTF(APP_INSTALL_ROOT "/res/Cousine-Regular.ttf", 16.0f * vdpi);

```

and also change in app.cpp

```

-    sonic.spApi->Init(fs::path(APP_INSTALL_ROOT) / "..");

+    sonic.spApi->Init(fs::path(APP_INSTALL_ROOT) / "../../..");

```

I also see that the the Qt build do not override APP_ROOT but uses dedicated name (QTAPP_ROOT).





Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]