From 73e324cda00d62dbf52ed5b53ccabdf6feabf819 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 8 Jan 2015 00:10:48 +0100 Subject: cmake: Added a version macro for compile-time version checks --- host/include/uhd/CMakeLists.txt | 7 +++++- host/include/uhd/version.hpp | 42 ----------------------------------- host/include/uhd/version.hpp.in | 49 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 43 deletions(-) delete mode 100644 host/include/uhd/version.hpp create mode 100644 host/include/uhd/version.hpp.in (limited to 'host') diff --git a/host/include/uhd/CMakeLists.txt b/host/include/uhd/CMakeLists.txt index 318577b7c..f6123aa90 100644 --- a/host/include/uhd/CMakeLists.txt +++ b/host/include/uhd/CMakeLists.txt @@ -21,6 +21,11 @@ ADD_SUBDIRECTORY(usrp) ADD_SUBDIRECTORY(usrp_clock) ADD_SUBDIRECTORY(utils) +CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/version.hpp.in + ${CMAKE_CURRENT_BINARY_DIR}/version.hpp +) + UHD_INSTALL(FILES config.hpp convert.hpp @@ -31,7 +36,7 @@ UHD_INSTALL(FILES property_tree.ipp property_tree.hpp stream.hpp - version.hpp + ${CMAKE_CURRENT_BINARY_DIR}/version.hpp DESTINATION ${INCLUDE_DIR}/uhd COMPONENT headers ) diff --git a/host/include/uhd/version.hpp b/host/include/uhd/version.hpp deleted file mode 100644 index 998765899..000000000 --- a/host/include/uhd/version.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// Copyright 2010-2014 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_UHD_VERSION_HPP -#define INCLUDED_UHD_VERSION_HPP - -#include -#include - -/*! - * The ABI version string that the client application builds against. - * Call get_abi_string() to check this against the library build. - * The format is oldest API compatible release - ABI compat number. - * The compatibility number allows pre-release ABI to be versioned. - */ -#define UHD_VERSION_ABI_STRING "3.8.0-0" - -namespace uhd{ - - //! Get the version string (dotted version number + build info) - UHD_API std::string get_version_string(void); - - //! Get the ABI compatibility string for this build of the library - UHD_API std::string get_abi_string(void); - -} //namespace uhd - -#endif /* INCLUDED_UHD_VERSION_HPP */ diff --git a/host/include/uhd/version.hpp.in b/host/include/uhd/version.hpp.in new file mode 100644 index 000000000..725a655c4 --- /dev/null +++ b/host/include/uhd/version.hpp.in @@ -0,0 +1,49 @@ +// +// Copyright 2010-2014 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_UHD_VERSION_HPP +#define INCLUDED_UHD_VERSION_HPP + +#include +#include + +/*! + * The ABI version string that the client application builds against. + * Call get_abi_string() to check this against the library build. + * The format is oldest API compatible release - ABI compat number. + * The compatibility number allows pre-release ABI to be versioned. + */ +#define UHD_VERSION_ABI_STRING "3.8.0-0" + +/*! + * A macro to check UHD version at compile-time. + * The value of this macro is MAJOR * 10000 + MINOR * 100 + PATCH + * (e.g., for UHD 3.8.1 this is 30801). + */ +#cmakedefine UHD_VERSION @UHD_VERSION_ADDED@ + +namespace uhd{ + + //! Get the version string (dotted version number + build info) + UHD_API std::string get_version_string(void); + + //! Get the ABI compatibility string for this build of the library + UHD_API std::string get_abi_string(void); + +} //namespace uhd + +#endif /* INCLUDED_UHD_VERSION_HPP */ -- cgit v1.2.3