<commit_before>PROJECT(OpenCOR)

# Minimum version of CMake required

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

# Type of build

SET(CMAKE_BUILD_TYPE Release)

# Version of OpenCOR

SET(${PROJECT_NAME}_VERSION_MAJOR 0)
SET(${PROJECT_NAME}_VERSION_MINOR 1)
SET(${PROJECT_NAME}_VERSION_PATCH 0)

SET(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}")

# Compiler options

ADD_DEFINITIONS(-Wall -O2 -ffast-math)

IF(${CMAKE_BUILD_TYPE} MATCHES "Release")
    ADD_DEFINITIONS(-DNDEBUG)
    ADD_DEFINITIONS(-DQT_NO_DEBUG_OUTPUT)
ENDIF()

# Files that make up OpenCOR

SET(${PROJECT_NAME}_SOURCES
    src/main.cpp
    src/mainwindow.cpp
)

SET(${PROJECT_NAME}_HEADERS
)

SET(${PROJECT_NAME}_HEADERS_MOC
    src/mainwindow.h
)

SET(${PROJECT_NAME}_UIS
    src/mainwindow.ui
)

SET(${PROJECT_NAME}_RESOURCES
    res/${PROJECT_NAME}.qrc
)

# OpenCOR requires the following third-party libraries:
#  - QtSingleApplication (http://qt.gitorious.org/qt-solutions): BSD license

FOREACH(3RDPARTYLIB qtsingleapplication)
    SET(3RDPARTYLIB_DIR 3rdparty/${3RDPARTYLIB})
    INCLUDE(${3RDPARTYLIB_DIR}/CMakeLists.txt)
    INCLUDE_DIRECTORIES(${3RDPARTYLIB_DIR})
ENDFOREACH()

# 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)
    IF(MINGW)
        ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Icon.o
                             COMMAND windres -I ${CMAKE_CURRENT_SOURCE_DIR} -i ${CMAKE_CURRENT_SOURCE_DIR}/res/${PROJECT_NAME}.rc 
                                             -o ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Icon.o
                            )
        SET(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Icon.o)
    ELSE()
        SET(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES} res/${PROJECT_NAME}.rc)
    ENDIF()
ELSEIF(APPLE)
    SET(MACOSX_BUNDLE_ICON_FILE ${PROJECT_NAME}.icns)
    SET_SOURCE_FILES_PROPERTIES(res/${PROJECT_NAME}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
    SET(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES} res/${PROJECT_NAME}.icns)
ENDIF()

# Qt specific

FIND_PACKAGE(Qt4 4.7 REQUIRED)

IF(WIN32)
    SET(QT_USE_QTMAIN TRUE)
    # Note: the above ensures that winmain@16 is available on Windows
ENDIF()

INCLUDE(${QT_USE_FILE})

QT4_WRAP_CPP(${PROJECT_NAME}_SOURCES_MOC ${${PROJECT_NAME}_HEADERS_MOC})
QT4_WRAP_UI(${PROJECT_NAME}_SOURCES_UIS ${${PROJECT_NAME}_UIS})
QT4_ADD_RESOURCES(${PROJECT_NAME}_SOURCES_RCS ${${PROJECT_NAME}_RESOURCES})

# Rules to build OpenCOR

#SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

ADD_EXECUTABLE(${PROJECT_NAME} WIN32 MACOSX_BUNDLE
    ${${PROJECT_NAME}_SOURCES}
    ${${PROJECT_NAME}_SOURCES_MOC}
    ${${PROJECT_NAME}_SOURCES_UIS}
    ${${PROJECT_NAME}_SOURCES_RCS}
)

TARGET_LINK_LIBRARIES(${PROJECT_NAME}
    ${QT_QTCORE_LIBRARY}
    ${QT_QTGUI_LIBRARY}
    ${QT_QTNETWORK_LIBRARY}
)

# Rules to package OpenCOR (using CPack)

