diff options
author | Nicholas Corgan <nick.corgan@ettus.com> | 2013-05-10 14:59:04 -0700 |
---|---|---|
committer | Nicholas Corgan <nick.corgan@ettus.com> | 2013-05-10 15:04:00 -0700 |
commit | 4b72513a8930ec4147dab76c079afa1186e335cd (patch) | |
tree | c83c3323385266fe99f5132dbfc74fb636b9e6ba /host/cmake | |
parent | d63ce4fc3aabc208d97b5ff2a14bf2ba351103e7 (diff) | |
download | uhd-4b72513a8930ec4147dab76c079afa1186e335cd.tar.gz uhd-4b72513a8930ec4147dab76c079afa1186e335cd.tar.bz2 uhd-4b72513a8930ec4147dab76c079afa1186e335cd.zip |
Added CMake variables to customize builds to match Debian package configurations
* -DLIBUHD_PKG=ON installs with libuhd003 configuration
* -DLIBUHDDEV_PKG=ON installs with libuhd-dev configuration
* -DUHDHOST_PKG=ON installs with uhd-host configuration
Diffstat (limited to 'host/cmake')
-rw-r--r-- | host/cmake/Modules/UHDComponent.cmake | 56 | ||||
-rw-r--r-- | host/cmake/Modules/UHDPackage.cmake | 40 | ||||
-rw-r--r-- | host/cmake/Modules/UHDVersion.cmake | 9 |
3 files changed, 84 insertions, 21 deletions
diff --git a/host/cmake/Modules/UHDComponent.cmake b/host/cmake/Modules/UHDComponent.cmake index 52b7450d5..d0b8442d9 100644 --- a/host/cmake/Modules/UHDComponent.cmake +++ b/host/cmake/Modules/UHDComponent.cmake @@ -1,5 +1,5 @@ # -# Copyright 2010-2011 Ettus Research LLC +# Copyright 2010-2011,2013 Ettus Research LLC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -54,6 +54,60 @@ MACRO(LIBUHD_REGISTER_COMPONENT name var enb deps dis) ENDMACRO(LIBUHD_REGISTER_COMPONENT) ######################################################################## +# Install only if appropriate for package and if component is enabled +######################################################################## +FUNCTION(UHD_INSTALL) + include(CMakeParseArguments) + CMAKE_PARSE_ARGUMENTS(UHD_INSTALL "" "DESTINATION;COMPONENT" "TARGETS;FILES;PROGRAMS" ${ARGN}) + + IF(UHD_INSTALL_FILES) + SET(TO_INSTALL "${UHD_INSTALL_FILES}") + ELSEIF(UHD_INSTALL_PROGRAMS) + SET(TO_INSTALL "${UHD_INSTALL_PROGRAMS}") + ELSEIF(UHD_INSTALL_TARGETS) + SET(TO_INSTALL "${UHD_INSTALL_TARGETS}") + ENDIF(UHD_INSTALL_FILES) + + IF(UHD_INSTALL_COMPONENT STREQUAL "headers") + IF(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) + INSTALL(${ARGN}) + ENDIF(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) + ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "examples") + IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + INSTALL(${ARGN}) + ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "tests") + IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + INSTALL(${ARGN}) + ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "utilities") + IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + INSTALL(${ARGN}) + ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "manual") + IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + INSTALL(${ARGN}) + ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "doxygen") + IF(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) + INSTALL(${ARGN}) + ENDIF(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) + ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "manpages") + IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + INSTALL(${ARGN}) + ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "images") + IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) + INSTALL(${ARGN}) + ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) + ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "readme") + IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) + INSTALL(${ARGN}) + ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) + ENDIF(UHD_INSTALL_COMPONENT STREQUAL "headers") +ENDFUNCTION(UHD_INSTALL) + +######################################################################## # Print the registered component summary ######################################################################## FUNCTION(UHD_PRINT_COMPONENT_SUMMARY) diff --git a/host/cmake/Modules/UHDPackage.cmake b/host/cmake/Modules/UHDPackage.cmake index 5e2303ff8..67a6bc588 100644 --- a/host/cmake/Modules/UHDPackage.cmake +++ b/host/cmake/Modules/UHDPackage.cmake @@ -1,5 +1,5 @@ # -# Copyright 2010-2012 Ettus Research LLC +# Copyright 2010-2013 Ettus Research LLC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -55,23 +55,31 @@ ENDIF() ######################################################################## # Setup package file name ######################################################################## -FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release) -IF((DEBIAN OR REDHAT) AND LSB_RELEASE_EXECUTABLE) - - #extract system information by executing the commands - EXECUTE_PROCESS( - COMMAND ${LSB_RELEASE_EXECUTABLE} --short --id - OUTPUT_VARIABLE LSB_ID OUTPUT_STRIP_TRAILING_WHITESPACE - ) - EXECUTE_PROCESS( - COMMAND ${LSB_RELEASE_EXECUTABLE} --short --release - OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - #set a more sensible package name for this system - SET(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_${LSB_ID}-${LSB_RELEASE}-${CMAKE_SYSTEM_PROCESSOR}") +IF(DEBIAN AND LIBUHD_PKG) + SET(CPACK_PACKAGE_FILE_NAME "libuhd${UHD_VERSION_MAJOR}_${TRIMMED_UHD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}") +ELSEIF(DEBIAN AND LIBUHDDEV_PKG) + SET(CPACK_PACKAGE_FILE_NAME "libuhd-dev_${TRIMMED_UHD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}") +ELSEIF(DEBIAN AND UHDHOST_PKG) + SET(CPACK_PACKAGE_FILE_NAME "uhd-host_${TRIMMED_UHD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}") +ELSE() + FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release) + IF((DEBIAN OR REDHAT) AND LSB_RELEASE_EXECUTABLE) + + #extract system information by executing the commands + EXECUTE_PROCESS( + COMMAND ${LSB_RELEASE_EXECUTABLE} --short --id + OUTPUT_VARIABLE LSB_ID OUTPUT_STRIP_TRAILING_WHITESPACE + ) + EXECUTE_PROCESS( + COMMAND ${LSB_RELEASE_EXECUTABLE} --short --release + OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + #set a more sensible package name for this system + SET(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_${LSB_ID}-${LSB_RELEASE}-${CMAKE_SYSTEM_PROCESSOR}") ENDIF() +ENDIF(DEBIAN AND LIBUHD_PKG) IF(${CPACK_GENERATOR} STREQUAL NSIS) diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake index 01cd2741e..c81e9510b 100644 --- a/host/cmake/Modules/UHDVersion.cmake +++ b/host/cmake/Modules/UHDVersion.cmake @@ -30,7 +30,7 @@ SET(UHD_VERSION_MINOR 005) SET(UHD_VERSION_PATCH 003) ######################################################################## -# Set up DLL resource version numbers +# Set up trimmed version numbers for DLL resource files and packages ######################################################################## FUNCTION(DEPAD_NUM input_num output_num) @@ -42,9 +42,10 @@ FUNCTION(DEPAD_NUM input_num output_num) SET(${output_num} ${depadded_num} PARENT_SCOPE) ENDFUNCTION(DEPAD_NUM) -DEPAD_NUM(${UHD_VERSION_MAJOR} RC_VERSION_MAJOR) -DEPAD_NUM(${UHD_VERSION_MINOR} RC_VERSION_MINOR) -DEPAD_NUM(${UHD_VERSION_PATCH} RC_VERSION_PATCH) +DEPAD_NUM(${UHD_VERSION_MAJOR} TRIMMED_VERSION_MAJOR) +DEPAD_NUM(${UHD_VERSION_MINOR} TRIMMED_VERSION_MINOR) +DEPAD_NUM(${UHD_VERSION_PATCH} TRIMMED_VERSION_PATCH) +SET(TRIMMED_UHD_VERSION "${TRIMMED_VERSION_MAJOR}.${TRIMMED_VERSION_MINOR}.${TRIMMED_VERSION_PATCH}") ######################################################################## # Version information discovery through git log |