diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 699da9d114f0..fb2e695fce4e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -254,12 +254,21 @@ find_package(Freetype REQUIRED) include_directories(${FREETYPE_INCLUDE_DIRS}) # libinput is required for the libinput device driver test case -find_package(Libinput REQUIRED) +find_package(Libinput OPTIONAL_COMPONENTS) include_directories(${LIBINPUT_INCLUDE_DIRS}) -# libxkbcommon is required for the libinput device driver test case +if (NOT LIBINPUT_FOUND) +message("libinput is not found, defaulting to 0") +add_definitions(-DLV_USE_LIBINPUT=0) +endif() + find_package(PkgConfig) -pkg_check_modules(xkbcommon REQUIRED xkbcommon) +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) +endif() # disable test targets for build only tests if (ENABLE_TESTS) @@ -274,6 +283,10 @@ foreach( test_case_fname ${TEST_CASE_FILES} ) if (${test_name} STREQUAL "_test_template") continue() endif() + + # gather all test cases + list(APPEND TEST_CASES ${test_name}) + # Create path to auto-generated source file. set(test_runner_fname ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_Runner.c) # Run ruby to generate source in build directory @@ -309,4 +322,11 @@ foreach( test_case_fname ${TEST_CASE_FILES} ) COMMAND ${test_name}) endforeach( test_case_fname ${TEST_CASE_FILES} ) +add_custom_target(run + COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --timeout 300 + WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} + DEPENDS ${TEST_CASES} + USES_TERMINAL +) + endif() diff --git a/tests/src/lv_test_conf_full.h b/tests/src/lv_test_conf_full.h index d64087358ebc..2963c54d83db 100644 --- a/tests/src/lv_test_conf_full.h +++ b/tests/src/lv_test_conf_full.h @@ -105,8 +105,14 @@ #define LV_USE_ST7735 1 #define LV_USE_ST7789 1 #define LV_USE_ST7796 1 -#define LV_USE_LIBINPUT 1 -#define LV_LIBINPUT_XKB 1 + +#ifndef LV_USE_LIBINPUT + #define LV_USE_LIBINPUT 1 +#endif + +#ifndef LV_LIBINPUT_XKB + #define LV_LIBINPUT_XKB 1 +#endif #define LV_USE_FREETYPE 1 #define LV_FREETYPE_CACHE_SIZE 768