set(LV_BUILD_USE_KCONFIG ON)
idf_component_register(SRCS 
                            "test_ihm.c" 
                            "../../ihm.c"
                            "../../ihm_gateway.c"
                            "../../lv_theme_domotic.c"
                             "../../model.c"
                            "driver_backends.c" 
                            "sdl.c" 
                            "../../fonts/montserrat_medium_12.c"
                            "../../fonts/montserrat_medium_18.c"
                            "../../fonts/montserrat_medium_24.c"
                            "../../fonts/roboto_medium_36.c"
                            "../../fonts/roboto_medium_72.c"
                            "../../fonts/vlump_96.c"
                            "../../fonts/super_malibu_80.c"
                            "../../images/wifi_ko.c"
                            "../../images/wifi_ok.c"
                       INCLUDE_DIRS
                            "../../include"
                            "../mock"
                       WHOLE_ARCHIVE
                       REQUIRES lvgl meteofrance RemindMe washingMachineState)

    message("Including SDL2 support")
    find_package(PkgConfig REQUIRED)
    pkg_check_modules(SDL2 REQUIRED sdl2)
    pkg_check_modules(SDL2_IMAGE REQUIRED SDL2_image)

    list(APPEND PKG_CONFIG_LIB ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES})
    list(APPEND PKG_CONFIG_INC ${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS})

target_compile_options(${COMPONENT_LIB} PUBLIC --coverage -DLV_LVGL_H_INCLUDE_SIMPLE )
target_link_libraries(${COMPONENT_LIB} PUBLIC ${PKG_CONFIG_LIB} --coverage)
target_include_directories(${COMPONENT_LIB} PRIVATE ${CMAKE_SOURCE_DIR}/mock ${PKG_CONFIG_INC})
target_link_libraries(${COMPONENT_LIB} PRIVATE bsd)

if(CMAKE_C_COMPILER_ID MATCHES "Clang")
    target_compile_options(${COMPONENT_LIB} PRIVATE -std=gnu++20)
endif()


# Currently 'main' for IDF_TARGET=linux is defined in freertos component.
# Since we are using a freertos mock here, need to let Catch2 provide 'main'.
#target_link_libraries(${COMPONENT_LIB} PRIVATE Catch2WithMain)
