From 2dfec0af4a159b4f886180a0f7448ce37a75aac1 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 26 Dec 2010 00:56:13 -0800 Subject: usrp-e100: added check for linux when configuring --- host/lib/usrp/usrp_e100/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/usrp/usrp_e100/CMakeLists.txt b/host/lib/usrp/usrp_e100/CMakeLists.txt index 5d8a9791d..c32dd87f8 100644 --- a/host/lib/usrp/usrp_e100/CMakeLists.txt +++ b/host/lib/usrp/usrp_e100/CMakeLists.txt @@ -22,7 +22,11 @@ ######################################################################## # Conditionally configure the USRP-E100 support ######################################################################## -LIBUHD_REGISTER_COMPONENT("USRP-E100" ENABLE_USRP_E100 OFF "ENABLE_LIBUHD" ON) +IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + SET(LINUX_TARGET TRUE) +ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + +LIBUHD_REGISTER_COMPONENT("USRP-E100" ENABLE_USRP_E100 OFF "ENABLE_LIBUHD;LINUX_TARGET" OFF) IF(ENABLE_USRP_E100) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -- cgit v1.2.3 From 8dffb7d5a6f3ff0390ca01dcd15200689b874b30 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 27 Dec 2010 14:10:27 -0800 Subject: cmake: moved module files into modules directory, set modules path --- host/CMakeLists.txt | 23 ++++++---- host/Modules/FindUSB1.cmake | 38 ++++++++++++++++ host/Modules/UHDComponent.cmake | 86 ++++++++++++++++++++++++++++++++++++ host/Modules/UHDPackage.cmake | 44 ++++++++++++++++++ host/Modules/UHDPython.cmake | 69 +++++++++++++++++++++++++++++ host/Modules/UHDVersion.cmake | 68 ++++++++++++++++++++++++++++ host/cmake_uninstall.cmake.in | 23 ++++++++++ host/config/CPack.cmake | 42 ------------------ host/config/Component.cmake | 86 ------------------------------------ host/config/Python.cmake | 69 ----------------------------- host/config/Version.cmake | 65 --------------------------- host/config/cmake_uninstall.cmake.in | 23 ---------- host/lib/CMakeLists.txt | 2 + host/lib/transport/CMakeLists.txt | 3 +- host/lib/transport/FindUSB1.cmake | 38 ---------------- images/CMakeLists.txt | 11 +++-- 16 files changed, 350 insertions(+), 340 deletions(-) create mode 100644 host/Modules/FindUSB1.cmake create mode 100644 host/Modules/UHDComponent.cmake create mode 100644 host/Modules/UHDPackage.cmake create mode 100644 host/Modules/UHDPython.cmake create mode 100644 host/Modules/UHDVersion.cmake create mode 100644 host/cmake_uninstall.cmake.in delete mode 100644 host/config/CPack.cmake delete mode 100644 host/config/Component.cmake delete mode 100644 host/config/Python.cmake delete mode 100644 host/config/Version.cmake delete mode 100644 host/config/cmake_uninstall.cmake.in delete mode 100644 host/lib/transport/FindUSB1.cmake (limited to 'host/lib') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index efc439af0..60c53ba9a 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -15,21 +15,25 @@ # along with this program. If not, see . # -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(UHD CXX) -ENABLE_TESTING() +######################################################################## +IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + MESSAGE(FATAL_ERROR "Prevented in-tree built. This is bad practice.") +ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) ######################################################################## -# Config Files (include order is important) +# Project setup ######################################################################## -INCLUDE(${CMAKE_SOURCE_DIR}/config/Component.cmake) -INCLUDE(${CMAKE_SOURCE_DIR}/config/Python.cmake) -INCLUDE(${CMAKE_SOURCE_DIR}/config/Version.cmake) -INCLUDE(${CMAKE_SOURCE_DIR}/config/CPack.cmake) +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(UHD CXX) +ENABLE_TESTING() +LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Modules) +INCLUDE(UHDComponent) #enable components +INCLUDE(UHDPackage) #setup cpack ######################################################################## # Install Dirs ######################################################################## +SET(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") SET(RUNTIME_DIR bin) SET(LIBRARY_DIR lib${LIB_SUFFIX}) SET(INCLUDE_DIR include) @@ -102,7 +106,7 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) # Create Uninstall Target ######################################################################## CONFIGURE_FILE( - ${CMAKE_SOURCE_DIR}/config/cmake_uninstall.cmake.in + ${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY) @@ -168,4 +172,5 @@ ENDIF(ENABLE_UTILS) # Print Summary ######################################################################## UHD_PRINT_COMPONENT_SUMMARY() +MESSAGE(STATUS "Building version: ${CPACK_PACKAGE_VERSION}") MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}") diff --git a/host/Modules/FindUSB1.cmake b/host/Modules/FindUSB1.cmake new file mode 100644 index 000000000..ebcac99eb --- /dev/null +++ b/host/Modules/FindUSB1.cmake @@ -0,0 +1,38 @@ +# - Try to find the freetype library +# Once done this defines +# +# LIBUSB_FOUND - system has libusb +# LIBUSB_INCLUDE_DIR - the libusb include directory +# LIBUSB_LIBRARIES - Link these to use libusb + +# Copyright (c) 2006, 2008 Laurent Montel, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) + + # in cache already + 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) + + FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h + PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS}) + + FIND_LIBRARY(LIBUSB_LIBRARIES NAMES usb-1.0 + PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS}) + + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR) + + MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) + +endif (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) diff --git a/host/Modules/UHDComponent.cmake b/host/Modules/UHDComponent.cmake new file mode 100644 index 000000000..0263b071f --- /dev/null +++ b/host/Modules/UHDComponent.cmake @@ -0,0 +1,86 @@ +# +# Copyright 2010 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +######################################################################## +SET(_uhd_enabled_components "" CACHE INTERNAL "" FORCE) +SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE) + +######################################################################## +# Register a component into the system +# - name the component string name +# - var the global enable variable +# - enb the default enable setting +# - deps a list of dependencies +# - dis the default disable setting +######################################################################## +FUNCTION(LIBUHD_REGISTER_COMPONENT name var enb deps dis) + INCLUDE(CMakeDependentOption) + MESSAGE(STATUS "") + MESSAGE(STATUS "Configuring ${name} support...") + IF(DEFINED ${var}) + MESSAGE(STATUS "${name} support configured ${var}=${${var}}") + ELSE(DEFINED ${var}) #not defined: automatic enabling of component + MESSAGE(STATUS "${name} support configured automatically") + ENDIF(DEFINED ${var}) + + #setup the dependent option for this component + CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${enb} "${deps}" ${dis}) + + #remove previous occurrence of component in either list + IF(DEFINED _uhd_enabled_components) + LIST(REMOVE_ITEM _uhd_enabled_components ${name}) + ENDIF(DEFINED _uhd_enabled_components) + IF(DEFINED _uhd_disabled_components) + LIST(REMOVE_ITEM _uhd_disabled_components ${name}) + ENDIF(DEFINED _uhd_disabled_components) + + #append the component into one of the lists + IF(${var}) + MESSAGE(STATUS " Enabling ${name} support.") + LIST(APPEND _uhd_enabled_components ${name}) + ELSE(${var}) + MESSAGE(STATUS " Disabling ${name} support.") + LIST(APPEND _uhd_disabled_components ${name}) + ENDIF(${var}) + + #make components lists into global variables + SET(_uhd_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE) + SET(_uhd_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE) +ENDFUNCTION(LIBUHD_REGISTER_COMPONENT) + +######################################################################## +# Print the registered component summary +######################################################################## +FUNCTION(UHD_PRINT_COMPONENT_SUMMARY) + MESSAGE(STATUS "") + MESSAGE(STATUS "######################################################") + MESSAGE(STATUS "# LibUHD enabled components ") + MESSAGE(STATUS "######################################################") + FOREACH(comp ${_uhd_enabled_components}) + MESSAGE(STATUS " * ${comp}") + ENDFOREACH(comp) + + MESSAGE(STATUS "") + MESSAGE(STATUS "######################################################") + MESSAGE(STATUS "# LibUHD disabled components ") + MESSAGE(STATUS "######################################################") + FOREACH(comp ${_uhd_disabled_components}) + MESSAGE(STATUS " * ${comp}") + ENDFOREACH(comp) + + MESSAGE(STATUS "") +ENDFUNCTION(UHD_PRINT_COMPONENT_SUMMARY) diff --git a/host/Modules/UHDPackage.cmake b/host/Modules/UHDPackage.cmake new file mode 100644 index 000000000..2a11d407b --- /dev/null +++ b/host/Modules/UHDPackage.cmake @@ -0,0 +1,44 @@ +# +# Copyright 2010 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +######################################################################## +INCLUDE(UHDVersion) #sets version information + +######################################################################## +# Setup CPack +######################################################################## +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - Universal Hardware Driver") +SET(CPACK_PACKAGE_VENDOR "Ettus Research LLC") +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_DEBIAN_PACKAGE_RECOMMENDS "python, python-tk") +SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel >= ${BOOST_MIN_VERSION}") +INCLUDE(CPack) #include after setting vars diff --git a/host/Modules/UHDPython.cmake b/host/Modules/UHDPython.cmake new file mode 100644 index 000000000..49f74ae88 --- /dev/null +++ b/host/Modules/UHDPython.cmake @@ -0,0 +1,69 @@ +# +# Copyright 2010 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +######################################################################## +# Setup Python +######################################################################## +#this allows the user to override PYTHON_EXECUTABLE +IF(PYTHON_EXECUTABLE) + + SET(PYTHONINTERP_FOUND TRUE) + +#otherwise if not set, try to automatically find it +ELSE(PYTHON_EXECUTABLE) + + #use the built-in find script + FIND_PACKAGE(PythonInterp) + + #and if that fails use the find program routine + IF(NOT PYTHONINTERP_FOUND) + FIND_PROGRAM(PYTHON_EXECUTABLE python) + IF(PYTHON_EXECUTABLE) + SET(PYTHONINTERP_FOUND TRUE) + ENDIF(PYTHON_EXECUTABLE) + ENDIF(NOT PYTHONINTERP_FOUND) + +ENDIF(PYTHON_EXECUTABLE) + +#make the path to the executable appear in the cmake gui +SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE PYTHON_EXECUTABLE "python interpreter") + +IF(NOT PYTHONINTERP_FOUND) + MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.") +ENDIF(NOT PYTHONINTERP_FOUND) + +MACRO(PYTHON_CHECK_MODULE desc mod cmd have) + MESSAGE(STATUS "") + MESSAGE(STATUS "Python checking for ${desc}") + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c " +######################################### +try: import ${mod} +except: exit(-1) +try: assert ${cmd} +except: exit(-1) +#########################################" + 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") + SET(${have} FALSE) + ENDIF(${have} EQUAL 0) +ENDMACRO(PYTHON_CHECK_MODULE) diff --git a/host/Modules/UHDVersion.cmake b/host/Modules/UHDVersion.cmake new file mode 100644 index 000000000..fc2e2bbbd --- /dev/null +++ b/host/Modules/UHDVersion.cmake @@ -0,0 +1,68 @@ +# +# Copyright 2010 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +######################################################################## +INCLUDE(UHDPython) #requires python for parsing + +######################################################################## +# Setup Version Numbers +######################################################################## +SET(UHD_VERSION_MAJOR 0001) #API compatibility number +SET(UHD_VERSION_MINOR 0) #Timestamp of git commit +SET(UHD_VERSION_PATCH 0) #Short hash of git commit + +######################################################################## +# Find GIT to get repo information +######################################################################## +MESSAGE(STATUS "") +MESSAGE(STATUS "Checking for git") +FIND_PROGRAM(GIT git) +IF(GIT) + MESSAGE(STATUS "Checking for git - found") + + #grab the git log entry for the current head + EXECUTE_PROCESS( + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${GIT} log HEAD~..HEAD --date=raw + 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}) + + #grab the git ref id for the current head + EXECUTE_PROCESS( + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${GIT} rev-parse --short HEAD + OUTPUT_VARIABLE _git_rev OUTPUT_STRIP_TRAILING_WHITESPACE + ) + SET(UHD_VERSION_PATCH ${_git_rev}) + +ELSE(GIT) + MESSAGE(STATUS "Checking for git - not found") +ENDIF(GIT) diff --git a/host/cmake_uninstall.cmake.in b/host/cmake_uninstall.cmake.in new file mode 100644 index 000000000..6031a6ca9 --- /dev/null +++ b/host/cmake_uninstall.cmake.in @@ -0,0 +1,23 @@ +# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F + +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + IF(EXISTS "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) + ELSE(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + ENDIF(EXISTS "$ENV{DESTDIR}${file}") +ENDFOREACH(file) diff --git a/host/config/CPack.cmake b/host/config/CPack.cmake deleted file mode 100644 index a86f452f9..000000000 --- a/host/config/CPack.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# -# Copyright 2010 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 -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -######################################################################## -# Setup CPack -######################################################################## -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - Universal Hardware Driver") -SET(CPACK_PACKAGE_VENDOR "Ettus Research LLC") -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_DEBIAN_PACKAGE_RECOMMENDS "python, python-tk") -SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel >= ${BOOST_MIN_VERSION}") -INCLUDE(CPack) #include after setting vars -MESSAGE(STATUS "Version: ${CPACK_PACKAGE_VERSION}") diff --git a/host/config/Component.cmake b/host/config/Component.cmake deleted file mode 100644 index 0263b071f..000000000 --- a/host/config/Component.cmake +++ /dev/null @@ -1,86 +0,0 @@ -# -# Copyright 2010 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 -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -######################################################################## -SET(_uhd_enabled_components "" CACHE INTERNAL "" FORCE) -SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE) - -######################################################################## -# Register a component into the system -# - name the component string name -# - var the global enable variable -# - enb the default enable setting -# - deps a list of dependencies -# - dis the default disable setting -######################################################################## -FUNCTION(LIBUHD_REGISTER_COMPONENT name var enb deps dis) - INCLUDE(CMakeDependentOption) - MESSAGE(STATUS "") - MESSAGE(STATUS "Configuring ${name} support...") - IF(DEFINED ${var}) - MESSAGE(STATUS "${name} support configured ${var}=${${var}}") - ELSE(DEFINED ${var}) #not defined: automatic enabling of component - MESSAGE(STATUS "${name} support configured automatically") - ENDIF(DEFINED ${var}) - - #setup the dependent option for this component - CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${enb} "${deps}" ${dis}) - - #remove previous occurrence of component in either list - IF(DEFINED _uhd_enabled_components) - LIST(REMOVE_ITEM _uhd_enabled_components ${name}) - ENDIF(DEFINED _uhd_enabled_components) - IF(DEFINED _uhd_disabled_components) - LIST(REMOVE_ITEM _uhd_disabled_components ${name}) - ENDIF(DEFINED _uhd_disabled_components) - - #append the component into one of the lists - IF(${var}) - MESSAGE(STATUS " Enabling ${name} support.") - LIST(APPEND _uhd_enabled_components ${name}) - ELSE(${var}) - MESSAGE(STATUS " Disabling ${name} support.") - LIST(APPEND _uhd_disabled_components ${name}) - ENDIF(${var}) - - #make components lists into global variables - SET(_uhd_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE) - SET(_uhd_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE) -ENDFUNCTION(LIBUHD_REGISTER_COMPONENT) - -######################################################################## -# Print the registered component summary -######################################################################## -FUNCTION(UHD_PRINT_COMPONENT_SUMMARY) - MESSAGE(STATUS "") - MESSAGE(STATUS "######################################################") - MESSAGE(STATUS "# LibUHD enabled components ") - MESSAGE(STATUS "######################################################") - FOREACH(comp ${_uhd_enabled_components}) - MESSAGE(STATUS " * ${comp}") - ENDFOREACH(comp) - - MESSAGE(STATUS "") - MESSAGE(STATUS "######################################################") - MESSAGE(STATUS "# LibUHD disabled components ") - MESSAGE(STATUS "######################################################") - FOREACH(comp ${_uhd_disabled_components}) - MESSAGE(STATUS " * ${comp}") - ENDFOREACH(comp) - - MESSAGE(STATUS "") -ENDFUNCTION(UHD_PRINT_COMPONENT_SUMMARY) diff --git a/host/config/Python.cmake b/host/config/Python.cmake deleted file mode 100644 index 49f74ae88..000000000 --- a/host/config/Python.cmake +++ /dev/null @@ -1,69 +0,0 @@ -# -# Copyright 2010 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 -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -######################################################################## -# Setup Python -######################################################################## -#this allows the user to override PYTHON_EXECUTABLE -IF(PYTHON_EXECUTABLE) - - SET(PYTHONINTERP_FOUND TRUE) - -#otherwise if not set, try to automatically find it -ELSE(PYTHON_EXECUTABLE) - - #use the built-in find script - FIND_PACKAGE(PythonInterp) - - #and if that fails use the find program routine - IF(NOT PYTHONINTERP_FOUND) - FIND_PROGRAM(PYTHON_EXECUTABLE python) - IF(PYTHON_EXECUTABLE) - SET(PYTHONINTERP_FOUND TRUE) - ENDIF(PYTHON_EXECUTABLE) - ENDIF(NOT PYTHONINTERP_FOUND) - -ENDIF(PYTHON_EXECUTABLE) - -#make the path to the executable appear in the cmake gui -SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE PYTHON_EXECUTABLE "python interpreter") - -IF(NOT PYTHONINTERP_FOUND) - MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.") -ENDIF(NOT PYTHONINTERP_FOUND) - -MACRO(PYTHON_CHECK_MODULE desc mod cmd have) - MESSAGE(STATUS "") - MESSAGE(STATUS "Python checking for ${desc}") - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c " -######################################### -try: import ${mod} -except: exit(-1) -try: assert ${cmd} -except: exit(-1) -#########################################" - 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") - SET(${have} FALSE) - ENDIF(${have} EQUAL 0) -ENDMACRO(PYTHON_CHECK_MODULE) diff --git a/host/config/Version.cmake b/host/config/Version.cmake deleted file mode 100644 index 839db7833..000000000 --- a/host/config/Version.cmake +++ /dev/null @@ -1,65 +0,0 @@ -# -# Copyright 2010 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 -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -######################################################################## -# Setup Version Numbers -######################################################################## -SET(UHD_VERSION_MAJOR 0001) #API compatibility number -SET(UHD_VERSION_MINOR 0) #Timestamp of git commit -SET(UHD_VERSION_PATCH 0) #Short hash of git commit - -######################################################################## -# Find GIT to get repo information -######################################################################## -MESSAGE(STATUS "") -MESSAGE(STATUS "Checking for git") -FIND_PROGRAM(GIT git) -IF(${GIT} STREQUAL "GIT-NOTFOUND") - MESSAGE(STATUS "Checking for git - not found") -ELSE(${GIT} STREQUAL "GIT-NOTFOUND") - MESSAGE(STATUS "Checking for git - found") - - #grab the git log entry for the current head - EXECUTE_PROCESS( - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${GIT} log HEAD~..HEAD --date=raw - 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}) - - #grab the git ref id for the current head - EXECUTE_PROCESS( - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${GIT} rev-parse --short HEAD - OUTPUT_VARIABLE _git_rev OUTPUT_STRIP_TRAILING_WHITESPACE - ) - SET(UHD_VERSION_PATCH ${_git_rev}) - -ENDIF(${GIT} STREQUAL "GIT-NOTFOUND") diff --git a/host/config/cmake_uninstall.cmake.in b/host/config/cmake_uninstall.cmake.in deleted file mode 100644 index 6031a6ca9..000000000 --- a/host/config/cmake_uninstall.cmake.in +++ /dev/null @@ -1,23 +0,0 @@ -# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F - -IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") -ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - -FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) -STRING(REGEX REPLACE "\n" ";" files "${files}") -FOREACH(file ${files}) - MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") - IF(EXISTS "$ENV{DESTDIR}${file}") - EXEC_PROGRAM( - "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval - ) - IF(NOT "${rm_retval}" STREQUAL 0) - MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") - ENDIF(NOT "${rm_retval}" STREQUAL 0) - ELSE(EXISTS "$ENV{DESTDIR}${file}") - MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") - ENDIF(EXISTS "$ENV{DESTDIR}${file}") -ENDFOREACH(file) diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 28e4bcca2..fa5d6b67b 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -18,6 +18,8 @@ ######################################################################## # Check Python Modules ######################################################################## +INCLUDE(UHDPython) + PYTHON_CHECK_MODULE( "Python version 2.6 or greater" "platform" "platform.python_version() >= '2.6'" diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt index de2f1fdd0..5602e47a7 100644 --- a/host/lib/transport/CMakeLists.txt +++ b/host/lib/transport/CMakeLists.txt @@ -22,8 +22,7 @@ ######################################################################## # Setup libusb ######################################################################## -LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) -FIND_PACKAGE(USB1 REQUIRED) +FIND_PACKAGE(USB1) LIBUHD_REGISTER_COMPONENT("USB" ENABLE_USB ON "ENABLE_LIBUHD;LIBUSB_FOUND" OFF) diff --git a/host/lib/transport/FindUSB1.cmake b/host/lib/transport/FindUSB1.cmake deleted file mode 100644 index ebcac99eb..000000000 --- a/host/lib/transport/FindUSB1.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# - Try to find the freetype library -# Once done this defines -# -# LIBUSB_FOUND - system has libusb -# LIBUSB_INCLUDE_DIR - the libusb include directory -# LIBUSB_LIBRARIES - Link these to use libusb - -# Copyright (c) 2006, 2008 Laurent Montel, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -if (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) - - # in cache already - 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) - - FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h - PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS}) - - FIND_LIBRARY(LIBUSB_LIBRARIES NAMES usb-1.0 - PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS}) - - include(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR) - - MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) - -endif (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) diff --git a/images/CMakeLists.txt b/images/CMakeLists.txt index 75cb4c9d3..ee8146f3a 100644 --- a/images/CMakeLists.txt +++ b/images/CMakeLists.txt @@ -15,14 +15,13 @@ # along with this program. If not, see . # -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(UHD-images NONE) - ######################################################################## -# Config Files (include order is important) +# Setup Project ######################################################################## -INCLUDE(${CMAKE_SOURCE_DIR}/../host/config/Python.cmake) -INCLUDE(${CMAKE_SOURCE_DIR}/../host/config/Version.cmake) +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(UHD-images NONE) +LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../host/Modules) +INCLUDE(UHDVersion) #sets version variables (used below) ######################################################################## # Setup CPack -- cgit v1.2.3