Skip to content

Commit

Permalink
waver : fix font loading and snap build
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Feb 27, 2021
1 parent 770e464 commit 74f35eb
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 25 deletions.
14 changes: 0 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,3 @@ endif()
if (GGWAVE_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

install(TARGETS ggwave RUNTIME)
install(TARGETS ggwave-common RUNTIME)
install(TARGETS ggsock RUNTIME)

if (GGWAVE_SUPPORT_SDL2)
install(TARGETS ggwave-common-sdl2 RUNTIME)
install(TARGETS imgui RUNTIME)
install(TARGETS imgui-sdl2 RUNTIME)
install(TARGETS waver RUNTIME)

install(FILES ${PROJECT_SOURCE_DIR}/examples/assets/fonts/DroidSans.ttf DESTINATION bin)
install(FILES ${PROJECT_SOURCE_DIR}/examples/assets/fonts/fontawesome-webfont.ttf DESTINATION bin)
endif()
6 changes: 6 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,9 @@ if (GGWAVE_SUPPORT_SDL2)
add_subdirectory(waver)
add_subdirectory(spectrogram)
endif()

install(TARGETS ggwave-common LIBRARY DESTINATION lib)

if (GGWAVE_SUPPORT_SDL2)
install(TARGETS ggwave-common-sdl2 LIBRARY DESTINATION lib)
endif()
2 changes: 1 addition & 1 deletion examples/third-party/ggsock
Submodule ggsock updated 1 files
+2 −0 src/CMakeLists.txt
6 changes: 6 additions & 0 deletions examples/third-party/imgui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,9 @@ if (GGWAVE_SUPPORT_SDL2)
)
endif()
endif()

install(TARGETS imgui LIBRARY DESTINATION lib)

if (GGWAVE_SUPPORT_SDL2)
install(TARGETS imgui-sdl2 LIBRARY DESTINATION lib)
endif()
5 changes: 5 additions & 0 deletions examples/waver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@ else()
imgui-sdl2
${CMAKE_THREAD_LIBS_INIT}
)

install(FILES ${PROJECT_SOURCE_DIR}/examples/assets/fonts/DroidSans.ttf DESTINATION bin)
install(FILES ${PROJECT_SOURCE_DIR}/examples/assets/fonts/fontawesome-webfont.ttf DESTINATION bin)
endif()

install(TARGETS ${TARGET} RUNTIME DESTINATION bin)
24 changes: 15 additions & 9 deletions examples/waver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,21 @@ int main(int argc, char** argv) {
ImGui_Init(window, gl_context);
ImGui::GetIO().IniFilename = nullptr;

ImGui_tryLoadFont(getBinaryPath() + "DroidSans.ttf", kGlobalImGuiScale*14.0f, false);
ImGui_tryLoadFont(getBinaryPath() + "../bin/DroidSans.ttf", kGlobalImGuiScale*14.0f, false);
ImGui_tryLoadFont(getBinaryPath() + "../examples/assets/fonts/DroidSans.ttf", kGlobalImGuiScale*14.0f, false);
ImGui_tryLoadFont(getBinaryPath() + "../../examples/assets/fonts/DroidSans.ttf", kGlobalImGuiScale*14.0f, false);

ImGui_tryLoadFont(getBinaryPath() + "fontawesome-webfont.ttf", kGlobalImGuiScale*14.0f, true);
ImGui_tryLoadFont(getBinaryPath() + "../bin/fontawesome-webfont.ttf", kGlobalImGuiScale*14.0f, true);
ImGui_tryLoadFont(getBinaryPath() + "../examples/assets/fonts/fontawesome-webfont.ttf", kGlobalImGuiScale*14.0f, true);
ImGui_tryLoadFont(getBinaryPath() + "../../examples/assets/fonts/fontawesome-webfont.ttf", kGlobalImGuiScale*14.0f, true);
{
bool isNotLoaded = true;
isNotLoaded = isNotLoaded && !ImGui_tryLoadFont(getBinaryPath() + "DroidSans.ttf", kGlobalImGuiScale*14.0f, false);
isNotLoaded = isNotLoaded && !ImGui_tryLoadFont(getBinaryPath() + "../bin/DroidSans.ttf", kGlobalImGuiScale*14.0f, false);
isNotLoaded = isNotLoaded && !ImGui_tryLoadFont(getBinaryPath() + "../examples/assets/fonts/DroidSans.ttf", kGlobalImGuiScale*14.0f, false);
isNotLoaded = isNotLoaded && !ImGui_tryLoadFont(getBinaryPath() + "../../examples/assets/fonts/DroidSans.ttf", kGlobalImGuiScale*14.0f, false);
}

{
bool isNotLoaded = true;
isNotLoaded = isNotLoaded && !ImGui_tryLoadFont(getBinaryPath() + "fontawesome-webfont.ttf", kGlobalImGuiScale*14.0f, true);
isNotLoaded = isNotLoaded && !ImGui_tryLoadFont(getBinaryPath() + "../bin/fontawesome-webfont.ttf", kGlobalImGuiScale*14.0f, true);
isNotLoaded = isNotLoaded && !ImGui_tryLoadFont(getBinaryPath() + "../examples/assets/fonts/fontawesome-webfont.ttf", kGlobalImGuiScale*14.0f, true);
isNotLoaded = isNotLoaded && !ImGui_tryLoadFont(getBinaryPath() + "../../examples/assets/fonts/fontawesome-webfont.ttf", kGlobalImGuiScale*14.0f, true);
}

ImGui_SetStyle();

Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
source: https://github.com/ggerganov/ggwave
source-type: git
plugin: cmake
configflags: [-DBUILD_SHARED_LIBS=OFF]
#configflags: [-DBUILD_SHARED_LIBS=OFF]
build-packages:
- g++
- make
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ if (MINGW)
stdc++
)
endif()

install(TARGETS ${TARGET} LIBRARY DESTINATION lib)

0 comments on commit 74f35eb

Please sign in to comment.