<commit_before>include_directories(
    ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
    "${CMAKE_CURRENT_BINARY_DIR}"
)

set(qtlxqt_HDRS
    lxqtplatformtheme.h
    lxqtsystemtrayicon.h
    lxqtfiledialoghelper.h
    statusnotifieritem/statusnotifieritem.h
    statusnotifieritem/dbustypes.h
)

set(qtlxqt_SRCS
    main.cpp
    lxqtplatformtheme.cpp
    lxqtsystemtrayicon.cpp
    lxqtfiledialoghelper.cpp
    statusnotifieritem/statusnotifieritem.cpp
    statusnotifieritem/dbustypes.cpp
)

qt5_add_dbus_adaptor(qtlxqt_SRCS
    statusnotifieritem/org.kde.StatusNotifierItem.xml
    statusnotifieritem/statusnotifieritem.h
    StatusNotifierItem
)

add_library(qtlxqt MODULE ${qtlxqt_HDRS} ${qtlxqt_SRCS})

target_compile_definitions(qtlxqt
    PRIVATE
        "QT_NO_FOREACH"
)

target_link_libraries(qtlxqt
    Qt5::Widgets
    Qt5::DBus
    dbusmenu-qt5
    Qt5XdgIconLoader
    fm-qt
)


# there is no standard way to get the plugin dir of Qt5 with cmake
# The best way is get_target_property(QT_PLUGINS_DIR Qt5::QGtk2ThemePlugin LOCATION).
# This directly returns the platformthemes dir. However, this does not work
# in some distros, such as ubuntu.
# Finally, I came up with a more reliable way by using qmake.
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
if(NOT QT_QMAKE_EXECUTABLE)
    message(FATAL_ERROR "qmake is not found.")
endif()

# execute the command "qmake -query QT_INSTALL_PLUGINS" to get the path of plugins dir.
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
    OUTPUT_VARIABLE QT_PLUGINS_DIR
    OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(QT_PLUGINS_DIR)
    message(STATUS "Qt5 plugin directory:" "${QT_PLUGINS_DIR}")
else()
    message(FATAL_ERROR "Qt5 plugin directory cannot be detected.")
endif()

install(TARGETS qtlxqt LIBRARY DESTINATION "${QT_PLUGINS_DIR}/platformthemes")
<commit_msg>Removes local compile definition<commit_after>include_directories(
    ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
    "${CMAKE_CURRENT_BINARY_DIR}"
)

set(qtlxqt_HDRS
    lxqtplatformtheme.h
    lxqtsystemtrayicon.h
    lxqtfiledialoghelper.h
    statusnotifieritem/statusnotifieritem.h
    statusnotifieritem/dbustypes.h
)

set(qtlxqt_SRCS
    main.cpp
    lxqtplatformtheme.cpp
    lxqtsystemtrayicon.cpp
    lxqtfiledialoghelper.cpp
    statusnotifieritem/statusnotifieritem.cpp
    statusnotifieritem/dbustypes.cpp
)

qt5_add_dbus_adaptor(qtlxqt_SRCS
    statusnotifieritem/org.kde.StatusNotifierItem.xml
    statusnotifieritem/statusnotifieritem.h
    StatusNotifierItem
)

add_library(qtlxqt MODULE ${qtlxqt_HDRS} ${qtlxqt_SRCS})

target_link_libraries(qtlxqt
    Qt5::Widgets
    Qt5::DBus
    dbusmenu-qt5
    Qt5XdgIconLoader
    fm-qt
)


# there is no standard way to get the plugin dir of Qt5 with cmake
# The best way is get_target_property(QT_PLUGINS_DIR Qt5::QGtk2ThemePlugin LOCATION).
# This directly returns the platformthemes dir. However, this does not work
# in some distros, such as ubuntu.
# Finally, I came up with a more reliable way by using qmake.
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
if(NOT QT_QMAKE_EXECUTABLE)
    message(FATAL_ERROR "qmake is not found.")
endif()

# execute the command "qmake -query QT_INSTALL_PLUGINS" to get the path of plugins dir.
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
    OUTPUT_VARIABLE QT_PLUGINS_DIR
    OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(QT_PLUGINS_DIR)
    message(STATUS "Qt5 plugin directory:" "${QT_PLUGINS_DIR}")
else()
    message(FATAL_ERROR "Qt5 plugin directory cannot be detected.")
endif()

install(TARGETS qtlxqt LIBRARY DESTINATION "${QT_PLUGINS_DIR}/platformthemes")

{'fraction_non_alphanumeric': 0.06948968512486428, 'fraction_numerical': 0.006514657980456026, 'mean_word_length': 5.151919866444073, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2532712', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1345, 'n_words': 270}