<commit_before>INCLUDE(${CMAKE_FILES_DIR}/common.cmake)

MACRO(INITIALISE_PLUGIN TARGET_NAME HAS_RESOURCES)
    SET(PLUGIN_NAME ${TARGET_NAME})

    SET(SOURCES)
    SET(HEADERS)
    SET(HEADERS_MOC)
    SET(UIS)

    IF(${HAS_RESOURCES})
        SET(RESOURCES
            res/${PLUGIN_NAME}.qrc
        )
    ELSE()
        SET(RESOURCES)
    ENDIF()
ENDMACRO()

MACRO(BUILD_PLUGIN)
    # Update the translation (.ts) files and generate the language (.qm) files
    # which will later on be embedded in the plugin itself

    IF(NOT "${RESOURCES}" STREQUAL "")
        UPDATE_LANGUAGE_FILES(${PLUGIN_NAME})
    ENDIF()

    # Rules to build the plugin

    IF("${HEADERS_MOC}" STREQUAL "")
        SET(SOURCES_MOC)
    ELSE()
        QT4_WRAP_CPP(SOURCES_MOC ${HEADERS_MOC})
    ENDIF()

    IF("${UIS}" STREQUAL "")
        SET(SOURCES_UIS)
    ELSE()
        QT4_WRAP_UI(SOURCES_UIS ${UIS})
    ENDIF()

    IF("${RESOURCES}" STREQUAL "")
        SET(SOURCES_RCS)
    ELSE()
        QT4_ADD_RESOURCES(SOURCES_RCS ${RESOURCES})
    ENDIF()

    ADD_LIBRARY(${PROJECT_NAME} SHARED
        ${SOURCES}
        ${SOURCES_MOC}
        ${SOURCES_UIS}
        ${SOURCES_RCS}
    )

    TARGET_LINK_LIBRARIES(${PROJECT_NAME}
        ${ARGN}
    )

    # Linker settings
    # Note: by default "lib" will be prepended to the name of the target file.
    #       However, this is not common practice on Windows, so...

    IF(WIN32)
        SET_TARGET_PROPERTIES(${PROJECT_NAME}
            PROPERTIES PREFIX ""
        )
    ENDIF()

    SET_TARGET_PROPERTIES(${PROJECT_NAME}
        PROPERTIES OUTPUT_NAME ${PLUGIN_NAME} LINK_FLAGS "${LINK_FLAGS_PROPERTIES}"
    )

    # Create the plugins directory if it doesn't already exist and move the
    # plugin to it
    # Note: this is so that we can test the use of plugins in OpenCOR without
    #       having to package OpenCOR first
#---GRY--- NOTE THAT THIS IS ONLY FOR WINDOWS AND LINUX AT THIS STAGE (NO
#          ACCESS TO A MAC AT THE MOMENT...)

    IF(NOT APPLE)
        SET(PLUGINS_DIR ${CMAKE_BINARY_DIR}/plugins)
        SET(PLUGIN_FILENAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PLUGIN_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})

        IF(NOT EXISTS ${PLUGINS_DIR})
            ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD<commit_msg>Minor adjustment for Windows after making use of CMAKE_SHARED_LIBRARY_PREFIX in plugin.cmake.<commit_after>INCLUDE(${CMAKE_FILES_DIR}/common.cmake)

MACRO(INITIALISE_PLUGIN TARGET_NAME HAS_RESOURCES)
    SET(PLUGIN_NAME ${TARGET_NAME})

    SET(SOURCES)
    SET(HEADERS)
    SET(HEADERS_MOC)
    SET(UIS)

    IF(${HAS_RESOURCES})
        SET(RESOURCES
            res/${PLUGIN_NAME}.qrc
        )
    ELSE()
        SET(RESOURCES)
    ENDIF()
ENDMACRO()

MACRO(BUILD_PLUGIN)
    # Update the translation (.ts) files and generate the language (.qm) files
    # which will later on be embedded in the plugin itself

    IF(NOT "${RESOURCES}" STREQUAL "")
        UPDATE_LANGUAGE_FILES(${PLUGIN_NAME})
    ENDIF()

    # Rules to build the plugin

    IF("${HEADERS_MOC}" STREQUAL "")
        SET(SOURCES_MOC)
    ELSE()
        QT4_WRAP_CPP(SOURCES_MOC ${HEADERS_MOC})
    ENDIF()

    IF("${UIS}" STREQUAL "")
        SET(SOURCES_UIS)
    ELSE()
        QT4_WRAP_UI(SOURCES_UIS ${UIS})
    ENDIF()

    IF("${RESOURCES}" STREQUAL "")
        SET(SOURCES_RCS)
    ELSE()
        QT4_ADD_RESOURCES(SOURCES_RCS ${RESOURCES})
    ENDIF()

    ADD_LIBRARY(${PROJECT_NAME} SHARED
        ${SOURCES}
        ${SOURCES_MOC}
        ${SOURCES_UIS}
        ${SOURCES_RCS}
    )

    TARGET_LINK_LIBRARIES(${PROJECT_NAME}
        ${ARGN}
    )

    # Linker settings
    # Note: by default "lib" will be prepended to the name of the target file.
    #       However, this is not common practice on Windows, so...

    IF(WIN32)
        SET(CMAKE_SHARED_LIBRARY_PREFIX)
    ENDIF()

    SET_TARGET_PROPERTIES(${PROJECT_NAME}
        PROPERTIES OUTPUT_NAME ${PLUGIN_NAME} LINK_FLAGS "${LINK_FLAGS_PROPERTIES}"
    )

    # Create the plugins directory if it doesn't already exist and move the
    # plugin to it
    # Note: this is so that we can test the use of plugins in OpenCOR without
    #       having to package OpenCOR first
#---GRY--- NOTE THAT THIS IS ONLY FOR WINDOWS AND LINUX AT THIS STAGE (NO
#          ACCESS TO A MAC AT THE MOMENT...)

    IF(NOT APPLE)
        SET(PLUGINS_DIR ${CMAKE_BINARY_DIR}/plugins)
        SET(PLUGIN_FILENAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PLUGIN_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})

        IF(NOT EXISTS ${PLUGINS_DIR})
            ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD
{'fraction_non_alphanumeric': 0.10356057316543639, 'fraction_numerical': 0.0021710811984368217, 'mean_word_length': 2.7731367731367733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6673730', 'n_tokens_mistral': 1812, 'n_tokens_neox': 1599, 'n_words': 371}