summaryrefslogtreecommitdiffstats
path: root/host/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'host/Modules')
-rw-r--r--host/Modules/FindUSB1.cmake6
-rw-r--r--host/Modules/UHDComponent.cmake2
-rw-r--r--host/Modules/UHDPackage.cmake144
-rw-r--r--host/Modules/UHDPython.cmake29
-rw-r--r--host/Modules/UHDVersion.cmake54
5 files changed, 182 insertions, 53 deletions
diff --git a/host/Modules/FindUSB1.cmake b/host/Modules/FindUSB1.cmake
index ebcac99eb..efb2e288b 100644
--- a/host/Modules/FindUSB1.cmake
+++ b/host/Modules/FindUSB1.cmake
@@ -17,12 +17,12 @@ if (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
set(LIBUSB_FOUND TRUE)
else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
- IF (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
- pkg_check_modules(PC_LIBUSB libusb-1.0)
- ENDIF(NOT WIN32)
+ IF(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LIBUSB libusb-1.0)
+ ENDIF(PKG_CONFIG_FOUND)
FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h
PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS})
diff --git a/host/Modules/UHDComponent.cmake b/host/Modules/UHDComponent.cmake
index 4ea55bbb9..52b7450d5 100644
--- a/host/Modules/UHDComponent.cmake
+++ b/host/Modules/UHDComponent.cmake
@@ -1,5 +1,5 @@
#
-# Copyright 2010 Ettus Research LLC
+# Copyright 2010-2011 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
diff --git a/host/Modules/UHDPackage.cmake b/host/Modules/UHDPackage.cmake
index 2a11d407b..416d89998 100644
--- a/host/Modules/UHDPackage.cmake
+++ b/host/Modules/UHDPackage.cmake
@@ -1,5 +1,5 @@
#
-# Copyright 2010 Ettus Research LLC
+# Copyright 2010-2011 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
@@ -19,7 +19,64 @@
INCLUDE(UHDVersion) #sets version information
########################################################################
-# Setup CPack
+# Setup additional defines for OS types
+########################################################################
+IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ SET(LINUX TRUE)
+ENDIF()
+
+IF(LINUX AND EXISTS "/etc/debian_version")
+ SET(DEBIAN TRUE)
+ENDIF()
+
+IF(LINUX AND EXISTS "/etc/redhat-release")
+ SET(REDHAT TRUE)
+ENDIF()
+
+########################################################################
+# Setup package file name
+########################################################################
+IF(UHD_RELEASE_MODE)
+
+ #set generator type for recognized systems
+ IF(APPLE)
+ SET(CPACK_GENERATOR PackageMaker)
+ ELSEIF(WIN32)
+ SET(CPACK_GENERATOR NSIS)
+ ELSEIF(DEBIAN)
+ SET(CPACK_GENERATOR DEB)
+ ELSEIF(REDHAT)
+ SET(CPACK_GENERATOR RPM)
+ ELSE()
+ SET(CPACK_GENERATOR TGZ)
+ ENDIF()
+
+ FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release)
+ IF(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(LSB_RELEASE_EXECUTABLE)
+
+ IF(${CPACK_GENERATOR} STREQUAL NSIS)
+ SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}")
+ ENDIF()
+
+ENDIF(UHD_RELEASE_MODE)
+
+########################################################################
+# Setup CPack General
########################################################################
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - Universal Hardware Driver")
SET(CPACK_PACKAGE_VENDOR "Ettus Research LLC")
@@ -27,18 +84,75 @@ SET(CPACK_PACKAGE_CONTACT "support@ettus.com")
SET(CPACK_PACKAGE_VERSION_MAJOR ${UHD_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${UHD_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${UHD_VERSION_PATCH})
-SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README)
-SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
-SET(BOOST_MIN_VERSION 1.36) #used in setup for boost
-STRING(REPLACE "," ", " CPACK_DEBIAN_PACKAGE_DEPENDS
- "libboost-date-time-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-filesystem-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-program-options-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-regex-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-system-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-test-dev (>= ${BOOST_MIN_VERSION}),"
- "libboost-thread-dev (>= ${BOOST_MIN_VERSION})"
-)
+SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.txt)
+SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/AUTHORS.txt)
+SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
+
+########################################################################
+# Setup CPack Components
+########################################################################
+SET(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
+SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
+SET(CPACK_COMPONENT_UTILITIES_GROUP "Runtime")
+SET(CPACK_COMPONENT_EXAMPLES_GROUP "Runtime")
+SET(CPACK_COMPONENT_TESTS_GROUP "Runtime")
+SET(CPACK_COMPONENT_MANUAL_GROUP "Documentation")
+SET(CPACK_COMPONENT_DOXYGEN_GROUP "Documentation")
+SET(CPACK_COMPONENT_README_GROUP "Documentation")
+
+SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
+SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers")
+SET(CPACK_COMPONENT_UTILITIES_DISPLAY_NAME "Utilities")
+SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples")
+SET(CPACK_COMPONENT_TESTS_DISPLAY_NAME "Unit Tests")
+SET(CPACK_COMPONENT_MANUAL_DISPLAY_NAME "Manual")
+SET(CPACK_COMPONENT_DOXYGEN_DISPLAY_NAME "Doxygen")
+SET(CPACK_COMPONENT_README_DISPLAY_NAME "Readme")
+SET(CPACK_COMPONENT_IMAGES_DISPLAY_NAME "Images")
+
+SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Dynamic link library")
+SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "C++ development headers")
+SET(CPACK_COMPONENT_UTILITIES_DESCRIPTION "Utility executables and python scripts")
+SET(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Example executables")
+SET(CPACK_COMPONENT_TESTS_DESCRIPTION "Unit test executables")
+SET(CPACK_COMPONENT_MANUAL_DESCRIPTION "Manual/application notes (rst and html)")
+SET(CPACK_COMPONENT_DOXYGEN_DESCRIPTION "API documentation (html)")
+SET(CPACK_COMPONENT_README_DESCRIPTION "Readme files (txt)")
+SET(CPACK_COMPONENT_IMAGES_DESCRIPTION "FPGA and firmware images")
+
+SET(CPACK_COMPONENT_README_REQUIRED TRUE)
+
+SET(CPACK_COMPONENT_UTILITIES_DEPENDS libraries)
+SET(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries)
+SET(CPACK_COMPONENT_TESTS_DEPENDS libraries)
+
+SET(CPACK_COMPONENTS_ALL libraries headers utilities examples tests manual doxygen readme images)
+
+########################################################################
+# Setup CPack Debian
+########################################################################
+SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libusb-1.0-0, libboost-dev")
SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS "python, python-tk")
-SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel >= ${BOOST_MIN_VERSION}")
+
+########################################################################
+# Setup CPack RPM
+########################################################################
+SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel, libusb1")
+
+########################################################################
+# Setup CPack NSIS
+########################################################################
+SET(CPACK_NSIS_MODIFY_PATH ON)
+
+SET(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"")
+
+SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
+ WriteRegStr HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\" \\\"$INSTDIR\\\\share\\\\uhd\\\"
+")
+
+SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
+ DeleteRegValue HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\"
+")
+
+########################################################################
INCLUDE(CPack) #include after setting vars
diff --git a/host/Modules/UHDPython.cmake b/host/Modules/UHDPython.cmake
index 345e0187d..fdcdccb4b 100644
--- a/host/Modules/UHDPython.cmake
+++ b/host/Modules/UHDPython.cmake
@@ -1,5 +1,5 @@
#
-# Copyright 2010 Ettus Research LLC
+# Copyright 2010-2011 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
@@ -15,9 +15,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+IF(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE)
+SET(INCLUDED_UHD_PYTHON_CMAKE TRUE)
+
########################################################################
# Setup Python
########################################################################
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Configuring the python interpreter...")
#this allows the user to override PYTHON_EXECUTABLE
IF(PYTHON_EXECUTABLE)
@@ -42,6 +47,9 @@ ENDIF(PYTHON_EXECUTABLE)
#make the path to the executable appear in the cmake gui
SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
+MESSAGE(STATUS "Python interpreter: ${PYTHON_EXECUTABLE}")
+MESSAGE(STATUS "Override with: -DPYTHON_EXECUTABLE=<path-to-python>")
+
IF(NOT PYTHONINTERP_FOUND)
MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.")
ENDIF(NOT PYTHONINTERP_FOUND)
@@ -53,17 +61,26 @@ MACRO(PYTHON_CHECK_MODULE desc mod cmd have)
COMMAND ${PYTHON_EXECUTABLE} -c "
#########################################
try: import ${mod}
-except: exit(-1)
+except: exit(1)
try: assert ${cmd}
-except: exit(-1)
+except: exit(2)
+exit(0)
#########################################"
RESULT_VARIABLE ${have}
)
IF(${have} EQUAL 0)
MESSAGE(STATUS "Python checking for ${desc} - found")
SET(${have} TRUE)
- ELSE(${have} EQUAL 0)
- MESSAGE(STATUS "Python checking for ${desc} - not found")
+ ELSEIF(${have} EQUAL 1)
+ MESSAGE(STATUS "Python checking for ${desc} - \"import ${mod}\" failed")
+ SET(${have} FALSE)
+ ELSEIF(${have} EQUAL 2)
+ MESSAGE(STATUS "Python checking for ${desc} - \"assert ${cmd}\" failed")
SET(${have} FALSE)
- ENDIF(${have} EQUAL 0)
+ ELSE()
+ MESSAGE(STATUS "Python checking for ${desc} - unknown error")
+ SET(${have} FALSE)
+ ENDIF()
ENDMACRO(PYTHON_CHECK_MODULE)
+
+ENDIF(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE)
diff --git a/host/Modules/UHDVersion.cmake b/host/Modules/UHDVersion.cmake
index b0b2ae475..86d3133a8 100644
--- a/host/Modules/UHDVersion.cmake
+++ b/host/Modules/UHDVersion.cmake
@@ -17,46 +17,44 @@
########################################################################
INCLUDE(UHDPython) #requires python for parsing
+FIND_PACKAGE(Git QUIET)
########################################################################
# Setup Version Numbers
+# - increment major on api compatibility changes
+# - increment minor on feature-level changes
+# - increment patch on for bug fixes and docs
########################################################################
-SET(UHD_VERSION_MAJOR 003) #API compatibility number
-SET(UHD_VERSION_MINOR 0) #Timestamp of git commit
-SET(UHD_VERSION_PATCH 0) #Short hash of git commit
+SET(UHD_VERSION_MAJOR 003)
+SET(UHD_VERSION_MINOR 000)
+SET(UHD_VERSION_PATCH 001)
########################################################################
-# Find GIT to get repo information
+# Version information discovery through git log
########################################################################
-FIND_PACKAGE(Git QUIET)
-IF(GIT_FOUND)
+IF(UHD_RELEASE_MODE)
+ SET(UHD_BUILD_INFO_DISCOVERY FALSE)
+ SET(UHD_BUILD_INFO "release")
+ELSE()
+ SET(UHD_BUILD_INFO_DISCOVERY GIT_FOUND)
+ SET(UHD_BUILD_INFO "unknown")
+ENDIF()
- #grab the git log entry for the current head
- EXECUTE_PROCESS(
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- COMMAND ${GIT_EXECUTABLE} log HEAD~..HEAD --date=raw -n1
- OUTPUT_VARIABLE _git_log OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- #extract the timestamp from the git log entry
- EXECUTE_PROCESS(
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- COMMAND ${PYTHON_EXECUTABLE} -c "import re; print re.match('^.*Date:\\s*(\\d*).*$', ''' ${_git_log} ''', re.MULTILINE | re.DOTALL).groups()[0]"
- OUTPUT_VARIABLE _git_timestamp OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- #format the timestamp into YYYY-MM-DD-HH-MM-SS
- EXECUTE_PROCESS(
- COMMAND ${PYTHON_EXECUTABLE} -c "import time; print time.strftime('%Y%m%d%H%M%S', time.gmtime(${_git_timestamp}))"
- OUTPUT_VARIABLE _git_date OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- SET(UHD_VERSION_MINOR ${_git_date})
+IF(UHD_BUILD_INFO_DISCOVERY)
#grab the git ref id for the current head
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
OUTPUT_VARIABLE _git_rev OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE _git_rev_result
)
- SET(UHD_VERSION_PATCH ${_git_rev})
-ENDIF(GIT_FOUND)
+
+ #only set the build info on success
+ IF(_git_rev_result EQUAL 0)
+ SET(UHD_BUILD_INFO ${_git_rev})
+ ENDIF()
+ENDIF(UHD_BUILD_INFO_DISCOVERY)
+
+########################################################################
+SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}")