@@ -19,6 +19,7 @@ jobs:
sudo apt-get update
sudo apt-get install build-essential git cmake libjson-c-dev -y
sudo apt-get install freeglut3-dev libxmu-dev libxi-dev -y
+ sudo apt-get install fonts-freefont-ttf
sudo apt-get install qtbase5-dev libboost-all-dev -y
git clone https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
cd libtraceevent
@@ -49,6 +49,20 @@ set(OpenGL_GL_PREFERENCE LEGACY)
find_package(OpenGL)
find_package(GLUT)
+set(KS_FONT FreeSans)
+execute_process(COMMAND bash "-c" "fc-list '${KS_FONT}' |grep ${KS_FONT}.ttf | cut -d':' -f 1 -z"
+ OUTPUT_VARIABLE TT_FONT_FILE)
+
+if (TT_FONT_FILE)
+
+ message(STATUS "Found font: ${TT_FONT_FILE}")
+
+else (TT_FONT_FILE)
+
+ message(WARNING "\nCould not find font ${KS_FONT}!\n")
+
+endif (TT_FONT_FILE)
+
find_package(Qt5Widgets 5.7.1)
find_package(Qt5Network)
if (Qt5Widgets_FOUND)
@@ -12,6 +12,7 @@ KernelShark has the following external dependencies:
1. In order to install the packages on Ubuntu do the following:
sudo apt-get install build-essential git cmake libjson-c-dev -y
sudo apt-get install freeglut3-dev libxmu-dev libxi-dev -y
+ sudo apt-get install fonts-freefont-ttf
sudo apt-get install qtbase5-dev -y
1.1 I you want to be able to generate Doxygen documentation:
@@ -26,6 +26,9 @@
/** GLUT has been found. */
#cmakedefine GLUT_FOUND
+/** Truetype font file. */
+#cmakedefine TT_FONT_FILE "@TT_FONT_FILE@"
+
/** Qt - old version detected. */
#cmakedefine QT_VERSION_LESS_5_11
@@ -24,7 +24,7 @@ message(STATUS "dataplot")
add_executable(dplot dataplot.cpp)
target_link_libraries(dplot kshark-plot)
-if (Qt5Widgets_FOUND)
+if (Qt5Widgets_FOUND AND TT_FONT_FILE)
message(STATUS "widgetdemo")
add_executable(widgetdemo widgetdemo.cpp)
@@ -34,4 +34,4 @@ if (Qt5Widgets_FOUND)
add_executable(cmd_split cmd_split.cpp)
target_link_libraries(cmd_split kshark-gui)
-endif (Qt5Widgets_FOUND)
+endif (Qt5Widgets_FOUND AND TT_FONT_FILE)
@@ -63,7 +63,7 @@ if (OPENGL_FOUND)
endif (OPENGL_FOUND)
-if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
+if (Qt5Widgets_FOUND AND Qt5Network_FOUND AND TT_FONT_FILE)
message(STATUS "libkshark-gui")
set (ks-guiLib_hdr KsUtils.hpp
@@ -134,7 +134,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
DESTINATION ${_INSTALL_PREFIX}/bin/
COMPONENT kernelshark)
-endif (Qt5Widgets_FOUND AND Qt5Network_FOUND)
+endif (Qt5Widgets_FOUND AND Qt5Network_FOUND AND TT_FONT_FILE)
add_subdirectory(plugins)
set(PLUGINS ${PLUGINS} PARENT_SCOPE)
@@ -38,13 +38,17 @@ add_test(NAME "libkshark_tests"
COMMAND ${KS_TEST_DIR}/kshark-tests --log_format=HRF
WORKING_DIRECTORY ${KS_TEST_DIR})
-add_executable(kshark-gui-tests libkshark-gui-tests.cpp)
-target_include_directories(kshark-gui-tests PRIVATE ${Boost_INCLUDE_DIRS})
-target_compile_definitions(kshark-gui-tests PRIVATE "BOOST_TEST_DYN_LINK=1")
-target_link_libraries(kshark-gui-tests kshark-gui
- ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+if (Qt5Widgets_FOUND AND TT_FONT_FILE)
-message(STATUS "libkshark-gui_tests")
-add_test(NAME "libkshark-gui_tests"
- COMMAND ${KS_TEST_DIR}/kshark-gui-tests --log_format=HRF
- WORKING_DIRECTORY ${KS_TEST_DIR})
+ add_executable(kshark-gui-tests libkshark-gui-tests.cpp)
+ target_include_directories(kshark-gui-tests PRIVATE ${Boost_INCLUDE_DIRS})
+ target_compile_definitions(kshark-gui-tests PRIVATE "BOOST_TEST_DYN_LINK=1")
+ target_link_libraries(kshark-gui-tests kshark-gui
+ ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+
+ message(STATUS "libkshark-gui_tests")
+ add_test(NAME "libkshark-gui_tests"
+ COMMAND ${KS_TEST_DIR}/kshark-gui-tests --log_format=HRF
+ WORKING_DIRECTORY ${KS_TEST_DIR})
+
+endif (Qt5Widgets_FOUND AND TT_FONT_FILE)
@@ -435,3 +435,12 @@ BOOST_AUTO_TEST_CASE(readout_plugins)
kshark_free(kshark_ctx);
}
+
+BOOST_AUTO_TEST_CASE(check_font_found)
+{
+#ifdef TT_FONT_FILE
+BOOST_REQUIRE(true);
+#else
+BOOST_REQUIRE(false);
+#endif
+}
Being able to load the Truetype font is compulsory for the functioning of the visualization, hence the font must be considered as critical external dependency. Add a search for the font file next to the search of the other third party dependencies and have this file added as definition in the Cmake-generated header file. This way we do not need to search for the font every time when we open KernelShark. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> --- .github/workflows/main.yml | 1 + CMakeLists.txt | 14 ++++++++++++++ README | 1 + build/deff.h.cmake | 3 +++ examples/CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 4 ++-- tests/CMakeLists.txt | 22 +++++++++++++--------- tests/libkshark-tests.cpp | 9 +++++++++ 8 files changed, 45 insertions(+), 13 deletions(-)