<commit_before>PROJECT(OpenCOR)

# Minimum version of CMake required

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

# Some in-house CMake functions/macros

INCLUDE(cmake/common.cmake)

# Initialise the project

INITIALISE_PROJECT()

# Version of OpenCOR

SET(VERSION_MAJOR 0)
SET(VERSION_MINOR 0)
SET(VERSION_PATCH 0)

SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

FILE(WRITE ${CMAKE_BINARY_DIR}/version.txt ${VERSION})

# Files that make up the GUI version of OpenCOR

SET(SOURCES
    src/main.cpp

    src/misc/cellml.cpp
    src/misc/common.cpp
    src/misc/utils.cpp
    src/misc/versionmanager.cpp

    src/plugins/plugin.cpp
    src/plugins/pluginmanager.cpp
    src/plugins/pluginswindow.cpp

    src/ui/centralwidget.cpp
    src/ui/checkforupdateswindow.cpp
    src/ui/mainwindow.cpp
    src/ui/preferenceswindow.cpp

    src/widgets/tabwidget.cpp
)

SET(HEADERS
    src/misc/cellml.h
    src/misc/common.h
    src/misc/utils.h
)

SET(HEADERS_MOC
    src/misc/versionmanager.h

    src/plugins/plugin.h
    src/plugins/pluginmanager.h
    src/plugins/pluginswindow.h

    src/ui/centralwidget.h
    src/ui/checkforupdateswindow.h
    src/ui/mainwindow.h
    src/ui/preferenceswindow.h

    src/widgets/tabwidget.h
)

SET(UIS
    src/plugins/pluginswindow.ui

    src/ui/centralwidget.ui
    src/ui/checkforupdateswindow.ui
    src/ui/mainwindow.ui
    src/ui/preferenceswindow.ui
)

SET(RESOURCES
    res/common.qrc
    res/ui.qrc
)

# Various include directories

INCLUDE_DIRECTORIES(src/misc)
INCLUDE_DIRECTORIES(src/plugins)
INCLUDE_DIRECTORIES(src/ui)
INCLUDE_DIRECTORIES(src/widgets)

# Qt specific

SET(QT_USE_QTHELP TRUE)
SET(QT_USE_QTNETWORK TRUE)
SET(QT_USE_QTSQL TRUE)
SET(QT_USE_QTWEBKIT TRUE)
SET(QT_USE_QTXML TRUE)

IF(WIN32 OR APPLE)
    SET(QT_USE_PHONON TRUE)
ELSE()
    SET(QT_USE_QTDBUS TRUE)
ENDIF()

INCLUDE(${QT_USE_FILE})

# Generate the help files which will be embedded in the executable as a
# resource

