From 32357927bdc52b0cc7cd7b6d18457932aaa79682 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 29 Mar 2011 13:42:40 -0700 Subject: uhd: remove build information in the version string (just major.minor.patch) Add the build info as an additional string to the get_version function(). --- host/lib/constants.hpp.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'host/lib/constants.hpp.in') diff --git a/host/lib/constants.hpp.in b/host/lib/constants.hpp.in index 4aedb6d4a..d62dda1cb 100644 --- a/host/lib/constants.hpp.in +++ b/host/lib/constants.hpp.in @@ -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,7 @@ #define INCLUDED_LIBUHD_CONSTANTS_HPP //these should be pre-processor macros to avoid static initialization issues -#define UHD_VERSION_STRING "@CPACK_PACKAGE_VERSION@" +#define UHD_VERSION_STRING "@UHD_VERSION@-@UHD_BUILD_INFO@" #define LOCAL_PKG_DATA_DIR "@LOCAL_PKG_DATA_DIR@" #define INSTALLER_PKG_DATA_DIR "@INSTALLER_PKG_DATA_DIR@" -- cgit v1.2.3 From 291a46b86e8e639b711a609134ace667235eeb91 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 14 Apr 2011 09:34:37 -0700 Subject: uhd: specify the UHD_PKG_DATA_PATH once (since images shipped w/ drivers) --- host/lib/CMakeLists.txt | 16 +++------------- host/lib/constants.hpp.in | 3 +-- host/lib/utils/paths.cpp | 8 ++------ 3 files changed, 6 insertions(+), 21 deletions(-) (limited to 'host/lib/constants.hpp.in') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 8ca7c7dca..618e33608 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -81,19 +81,9 @@ INCLUDE_SUBDIRECTORY(utils) ######################################################################## # Setup compiled-in constants for data directories ######################################################################## -FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} LOCAL_PKG_DATA_DIR) -STRING(REPLACE "\\" "\\\\" LOCAL_PKG_DATA_DIR ${LOCAL_PKG_DATA_DIR}) -MESSAGE(STATUS "Local package data directory: ${LOCAL_PKG_DATA_DIR}") - -IF(UNIX) - #on unix systems, installers will use this directory for the package data - FILE(TO_NATIVE_PATH /usr/${PKG_DATA_DIR} INSTALLER_PKG_DATA_DIR) -ELSE() - #for the NSIS installer, this will be the default path for package data - FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR}" INSTALLER_PKG_DATA_DIR) -ENDIF() -STRING(REPLACE "\\" "\\\\" INSTALLER_PKG_DATA_DIR ${INSTALLER_PKG_DATA_DIR}) -MESSAGE(STATUS "Installer package data directory: ${INSTALLER_PKG_DATA_DIR}") +FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} UHD_PKG_DATA_PATH) +STRING(REPLACE "\\" "\\\\" UHD_PKG_DATA_PATH ${UHD_PKG_DATA_PATH}) +MESSAGE(STATUS "Full package data directory: ${UHD_PKG_DATA_PATH}") CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/constants.hpp.in diff --git a/host/lib/constants.hpp.in b/host/lib/constants.hpp.in index d62dda1cb..2e0495b12 100644 --- a/host/lib/constants.hpp.in +++ b/host/lib/constants.hpp.in @@ -20,7 +20,6 @@ //these should be pre-processor macros to avoid static initialization issues #define UHD_VERSION_STRING "@UHD_VERSION@-@UHD_BUILD_INFO@" -#define LOCAL_PKG_DATA_DIR "@LOCAL_PKG_DATA_DIR@" -#define INSTALLER_PKG_DATA_DIR "@INSTALLER_PKG_DATA_DIR@" +#define UHD_PKG_DATA_PATH "@UHD_PKG_DATA_PATH@" #endif /* INCLUDED_LIBUHD_CONSTANTS_HPP */ diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index 329695873..0ddc80d6e 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.cpp @@ -76,16 +76,12 @@ static std::vector get_env_paths(const std::string &var_name){ **********************************************************************/ std::vector get_image_paths(void){ std::vector paths = get_env_paths("UHD_IMAGE_PATH"); - paths.push_back(fs::path(LOCAL_PKG_DATA_DIR) / "images"); - if (not std::string(INSTALLER_PKG_DATA_DIR).empty()) - paths.push_back(fs::path(INSTALLER_PKG_DATA_DIR) / "images"); + paths.push_back(fs::path(UHD_PKG_DATA_PATH) / "images"); return paths; } std::vector get_module_paths(void){ std::vector paths = get_env_paths("UHD_MODULE_PATH"); - paths.push_back(fs::path(LOCAL_PKG_DATA_DIR) / "modules"); - if (not std::string(INSTALLER_PKG_DATA_DIR).empty()) - paths.push_back(fs::path(INSTALLER_PKG_DATA_DIR) / "modules"); + paths.push_back(fs::path(UHD_PKG_DATA_PATH) / "modules"); return paths; } -- cgit v1.2.3 From 00bc8d50d5a2528704441ef5532fea13106a8d30 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 19 Apr 2011 16:58:12 -0700 Subject: uhd: removed constants.hpp.in, replaced w/ per source compile defines --- host/lib/CMakeLists.txt | 17 ++++++----------- host/lib/constants.hpp.in | 25 ------------------------- host/lib/utils/CMakeLists.txt | 13 +++++++++++++ host/lib/utils/paths.cpp | 1 - host/lib/version.cpp | 8 +------- 5 files changed, 20 insertions(+), 44 deletions(-) delete mode 100644 host/lib/constants.hpp.in (limited to 'host/lib/constants.hpp.in') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 618e33608..fca4730d8 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -79,23 +79,18 @@ INCLUDE_SUBDIRECTORY(usrp) INCLUDE_SUBDIRECTORY(utils) ######################################################################## -# Setup compiled-in constants for data directories +# Setup UHD_VERSION_STRING for version.cpp ######################################################################## -FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} UHD_PKG_DATA_PATH) -STRING(REPLACE "\\" "\\\\" UHD_PKG_DATA_PATH ${UHD_PKG_DATA_PATH}) -MESSAGE(STATUS "Full package data directory: ${UHD_PKG_DATA_PATH}") - -CONFIGURE_FILE( - ${CMAKE_CURRENT_SOURCE_DIR}/constants.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/constants.hpp -@ONLY) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp + PROPERTIES COMPILE_DEFINITIONS + "UHD_VERSION_STRING=\"${UHD_VERSION}-${UHD_BUILD_INFO}\"" +) ######################################################################## # Append to the list of sources for lib uhd ######################################################################## LIBUHD_APPEND_SOURCES( - ${CMAKE_CURRENT_BINARY_DIR}/constants.hpp ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp ${CMAKE_CURRENT_SOURCE_DIR}/exception.cpp ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp diff --git a/host/lib/constants.hpp.in b/host/lib/constants.hpp.in deleted file mode 100644 index 2e0495b12..000000000 --- a/host/lib/constants.hpp.in +++ /dev/null @@ -1,25 +0,0 @@ -// -// 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 -// 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 . -// - -#ifndef INCLUDED_LIBUHD_CONSTANTS_HPP -#define INCLUDED_LIBUHD_CONSTANTS_HPP - -//these should be pre-processor macros to avoid static initialization issues -#define UHD_VERSION_STRING "@UHD_VERSION@-@UHD_BUILD_INFO@" -#define UHD_PKG_DATA_PATH "@UHD_PKG_DATA_PATH@" - -#endif /* INCLUDED_LIBUHD_CONSTANTS_HPP */ diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt index 26c02b5b4..1314f7475 100644 --- a/host/lib/utils/CMakeLists.txt +++ b/host/lib/utils/CMakeLists.txt @@ -111,6 +111,19 @@ SET_SOURCE_FILES_PROPERTIES( PROPERTIES COMPILE_DEFINITIONS "${LOAD_MODULES_DEFS}" ) +######################################################################## +# Define UHD_PKG_DATA_PATH for paths.cpp +######################################################################## +FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR} UHD_PKG_DATA_PATH) +STRING(REPLACE "\\" "\\\\" UHD_PKG_DATA_PATH ${UHD_PKG_DATA_PATH}) +MESSAGE(STATUS "Full package data directory: ${UHD_PKG_DATA_PATH}") + +SET_SOURCE_FILES_PROPERTIES( + ${CMAKE_CURRENT_SOURCE_DIR}/paths.cpp + PROPERTIES COMPILE_DEFINITIONS + "UHD_PKG_DATA_PATH=\"${UHD_PKG_DATA_PATH}\"" +) + ######################################################################## # Append sources ######################################################################## diff --git a/host/lib/utils/paths.cpp b/host/lib/utils/paths.cpp index a0e4da547..a3dd377e5 100644 --- a/host/lib/utils/paths.cpp +++ b/host/lib/utils/paths.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see . // -#include "constants.hpp" #include #include #include diff --git a/host/lib/version.cpp b/host/lib/version.cpp index 93fdecb1a..d75cc8fda 100644 --- a/host/lib/version.cpp +++ b/host/lib/version.cpp @@ -15,13 +15,7 @@ // along with this program. If not, see . // -#include "constants.hpp" #include - -std::string uhd::get_version_string(void){ - return UHD_VERSION_STRING; -} - #include #include #include @@ -31,7 +25,7 @@ UHD_STATIC_BLOCK(print_system_info){ << BOOST_PLATFORM << "; " << BOOST_COMPILER << "; " << "Boost_" << BOOST_VERSION << "; " - << "UHD_" << uhd::get_version_string() + << "UHD_" << UHD_VERSION_STRING << std::endl << std::endl ; } -- cgit v1.2.3