SET(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
SET(CPACK_PACKAGE_VENDOR "<NAME>")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME}, a cross-platform CellML-based modelling environment")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "${${PROJECT_NAME}_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${${PROJECT_NAME}_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${${PROJECT_NAME}_VERSION_PATCH}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}")
SET(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}")

IF(WIN32)
    # Select NSIS and ZIP as the packagers on Windows

    SET(CPACK_GENERATOR NSIS ZIP)

    SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LicenseLGPLv2.1.txt")

    # OpenCOR itself

    INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

    IF(MINGW)
        # MinGW files required by OpenCOR

        FOREACH(DLL mingwm10 libgcc_s_dw2-1)
            INSTALL(FILES ${QT_BINARY_DIR}/../../mingw/bin/${DLL}.dll DESTINATION bin)
        ENDFOREACH()
    ENDIF()

    # Qt files required by OpenCOR

    FOREACH(DLL QtCore QtGui)
       INSTALL(FILES ${QT_BINARY_DIR}/${DLL}${QT_VERSION_MAJOR}.dll DESTINATION bin)
    ENDFOREACH()

    # VBScript file to run OpenCOR (useful when downloading a ZIPped version of
    # OpenCOR)

    INSTALL(FILES distrib/${PROJECT_NAME}.vbs DESTINATION .)
ELSEIF(APPLE)
    # Select PackageMaker and ZIP as the packagers on Mac OS X

    SET(CPACK_GENERATOR PackageMaker ZIP)

    SET(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/distrib/WelcomeForMacOSXInstaller.txt")
    SET(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
    SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LicenseLGPLv2.1.txt")

    SET(${PROJECT_NAME}_INSTALL_DIR "/Applications/${PROJECT_NAME}")

    SET(CPACK_SET_DESTDIR TRUE)
    SET(CMAKE_INSTALL_PREFIX ${${PROJECT_NAME}_INSTALL_DIR})

    INSTALL(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION ${${PROJECT_NAME}_INSTALL_DIR})

    # Shell script to run OpenCOR (useful when downloading a ZIPped version of
    # OpenCOR)

    INSTALL(FILES distrib/${PROJECT_NAME} DESTINATION . PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
ELSE()
    # Select TGZ as the only packager on Linux

    SET(CPACK_GENERATOR TGZ)

    # OpenCOR itself

    INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

    # Qt files required by OpenCOR
    # Note: by default, OpenCOR only requires QtCore and QtGui, but QtGui
    #       requires QtDBus which itself requires QtXml, so...

    FOREACH(LIB QtCore QtDBus QtGui QtXml)
        INSTALL(FILES
            ${QT_LIBRARY_DIR}/lib${LIB}.so.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}
            RENAME lib${LIB}.so.${QT_VERSION_MAJOR}
            DESTINATION lib
        )
    ENDFOREACH()

    # QtGui seems to require libaudio.so.2.4 (to be packaged as libaudio.so.2)
    # which is not available on a 'blank' version of Ubuntu, so...

    INSTALL(FILES /usr/lib/libaudio.so.2.4 RENAME libaudio.so.2 DESTINATION lib)

    # Shell script to run OpenCOR

    INSTALL(FILES distrib/${PROJECT_NAME} DESTINATION . PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
ENDIF()

INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt DESTINATION .)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LicenseLGPLv2.1.txt DESTINATION .)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.txt DESTINATION .)

INCLUDE(CPack)<commit_msg>Forgot to add QtNetwork to the packaging rules.<commit_after>PROJECT(OpenCOR)

# Minimum version of CMake required

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

# Type of build

SET(CMAKE_BUILD_TYPE Release)

# Version of OpenCOR

SET(${PROJECT_NAME}_VERSION_MAJOR 0)
SET(${PROJECT_NAME}_VERSION_MINOR 1)
SET(${PROJECT_NAME}_VERSION_PATCH 0)

SET(${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}")

# Compiler options

ADD_DEFINITIONS(-Wall -O2 -ffast-math)

IF(${CMAKE_BUILD_TYPE} MATCHES "Release")
    ADD_DEFINITIONS(-DNDEBUG)
    ADD_DEFINITIONS(-DQT_NO_DEBUG_OUTPUT)
ENDIF()

# Files that make up OpenCOR

SET(${PROJECT_NAME}_SOURCES
    src/main.cpp
    src/mainwindow.cpp
)

SET(${PROJECT_NAME}_HEADERS
)

SET(${PROJECT_NAME}_HEADERS_MOC
    src/mainwindow.h
)

SET(${PROJECT_NAME}_UIS
    src/mainwindow.ui
)

SET(${PROJECT_NAME}_RESOURCES
    res/${PROJECT_NAME}.qrc
)

# OpenCOR requires the following third-party libraries:
#  - QtSingleApplication (http://qt.gitorious.org/qt-solutions): BSD license

FOREACH(3RDPARTYLIB qtsingleapplication)
    SET(3RDPARTYLIB_DIR 3rdparty/${3RDPARTYLIB})
    INCLUDE(${3RDPARTYLIB_DIR}/CMakeLists.txt)
    INCLUDE_DIRECTORIES(${3RDPARTYLIB_DIR})
ENDFOREACH()

# 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)
    IF(MINGW)
        ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Icon.o
                             COMMAND windres -I ${CMAKE_CURRENT_SOURCE_DIR} -i ${CMAKE_CURRENT_SOURCE_DIR}/res/${PROJECT_NAME}.rc 
                                             -o ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Icon.o
                            )
        SET(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Icon.o)
    ELSE()
        SET(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES} res/${PROJECT_NAME}.rc)
    ENDIF()
