root / host / cmake / Modules / UHDPackage.cmake @ 41e9eded
History | View | Annotate | Download (6.52 KB)
| 1 |
# |
|---|---|
| 2 |
# Copyright 2010-2011 Ettus Research LLC |
| 3 |
# |
| 4 |
# This program is free software: you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU General Public License as published by |
| 6 |
# the Free Software Foundation, either version 3 of the License, or |
| 7 |
# (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
# |
| 17 |
|
| 18 |
######################################################################## |
| 19 |
INCLUDE(UHDVersion) #sets version information |
| 20 |
|
| 21 |
SET(UHD_RELEASE_MODE "${UHD_RELEASE_MODE}" CACHE BOOL "set UHD to release mode to build installers")
|
| 22 |
|
| 23 |
######################################################################## |
| 24 |
# Setup additional defines for OS types |
| 25 |
######################################################################## |
| 26 |
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
| 27 |
SET(LINUX TRUE) |
| 28 |
ENDIF() |
| 29 |
|
| 30 |
IF(LINUX AND EXISTS "/etc/debian_version") |
| 31 |
SET(DEBIAN TRUE) |
| 32 |
ENDIF() |
| 33 |
|
| 34 |
IF(LINUX AND EXISTS "/etc/redhat-release") |
| 35 |
SET(REDHAT TRUE) |
| 36 |
ENDIF() |
| 37 |
|
| 38 |
######################################################################## |
| 39 |
# Set generator type for recognized systems |
| 40 |
######################################################################## |
| 41 |
IF(CPACK_GENERATOR) |
| 42 |
#already set |
| 43 |
ELSEIF(APPLE) |
| 44 |
SET(CPACK_GENERATOR PackageMaker) |
| 45 |
ELSEIF(WIN32) |
| 46 |
SET(CPACK_GENERATOR NSIS) |
| 47 |
ELSEIF(DEBIAN) |
| 48 |
SET(CPACK_GENERATOR DEB) |
| 49 |
ELSEIF(REDHAT) |
| 50 |
SET(CPACK_GENERATOR RPM) |
| 51 |
ELSE() |
| 52 |
SET(CPACK_GENERATOR TGZ) |
| 53 |
ENDIF() |
| 54 |
|
| 55 |
######################################################################## |
| 56 |
# Setup package file name |
| 57 |
######################################################################## |
| 58 |
FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release) |
| 59 |
IF((DEBIAN OR REDHAT) AND LSB_RELEASE_EXECUTABLE) |
| 60 |
|
| 61 |
#extract system information by executing the commands |
| 62 |
EXECUTE_PROCESS( |
| 63 |
COMMAND ${LSB_RELEASE_EXECUTABLE} --short --id
|
| 64 |
OUTPUT_VARIABLE LSB_ID OUTPUT_STRIP_TRAILING_WHITESPACE |
| 65 |
) |
| 66 |
EXECUTE_PROCESS( |
| 67 |
COMMAND ${LSB_RELEASE_EXECUTABLE} --short --release
|
| 68 |
OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE |
| 69 |
) |
| 70 |
|
| 71 |
#set a more sensible package name for this system |
| 72 |
SET(CPACK_PACKAGE_FILE_NAME "UHD-${UHD_VERSION}-${LSB_ID}-${LSB_RELEASE}-${CMAKE_SYSTEM_PROCESSOR}")
|
| 73 |
|
| 74 |
ENDIF() |
| 75 |
|
| 76 |
IF(${CPACK_GENERATOR} STREQUAL NSIS)
|
| 77 |
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}")
|
| 78 |
ENDIF() |
| 79 |
|
| 80 |
######################################################################## |
| 81 |
# Setup CPack General |
| 82 |
######################################################################## |
| 83 |
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - Universal Hardware Driver") |
| 84 |
SET(CPACK_PACKAGE_VENDOR "Ettus Research LLC") |
| 85 |
SET(CPACK_PACKAGE_CONTACT "support@ettus.com") |
| 86 |
SET(CPACK_PACKAGE_VERSION_MAJOR ${UHD_VERSION_MAJOR})
|
| 87 |
SET(CPACK_PACKAGE_VERSION_MINOR ${UHD_VERSION_MINOR})
|
| 88 |
SET(CPACK_PACKAGE_VERSION_PATCH ${UHD_VERSION_PATCH})
|
| 89 |
SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.txt)
|
| 90 |
SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/AUTHORS.txt)
|
| 91 |
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
|
| 92 |
|
| 93 |
######################################################################## |
| 94 |
# Setup CPack Components |
| 95 |
######################################################################## |
| 96 |
SET(CPACK_COMPONENT_LIBRARIES_GROUP "Development") |
| 97 |
SET(CPACK_COMPONENT_HEADERS_GROUP "Development") |
| 98 |
SET(CPACK_COMPONENT_UTILITIES_GROUP "Runtime") |
| 99 |
SET(CPACK_COMPONENT_EXAMPLES_GROUP "Runtime") |
| 100 |
SET(CPACK_COMPONENT_TESTS_GROUP "Runtime") |
| 101 |
SET(CPACK_COMPONENT_MANUAL_GROUP "Documentation") |
| 102 |
SET(CPACK_COMPONENT_DOXYGEN_GROUP "Documentation") |
| 103 |
SET(CPACK_COMPONENT_README_GROUP "Documentation") |
| 104 |
|
| 105 |
SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") |
| 106 |
SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers") |
| 107 |
SET(CPACK_COMPONENT_UTILITIES_DISPLAY_NAME "Utilities") |
| 108 |
SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples") |
| 109 |
SET(CPACK_COMPONENT_TESTS_DISPLAY_NAME "Unit Tests") |
| 110 |
SET(CPACK_COMPONENT_MANUAL_DISPLAY_NAME "Manual") |
| 111 |
SET(CPACK_COMPONENT_DOXYGEN_DISPLAY_NAME "Doxygen") |
| 112 |
SET(CPACK_COMPONENT_README_DISPLAY_NAME "Readme") |
| 113 |
SET(CPACK_COMPONENT_IMAGES_DISPLAY_NAME "Images") |
| 114 |
|
| 115 |
SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Dynamic link library") |
| 116 |
SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "C++ development headers") |
| 117 |
SET(CPACK_COMPONENT_UTILITIES_DESCRIPTION "Utility executables and python scripts") |
| 118 |
SET(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Example executables") |
| 119 |
SET(CPACK_COMPONENT_TESTS_DESCRIPTION "Unit test executables") |
| 120 |
SET(CPACK_COMPONENT_MANUAL_DESCRIPTION "Manual/application notes (rst and html)") |
| 121 |
SET(CPACK_COMPONENT_DOXYGEN_DESCRIPTION "API documentation (html)") |
| 122 |
SET(CPACK_COMPONENT_README_DESCRIPTION "Readme files (txt)") |
| 123 |
SET(CPACK_COMPONENT_IMAGES_DESCRIPTION "FPGA and firmware images") |
| 124 |
|
| 125 |
SET(CPACK_COMPONENT_README_REQUIRED TRUE) |
| 126 |
|
| 127 |
SET(CPACK_COMPONENT_UTILITIES_DEPENDS libraries) |
| 128 |
SET(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries) |
| 129 |
SET(CPACK_COMPONENT_TESTS_DEPENDS libraries) |
| 130 |
|
| 131 |
SET(CPACK_COMPONENTS_ALL libraries headers utilities examples tests manual doxygen readme images) |
| 132 |
|
| 133 |
######################################################################## |
| 134 |
# Setup CPack Debian |
| 135 |
######################################################################## |
| 136 |
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libusb-1.0-0, libboost-dev") |
| 137 |
SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS "python, python-tk") |
| 138 |
|
| 139 |
######################################################################## |
| 140 |
# Setup CPack RPM |
| 141 |
######################################################################## |
| 142 |
SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel, libusb1") |
| 143 |
|
| 144 |
######################################################################## |
| 145 |
# Setup CPack NSIS |
| 146 |
######################################################################## |
| 147 |
SET(CPACK_NSIS_MODIFY_PATH ON) |
| 148 |
|
| 149 |
SET(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"") |
| 150 |
|
| 151 |
SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " |
| 152 |
WriteRegStr HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\" \\\"$INSTDIR\\\\share\\\\uhd\\\"
|
| 153 |
") |
| 154 |
|
| 155 |
SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " |
| 156 |
DeleteRegValue HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\"
|
| 157 |
") |
| 158 |
|
| 159 |
######################################################################## |
| 160 |
INCLUDE(CPack) #include after setting vars |