diff --git a/CMakeLists.txt b/CMakeLists.txt index 6d094c8..fe9d622 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,22 +84,20 @@ if(CONFIG_LV_I2C) list(APPEND SOURCES "lvgl_i2c/i2c_manager.c") endif() +if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0") + idf_component_register( SRCS ${SOURCES} + INCLUDE_DIRS ${LVGL_INCLUDE_DIRS} + REQUIRES lvgl driver) + set(USE_PORT_TICK_PERIOD_MS) +else() idf_component_register( SRCS ${SOURCES} - INCLUDE_DIRS ${LVGL_INCLUDE_DIRS} - if(ESP_IDF_VERSION_MAJOR>=5) - REQUIRES lvgl driver - else - REQUIRES lvgl - endif) + INCLUDE_DIRS ${LVGL_INCLUDE_DIRS} + REQUIRES lvgl) + set(USE_PORT_TICK_RATE_MS) +endif() target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_LVGL_H_INCLUDE_SIMPLE") -if(ESP_IDF_VERSION_MAJOR >= 5) -target_compile_definitions(${COMPONENT_LIB} PUBLIC "-USE_PORT_TICK_PERIOD_MS") -else() -target_compile_definitions(${COMPONENT_LIB} PUBLIC "-USE_PORT_TICK_RATE_MS") -endif() - else() message(FATAL_ERROR "LVGL ESP32 drivers: ESP_PLATFORM is not defined. Try reinstalling ESP-IDF.") endif()