ELSEIF(APPLE)
    SET(MACOSX_BUNDLE_ICON_FILE ${PROJECT_NAME}.icns)
    SET_SOURCE_FILES_PROPERTIES(res/${PROJECT_NAME}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
    SET(${PROJECT_NAME}_SOURCES ${${PROJECT_NAME}_SOURCES} res/${PROJECT_NAME}.icns)
ENDIF()

# Qt specific

FIND_PACKAGE(Qt4 4.7 REQUIRED)

IF(WIN32)
    SET(QT_USE_QTMAIN TRUE)
    # Note: the above ensures that winmain@16 is available on Windows
ENDIF()

INCLUDE(${QT_USE_FILE})

QT4_WRAP_CPP(${PROJECT_NAME}_SOURCES_MOC ${${PROJECT_NAME}_HEADERS_MOC})
QT4_WRAP_UI(${PROJECT_NAME}_SOURCES_UIS ${${PROJECT_NAME}_UIS})
QT4_ADD_RESOURCES(${PROJECT_NAME}_SOURCES_RCS ${${PROJECT_NAME}_RESOURCES})

# Rules to build OpenCOR

#SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)

ADD_EXECUTABLE(${PROJECT_NAME} WIN32 MACOSX_BUNDLE
    ${${PROJECT_NAME}_SOURCES}
    ${${PROJECT_NAME}_SOURCES_MOC}
    ${${PROJECT_NAME}_SOURCES_UIS}
    ${${PROJECT_NAME}_SOURCES_RCS}
)

TARGET_LINK_LIBRARIES(${PROJECT_NAME}
    ${QT_QTCORE_LIBRARY}
    ${QT_QTGUI_LIBRARY}
    ${QT_QTNETWORK_LIBRARY}
)

# Rules to package OpenCOR (using CPack)

SET(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
SET(CPACK_PACKAGE_VENDOR "<NAME>")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME}, a cross-platform CellML-based modelling environment")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "${${PROJECT_NAME}_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${${PROJECT_NAME}_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${${PROJECT_NAME}_VERSION_PATCH}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}")
SET(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}")

IF(WIN32)
    # Select NSIS and ZIP as the packagers on Windows

    SET(CPACK_GENERATOR NSIS ZIP)

    SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LicenseLGPLv2.1.txt")

    # OpenCOR itself

    INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

    IF(MINGW)
        # MinGW files required by OpenCOR

        FOREACH(DLL mingwm10 libgcc_s_dw2-1)
            INSTALL(FILES ${QT_BINARY_DIR}/../../mingw/bin/${DLL}.dll DESTINATION bin)
        ENDFOREACH()
    ENDIF()

    # Qt files required by OpenCOR

    FOREACH(DLL QtCore QtGui QtNetwork)
       INSTALL(FILES ${QT_BINARY_DIR}/${DLL}${QT_VERSION_MAJOR}.dll DESTINATION bin)
    ENDFOREACH()

    # VBScript file to run OpenCOR (useful when downloading a ZIPped version of
    # OpenCOR)

    INSTALL(FILES distrib/${PROJECT_NAME}.vbs DESTINATION .)
ELSEIF(APPLE)
    # Select PackageMaker and ZIP as the packagers on Mac OS X

    SET(CPACK_GENERATOR PackageMaker ZIP)

    SET(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/distrib/WelcomeForMacOSXInstaller.txt")
    SET(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
    SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LicenseLGPLv2.1.txt")

    SET(${PROJECT_NAME}_INSTALL_DIR "/Applications/${PROJECT_NAME}")

    SET(CPACK_SET_DESTDIR TRUE)
    SET(CMAKE_INSTALL_PREFIX ${${PROJECT_NAME}_INSTALL_DIR})

    INSTALL(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION ${${PROJECT_NAME}_INSTALL_DIR})

    # Shell script to run OpenCOR (useful when downloading a ZIPped version of
    # OpenCOR)

    INSTALL(FILES distrib/${PROJECT_NAME} DESTINATION . PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
ELSE()
    # Select TGZ as the only packager on Linux

    SET(CPACK_GENERATOR TGZ)

    # OpenCOR itself

    INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

    # Qt files required by OpenCOR

    FOREACH(LIB QtCore QtDBus QtGui QtNetwork QtXml)
        INSTALL(FILES
            ${QT_LIBRARY_DIR}/lib${LIB}.so.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}
            RENAME lib${LIB}.so.${QT_VERSION_MAJOR}
            DESTINATION lib
        )
    ENDFOREACH()

    # QtGui seems to require libaudio.so.2.4 (to be packaged as libaudio.so.2)
    # which is not available on a 'blank' version of Ubuntu, so...

    INSTALL(FILES /usr/lib/libaudio.so.2.4 RENAME libaudio.so.2 DESTINATION lib)

    # Shell script to run OpenCOR

    INSTALL(FILES distrib/${PROJECT_NAME} DESTINATION . PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
ENDIF()

INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt DESTINATION .)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LicenseLGPLv2.1.txt DESTINATION .)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.txt DESTINATION .)

INCLUDE(CPack)
{'fraction_non_alphanumeric': 0.10948960302457467, 'fraction_numerical': 0.0066540642722117205, 'mean_word_length': 4.873001776198934, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1622617', 'n_tokens_mistral': 5241, 'n_tokens_neox': 4799, 'n_words': 838}