diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index b42926791..9d691312c 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -95,7 +95,7 @@ jobs: install: | apt-get update -y - apt-get install build-essential ccache libgcc-10-dev python3 libpng-dev ruby-full gcovr cmake libjpeg62-turbo-dev libfreetype6-dev libasan6 pngquant python3-pip libinput-dev libxkbcommon-dev pkg-config ninja-build -q -y + apt-get install build-essential ccache libgcc-10-dev python3 libpng-dev ruby-full gcovr cmake libjpeg62-turbo-dev libfreetype6-dev libasan6 pngquant python3-pip libinput-dev libxkbcommon-dev libdrm-dev pkg-config ninja-build -q -y pip install pypng lz4 /usr/sbin/update-ccache-symlinks echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc diff --git a/scripts/install-prerequisites.sh b/scripts/install-prerequisites.sh index 61948935f..3e5bc1f6b 100755 --- a/scripts/install-prerequisites.sh +++ b/scripts/install-prerequisites.sh @@ -6,5 +6,5 @@ # # Note: This script is run by the CI workflows. sudo apt update -sudo apt install gcc python3 ninja-build libpng-dev ruby-full gcovr cmake libjpeg-turbo8-dev libfreetype6-dev pngquant libinput-dev libxkbcommon-dev pkg-config +sudo apt install gcc python3 ninja-build libpng-dev ruby-full gcovr cmake libjpeg-turbo8-dev libfreetype6-dev pngquant libinput-dev libxkbcommon-dev libdrm-dev pkg-config pip3 install pypng lz4 diff --git a/src/drivers/display/drm/lv_linux_drm.c b/src/drivers/display/drm/lv_linux_drm.c index 0f847344a..c706f9cb2 100644 --- a/src/drivers/display/drm/lv_linux_drm.c +++ b/src/drivers/display/drm/lv_linux_drm.c @@ -9,8 +9,6 @@ #include "lv_linux_drm.h" #if LV_USE_LINUX_DRM -#include "../../../lv_api_map.h" - #include #include #include diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f3b7a5208..f9a0f28f8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -259,16 +259,30 @@ find_package(Libinput OPTIONAL_COMPONENTS) include_directories(${LIBINPUT_INCLUDE_DIRS}) if (NOT LIBINPUT_FOUND) -message("libinput is not found, defaulting to 0") -add_definitions(-DLV_USE_LIBINPUT=0) + message("libinput not found, defaulting to 0") + add_definitions(-DLV_USE_LIBINPUT=0) endif() find_package(PkgConfig) pkg_check_modules(xkbcommon pkg_check_modules xkbcommon) if (NOT xkbcommon_FOUND) -message("xkbcommon is not found, defaulting to 0") -add_definitions(-DLV_LIBINPUT_XKB=0) + message("xkbcommon not found, defaulting to 0") + add_definitions(-DLV_LIBINPUT_XKB=0) +endif() + +# libdrm is required for the DRM display driver test case +include(${CMAKE_CURRENT_LIST_DIR}/FindLibDRM.cmake) +if(Libdrm_FOUND) + include_directories(${Libdrm_INCLUDE_DIRS}) +else() + message("libdrm not found, defaulting to 0") + add_definitions(-DLV_USE_LINUX_DRM=0) +endif() + +# If we are running on mac, set LV_USE_LINUX_FBDEV to 0 +if(APPLE) + add_definitions(-DLV_USE_LINUX_FBDEV=0) endif() # disable test targets for build only tests @@ -310,6 +324,7 @@ foreach( test_case_fname ${TEST_CASE_FILES} ) lvgl_thorvg ${PNG_LIBRARIES} ${FREETYPE_LIBRARIES} + ${LIBDRM_LIBRARIES} ${LIBINPUT_LIBRARIES} ${JPEG_LIBRARIES} m diff --git a/tests/FindLibDRM.cmake b/tests/FindLibDRM.cmake new file mode 100644 index 000000000..5599eeead --- /dev/null +++ b/tests/FindLibDRM.cmake @@ -0,0 +1,45 @@ +find_package(PkgConfig) +pkg_check_modules(PKG_Libdrm pkg_check_modules libdrm) + +set(Libdrm_DEFINITIONS ${PKG_Libdrm_CFLAGS_OTHER}) +set(Libdrm_VERSION ${PKG_Libdrm_VERSION}) + +find_path(Libdrm_INCLUDE_DIR + NAMES + xf86drm.h + HINTS + ${PKG_Libdrm_INCLUDE_DIRS} +) +find_library(Libdrm_LIBRARY + NAMES + drm + HINTS + ${PKG_Libdrm_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libdrm + FOUND_VAR + Libdrm_FOUND + REQUIRED_VARS + Libdrm_LIBRARY + Libdrm_INCLUDE_DIR + VERSION_VAR + Libdrm_VERSION +) + +if(Libdrm_FOUND AND NOT TARGET Libdrm::Libdrm) + add_library(Libdrm::Libdrm UNKNOWN IMPORTED) + set_target_properties(Libdrm::Libdrm PROPERTIES + IMPORTED_LOCATION "${Libdrm_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${Libdrm_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}" + INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}/libdrm" + ) +endif() + +mark_as_advanced(Libdrm_LIBRARY Libdrm_INCLUDE_DIR) + +set(Libdrm_LIBRARIES ${Libdrm_LIBRARY}) +set(Libdrm_INCLUDE_DIRS ${Libdrm_INCLUDE_DIR} "${Libdrm_INCLUDE_DIR}/libdrm") +set(Libdrm_VERSION_STRING ${Libdrm_VERSION} ${PKG_Libdrm_LIBRARY_DIRS}) diff --git a/tests/src/lv_test_conf_full.h b/tests/src/lv_test_conf_full.h index df3502108..251b4aee3 100644 --- a/tests/src/lv_test_conf_full.h +++ b/tests/src/lv_test_conf_full.h @@ -101,6 +101,14 @@ #define LV_CACHE_DEF_SIZE (10 * 1024 * 1024) +#ifndef LV_USE_LINUX_DRM + #define LV_USE_LINUX_DRM 1 +#endif + +#ifndef LV_USE_LINUX_FBDEV + #define LV_USE_LINUX_FBDEV 1 +#endif + #define LV_USE_ILI9341 1 #define LV_USE_ST7735 1 #define LV_USE_ST7789 1