﻿set(PLUGIN "calendar")

set(HEADERS
    ukuicalendarplugin.h
    ukuicalendarwidget.h
    calendarbutton.h
    calendarbuttontext.h
    ukuiwebviewdialog.h
    lunarcalendarwidget/frmlunarcalendarwidget.h
    lunarcalendarwidget/lunarcalendarinfo.h
    lunarcalendarwidget/lunarcalendaritem.h
    lunarcalendarwidget/lunarcalendaryearitem.h
    lunarcalendarwidget/lunarcalendarmonthitem.h
    lunarcalendarwidget/lunarcalendarwidget.h
    lunarcalendarwidget/picturetowhite.h
    lunarcalendarwidget/customstylePushbutton.h
    lunarcalendarwidget/calendarcolor.h
)

set(SOURCES
    ukuicalendarplugin.cpp
    ukuicalendarwidget.cpp
    calendarbutton.cpp
    calendarbuttontext.cpp
    ukuiwebviewdialog.cpp
    lunarcalendarwidget/frmlunarcalendarwidget.cpp
    lunarcalendarwidget/lunarcalendarinfo.cpp
    lunarcalendarwidget/lunarcalendaritem.cpp
    lunarcalendarwidget/lunarcalendaryearitem.cpp
    lunarcalendarwidget/lunarcalendarmonthitem.cpp
    lunarcalendarwidget/lunarcalendarwidget.cpp
    lunarcalendarwidget/picturetowhite.cpp
    lunarcalendarwidget/customstylePushbutton.cpp
    lunarcalendarwidget/calendarcolor.cpp
)

set(UIS
    ukuiwebviewdialog.ui
    lunarcalendarwidget/frmlunarcalendarwidget.ui
)

find_package(PkgConfig)

pkg_check_modules(Gsetting REQUIRED gsettings-qt)
include_directories(${Gsetting_INCLUDE_DIRS})

pkg_check_modules(CALENDAR_DEPS REQUIRED glib-2.0)
link_libraries(glib-2.0.so)


pkg_check_modules(KDKSYSTIME kysdk-systime)
if (KDKSYSTIME_FOUND)
    ADD_DEFINITIONS(-DKDKSYSTIME_FOUND="true")

    include_directories(${KDKSYSTIME_PKG_INCLUDE_DIRS})
    link_directories(${KDKSYSTIME_PKG_LIBRARY_DIRS})
    link_libraries(kydate.so)
endif()

# pkg_check_modules(KYSDKSYSTIME_PKG kysdk-systime)
# include_directories(${KYSDKSYSTIME_PKG_INCLUDE_DIRS})
# link_directories(${KYSDKSYSTIME_PKG_LIBRARY_DIRS})
# link_libraries(kydate.so)

pkg_check_modules(KYSDKQTWIDGETS_PKG kysdk-qtwidgets)
include_directories(${KYSDKQTWIDGETS_PKG_INCLUDE_DIRS})
link_directories(${KYSDKQTWIDGETS_PKG_LIBRARY_DIRS})
link_libraries(kysdk-qtwidgets.so)

pkg_check_modules(KYSDKWAYLANDHELPER_PKG kysdk-waylandhelper)
include_directories(${KYSDKWAYLANDHELPER_PKG_INCLUDE_DIRS})
link_directories(${KYSDKWAYLANDHELPER_PKG_LIBRARY_DIRS})
link_libraries(kysdk-waylandhelper.so)


include_directories(${CALENDAR_DEPS_INCLUDE_DIRS})

ADD_DEFINITIONS(-DQT_NO_KEYWORDS)
install(DIRECTORY html/
        DESTINATION ${PACKAGE_DATA_DIR}/plugin-calendar/html)

#加载翻译文件
file(GLOB TS_FILES "${PROJECT_SOURCE_DIR}/plugin-calendar/translation/*.ts" )
#更新翻译文件并创建.qm文件
qt5_create_translation(QM_FILES ${PROJECT_SOURCE_DIR} ${TS_FILES})
set(${PLUGIN}_QM_FILES ${QM_FILES})

BUILD_UKUI_PLUGIN(${PLUGIN})

#安装翻译文件
set(CALENDAR_TRANSLATION_DIR "${PACKAGE_DATA_DIR}/plugin-calendar/translation")
add_compile_definitions(CALENDAR_TRANSLATION_DIR="${CALENDAR_TRANSLATION_DIR}")
install(FILES ${QM_FILES} DESTINATION ${CALENDAR_TRANSLATION_DIR})