EXECUTE_PROCESS(COMMAND ${QT_QCOLLECTIONGENERATOR_EXECUTABLE} doc/${PROJECT_NAME}.qhcp
                                                           -o build/${PROJECT_NAME}.qhc
                WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

# Update the translation (.ts) files and generate the language (.qm) files
# which will later on be embedded in the executable as resources

UPDATE_LANGUAGE_FILES(${PROJECT_NAME})

# Set the application icon, but only for Windows and Mac OS X, since in the
# case of Linux, it's done through res/OpenCOR.qrc

IF(WIN32)
    SET(IconObjectFile ${CMAKE_BINARY_DIR}/${PROJECT_NAME}_icon.o)

    ADD_CUSTOM_COMMAND(OUTPUT ${IconObjectFile}
                       COMMAND windres -I ${CMAKE_SOURCE_DIR} -i ${CMAKE_SOURCE_DIR}/res/${PROJECT_NAME}.rc
                                       -o ${IconObjectFile}
                      )

    SET(SOURCES ${SOURCES} ${IconObjectFile})
ELSEIF(APPLE)
    SET(IconFile ${PROJECT_NAME}.icns)

    SET(MACOSX_BUNDLE_ICON_FILE ${IconFile})

    SET_SOURCE_FILES_PROPERTIES(res/boomy/${IconFile} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

    SET(SOURCES ${SOURCES} res/boomy/${IconFile})
ENDIF()

# Build the plugins used by the GUI version of OpenCOR

SET(PLUGINS
    misc/CoreUI
    # Note: the CoreUI plugin must be built before any other plugin

    3rdparty/LibQxt
    3rdparty/QScintilla
    3rdparty/QtMmlWidget
    3rdparty/QtSingleApplication

    edit/Viewer

    misc/Help

    organise/CellMLModelRepository
    organise/FileBrowser
    organise/FileOrganiser
)

FOREACH(PLUGIN ${PLUGINS})
    SET(PLUGIN_DIR src/plugins/${PLUGIN})
    SET(PLUGIN_INCLUDE_DIRS)
    # Note: the above variable is defined here, but is actually set when
    #       processing the CMakeLists.txt file of the plugin

    ADD_SUBDIRECTORY(${PLUGIN_DIR})

    FOREACH(PLUGIN_INCLUDE_DIR ${PLUGIN_INCLUDE_DIRS})
        INCLUDE_DIRECTORIES(${PLUGIN_DIR}/${PLUGIN_INCLUDE_DIR})
    ENDFOREACH()
ENDFOREACH()

# Build the GUI version of OpenCOR

QT4_WRAP_CPP(SOURCES_MOC ${HEADERS_MOC})
QT4_WRAP_UI(SOURCES_UIS ${UIS})
QT4_ADD_RESOURCES(SOURCES_RCS ${RESOURCES})

ADD_EXECUTABLE(${PROJECT_NAME} WIN32 MACOSX_BUNDLE
    ${SOURCES}
    ${SOURCES_MOC}
    ${SOURCES_UIS}
    ${SOURCES_RCS}
)

TARGET_LINK_LIBRARIES(${PROJECT_NAME}
    ${QT_QTCORE_LIBRARY}
    ${QT_QTGUI_LIBRARY}
    ${QT_QTHELP_LIBRARY}
    ${QT_QTNETWORK_LIBRARY}
    ${QT_QTSQL_LIBRARY}
    ${QT_QTWEBKIT_LIBRARY}
    ${QT_QTXML_LIBRARY}

    #---GRY---
    # The following libraries are plugins, so they shouldn't be listed here,
    # but for now they have to be since OpenCOR doesn't yet support plugins as
    # such

    CellMLModelRepositoryPlugin
    CoreUIPlugin
    FileBrowserPlugin
    FileOrganiserPlugin
    HelpPlugin
    LibQxtPlugin
    QScintillaPlugin
    QtMmlWidgetPlugin
    QtSingleApplicationPlugin
    ViewerPlugin
)

IF(WIN32 OR APPLE)
    TARGET_LINK_LIBRARIES(${PROJECT_NAME}
        ${QT_PHONON_LIBRARY}
    )
ELSE()
    TARGET_LINK_LIBRARIES(${PROJECT_NAME}
        ${QT_QTDBUS_LIBRARY}
    )
ENDIF()

# Additional compiler and linker settings

SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}")
<commit_msg>Updated the .ts files so that they use a UNIX type of convention for end of lines (as opposed to a Windows convention which caused the file to be 'modified' every time one would build OpenCOR on Windows).<commit_after>PROJECT(OpenCOR)

# Minimum version of CMake required

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

# Some in-house CMake functions/macros

INCLUDE(cmake/common.cmake)

# Initialise the project

INITIALISE_PROJECT()

# Version of OpenCOR

SET(VERSION_MAJOR 0)
SET(VERSION_MINOR 0)
SET(VERSION_PATCH 0)

SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

FILE(WRITE ${CMAKE_BINARY_DIR}/version.txt ${VERSION})

# Files that make up the GUI version of OpenCOR

SET(SOURCES
    src/main.cpp

    src/misc/cellml.cpp
    src/misc/common.cpp
    src/misc/utils.cpp
    src/misc/versionmanager.cpp

    src/plugins/plugin.cpp
    src/plugins/pluginmanager.cpp
    src/plugins/pluginswindow.cpp

    src/ui/centralwidget.cpp
    src/ui/checkforupdateswindow.cpp
    src/ui/mainwindow.cpp
    src/ui/preferenceswindow.cpp

    src/widgets/tabwidget.cpp
)

SET(HEADERS
    src/misc/cellml.h
    src/misc/common.h
    src/misc/utils.h
)

SET(HEADERS_MOC
    src/misc/versionmanager.h

    src/plugins/plugin.h
    src/plugins/pluginmanager.h
    src/plugins/pluginswindow.h

    src/ui/centralwidget.h
    src/ui/checkforupdateswindow.h
    src/ui/mainwindow.h
    src/ui/preferenceswindow.h

    src/widgets/tabwidget.h
)

SET(UIS
    src/plugins/pluginswindow.ui

    src/ui/centralwidget.ui
    src/ui/checkforupdateswindow.ui
    src/ui/mainwindow.ui
    src/ui/preferenceswindow.ui
)

SET(RESOURCES
    res/common.qrc
    res/ui.qrc
)

# Various include directories

INCLUDE_DIRECTORIES(src/misc)
INCLUDE_DIRECTORIES(src/plugins)
INCLUDE_DIRECTORIES(src/ui)
INCLUDE_DIRECTORIES(src/widgets)

# Qt specific

SET(QT_USE_QTHELP TRUE)
SET(QT_USE_QTNETWORK TRUE)
SET(QT_USE_QTSQL TRUE)
SET(QT_USE_QTWEBKIT TRUE)
SET(QT_USE_QTXML TRUE)

IF(WIN32 OR APPLE)
    SET(QT_USE_PHONON TRUE)
ELSE()
    SET(QT_USE_QTDBUS TRUE)
ENDIF()

INCLUDE(${QT_USE_FILE})

# Generate the help files which will be embedded in the executable as a
# resource

EXECUTE_PROCESS(COMMAND ${QT_QCOLLECTIONGENERATOR_EXECUTABLE} doc/${PROJECT_NAME}.qhcp
                                                           -o build/${PROJECT_NAME}.qhc
                WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

# Update the translation (.ts) files and generate the language (.qm) files
# which will later on be embedded in the executable as resources

UPDATE_LANGUAGE_FILES(${PROJECT_NAME})

# Set the application icon, but only for Windows and Mac OS X, since in the
# case of Linux, it's done through res/OpenCOR.qrc

IF(WIN32)
    SET(IconObjectFile ${CMAKE_BINARY_DIR}/${PROJECT_NAME}_icon.o)

    ADD_CUSTOM_COMMAND(OUTPUT ${IconObjectFile}
                       COMMAND windres -I ${CMAKE_SOURCE_DIR} -i ${CMAKE_SOURCE_DIR}/res/${PROJECT_NAME}.rc
                                       -o ${IconObjectFile}
                      )

    SET(SOURCES ${SOURCES} ${IconObjectFile})
ELSEIF(APPLE)
    SET(IconFile ${PROJECT_NAME}.icns)

    SET(MACOSX_BUNDLE_ICON_FILE ${IconFile})

    SET_SOURCE_FILES_PROPERTIES(res/boomy/${IconFile} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

    SET(SOURCES ${SOURCES} res/boomy/${IconFile})
ENDIF()

# Build the plugins used by the GUI version of OpenCOR

SET(PLUGINS
    misc/CoreUI
    # Note: the CoreUI plugin must be built before any other plugin

    3rdparty/LibQxt
    3rdparty/QScintilla
    3rdparty/QtMmlWidget
    3rdparty/QtSingleApplication

    edit/Viewer

    misc/Help

    organise/CellMLModelRepository
    organise/FileBrowser
    organise/FileOrganiser
)

FOREACH(PLUGIN ${PLUGINS})
    SET(PLUGIN_DIR src/plugins/${PLUGIN})
    SET(PLUGIN_INCLUDE_DIRS)
    # Note: the above variable is defined here, but is actually set when
    #       processing the CMakeLists.txt file of the plugin

    ADD_SUBDIRECTORY(${PLUGIN_DIR})

    FOREACH(PLUGIN_INCLUDE_DIR ${PLUGIN_INCLUDE_DIRS})
        INCLUDE_DIRECTORIES(${PLUGIN_DIR}/${PLUGIN_INCLUDE_DIR})
    ENDFOREACH()
ENDFOREACH()

# Build the GUI version of OpenCOR

QT4_WRAP_CPP(SOURCES_MOC ${HEADERS_MOC})
QT4_WRAP_UI(SOURCES_UIS ${UIS})
QT4_ADD_RESOURCES(SOURCES_RCS ${RESOURCES})

ADD_EXECUTABLE(${PROJECT_NAME} WIN32 MACOSX_BUNDLE
    ${SOURCES}
    ${SOURCES_MOC}
    ${SOURCES_UIS}
    ${SOURCES_RCS}
)

TARGET_LINK_LIBRARIES(${PROJECT_NAME}
    ${QT_QTCORE_LIBRARY}
    ${QT_QTGUI_LIBRARY}
    ${QT_QTHELP_LIBRARY}
    ${QT_QTNETWORK_LIBRARY}
    ${QT_QTSQL_LIBRARY}
    ${QT_QTWEBKIT_LIBRARY}
    ${QT_QTXML_LIBRARY}

    #---GRY---
    # The following libraries are plugins, so they shouldn't be listed here,
    # but for now they have to be since OpenCOR doesn't yet support plugins as
    # such, so...

    CellMLModelRepositoryPlugin
    CoreUIPlugin
    FileBrowserPlugin
    FileOrganiserPlugin
    HelpPlugin
    LibQxtPlugin
    QScintillaPlugin
    QtMmlWidgetPlugin
    QtSingleApplicationPlugin
    ViewerPlugin
)

IF(WIN32 OR APPLE)
    TARGET_LINK_LIBRARIES(${PROJECT_NAME}
        ${QT_PHONON_LIBRARY}
    )
ELSE()
    TARGET_LINK_LIBRARIES(${PROJECT_NAME}
        ${QT_QTDBUS_LIBRARY}
    )
ENDIF()

# Additional compiler and linker settings

SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}")

{'fraction_non_alphanumeric': 0.09167787814722275, 'fraction_numerical': 0.003843936190659235, 'mean_word_length': 3.532665505226481, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7410155', 'n_tokens_mistral': 4013, 'n_tokens_neox': 3663, 'n_words': 726}