-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuse_cpack.cmake
100 lines (99 loc) · 4.42 KB
/
use_cpack.cmake
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
91
92
93
94
95
96
97
98
99
100
cmake_minimum_required( VERSION 3.1.0 )
#CPack section start
set(CPACK_PACKAGE_VERSION ${_VERSION_STRING})
set(CPACK_PACKAGE_VERSION_MAJOR "${_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${_VERSION_MINOR}")
if(_VERSION_PATCH)
set(CPACK_PACKAGE_VERSION_PATCH "${_VERSION_PATCH}")
endif()
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_RELEASE 1)
set(CPACK_PACKAGE_CONTACT "Vitaly Tonkacheyev")
set(CPACK_MAINTAINER_EMAIL "[email protected]")
set(PACKAGE_MAINTAINER "${CPACK_PACKAGE_CONTACT} <${CPACK_MAINTAINER_EMAIL}>")
set(CPACK_PACKAGE_VENDOR "KukuRuzo Inc")
set(CPACK_PACKAGE_DESCRIPTION "Mises truss calculator")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple program to provide numerical studies for von-Mises trusses with rigid joints")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(PACKAGE_URL "https://sourceforge.net/projects/kukuruzo/files/qmisestruss/")
if(WIN32 AND NOT UNIX)
set(CPACK_GENERATOR NSIS)
#set(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
set(CPACK_NSIS_INSTALLED_ICON_NAME "${PROJECT_NAME}.exe")
set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} Misestruss")
set(CPACK_NSIS_HELP_LINK "https:\\\\\\\\github.com\\\\Vitozz\\\\kukuruzo")
set(CPACK_NSIS_URL_INFO_ABOUT "Misestruss Sources")
set(CPACK_NSIS_CONTACT "[email protected]")
set(CPACK_NSIS_MODIFY_PATH ON)
else()
find_program(RPMB_PATH rpmbuild DOC "Path to rpmbuild")
find_program(DPKG_PATH dpkg DOC "Path to dpkg")
find_program(MAKEPKG makepkg DOC "Path to makepkg")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
if(RPMB_PATH)
set(CPACK_GENERATOR "RPM")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_RPM_PACKAGE_LICENSE "GPL-2")
set(CPACK_RPM_PACKAGE_GROUP "Applications/System")
set(CPACK_RPM_SPEC_CHANGELOG "${PROJECT_SOURCE_DIR}/changelog")
set(CPACK_RESOURCE_FILE_LICENSE "${CPACK_RESOURCE_FILE_LICENSE}")
set(CPACK_RPM_PACKAGE_URL "${PACKAGE_URL}")
endif()
if(DPKG_PATH)
set(CPACK_GENERATOR "DEB")
exec_program("LANG=en date +'%a, %d %b %Y %T %z'"
OUTPUT_VARIABLE BUILD_DATE
)
exec_program("date +'%Y'"
OUTPUT_VARIABLE BUILD_YEAR
)
message(STATUS "Build date: ${BUILD_DATE}")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${PACKAGE_MAINTAINER}")
set(CPACK_DEBIAN_PACKAGE_SECTION "sound")
exec_program("${DPKG_PATH} --print-architecture"
OUTPUT_VARIABLE DEB_PKG_ARCH
)
if(NOT "${DEB_PKG_ARCH}" STREQUAL "")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${DEB_PKG_ARCH}")
endif()
find_program(LSB_APP lsb_release DOC "Path to lsb_release")
if(LSB_APP)
exec_program("${LSB_APP} -is"
OUTPUT_VARIABLE OSNAME
)
if(NOT "${OSNAME}" STREQUAL "")
message(STATUS "Current system: ${OSNAME}")
if("${OSNAME}" STREQUAL "Ubuntu")
set(PKG_OS_SUFFIX "-0ubuntu1~0ppa${CPACK_PACKAGE_RELEASE}~")
endif()
endif()
exec_program("${LSB_APP} -cs"
OUTPUT_VARIABLE OSCODENAME
)
if(NOT "${OSCODENAME}" STREQUAL "")
message(STATUS "Debian codename: ${OSCODENAME}")
endif()
endif()
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
if(NOT CPACK_DEBIAN_PACKAGE_VERSION)
set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}${PKG_OS_SUFFIX}${OSCODENAME}")
endif()
if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
set(CPACK_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
else()
set(CPACK_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
endif()
if(NOT CPACK_PACKAGE_FILE_NAME)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_PACKAGE_ARCHITECTURE}")
endif()
configure_file(copyright.in copyright @ONLY)
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_BINARY_DIR}/copyright")
endif()
if(MAKEPKG)
configure_file(PKGBUILD.in PKGBUILD @ONLY)
message(STATUS "PKGBUILD for ArchLinux generated in ${PROJECT_BINARY_DIR}")
endif()
endif()
include(CPack)
#CPack section end