File: Pack.cmake

package info (click to toggle)
bornagain 23.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,948 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (90 lines) | stat: -rw-r--r-- 3,463 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
##  ************************************************************************************************
##
##  BornAgain: simulate and fit reflection and scattering
##
##! @file      cmake/BornAgain/Pack.cmake
##! @brief     Top-level CPack configuration.
##!
##! @homepage  http://www.bornagainproject.org
##! @license   GNU General Public License v3 or higher (see COPYING)
##! @copyright Forschungszentrum Jülich GmbH 2024
##! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
##
##  ************************************************************************************************

# BornAgain packaging

if(APPLE)
    message(STATUS "MacOS installers and packages are produced by Homebrew")
    return()
endif(APPLE)

include(InstallRequiredSystemLibraries)

configure_file(COPYING LICENSE.txt COPYONLY)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_BINARY_DIR}/LICENSE.txt)

set(CPACK_PACKAGE_RELOCATABLE True)

set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION})
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_SOURCE_PACKAGE_FILE_NAME})

set(SELECTED_PYTHON_VERSION "python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
set(_pkgname ${CPACK_SOURCE_PACKAGE_FILE_NAME}-${SELECTED_PYTHON_VERSION}-${BA_ARCHITECTURE})

set(CPACK_PACKAGE_VENDOR "Forschungszentrum Juelich GmbH")
set(CPACK_PACKAGE_MAINTAINER "Scientific Computing Group at Heinz Maier-Leibnitz Zentrum Garching")
set(CPACK_PACKAGE_CONTACT "contact@bornagainproject.org")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://bornagainproject.com")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_VERBATIM_VARIABLES TRUE)

if(WIN32)
    # use Qt Installer Framework
    set(CPACK_GENERATOR IFW)

    set(CPACK_IFW_PACKAGE_TITLE "BornAgain ${PROJECT_VERSION}")
    set(CPACK_IFW_PACKAGE_NAME "BornAgain")
    set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/GUI/images/BornAgain.ico" )
    set(CPACK_IFW_PACKAGE_WINDOW_ICON "${CPACK_IFW_PACKAGE_ICON}")
    set(CPACK_IFW_VERBOSE ON)
    set(CPACK_IFW_TARGET_DIRECTORY "C:/BornAgain-${PROJECT_VERSION}")
    set(CPACK_IFW_ARCHIVE_COMPRESSION 9)  # Ultra compression
    set(CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS OFF)
    set(CPACK_IFW_PACKAGE_START_MENU_DIRECTORY "BornAgain ${PROJECT_VERSION}")

elseif(UNIX)
    set(CPACK_GENERATOR STGZ) # generates self-extracting tgz with file extension .sh

endif()

set(CPACK_PACKAGE_FILE_NAME ${_pkgname})

# NOTE: The 'Unspecified' component is a _default_ component of CPack needed to finalize
# the installer. It must be at the end of all other components.
set(_ALL_COMPONENTS Libraries Headers Examples Applications Runtime Unspecified)

if(WIN32)
    set(CPACK_COMPONENTS_ALL ${_ALL_COMPONENTS} WinLibraries)
else()
    set(CPACK_COMPONENTS_ALL ${_ALL_COMPONENTS})
endif()


include(CPack)

if(WIN32)
    include(CPackIFW REQUIRED)

    # add the script to create desktop and start-menu shortcuts under Windows
    cpack_ifw_configure_component(Applications
        LICENSES "License" "${CMAKE_SOURCE_DIR}/COPYING"
        SCRIPT "${CMAKE_SOURCE_DIR}/cmake/BornAgain/qt_installscript_windows.js")
endif(WIN32)

# reset package name (CPack bug: the original value is overwritten by CPack module)
set(CPACK_PACKAGE_FILE_NAME ${_pkgname})

message(STATUS "Installer name: ${CPACK_PACKAGE_FILE_NAME}")
message(STATUS "Source package name: ${CPACK_SOURCE_PACKAGE_FILE_NAME}")
message(STATUS "Package components: ${CPACK_COMPONENTS_ALL}")