aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'host/cmake/Modules')
-rw-r--r--host/cmake/Modules/UHDBuildInfo.cmake64
-rw-r--r--host/cmake/Modules/UHDConfig.cmake.in1
-rw-r--r--host/cmake/Modules/UHDConfigVersion.cmake.in5
-rw-r--r--host/cmake/Modules/UHDGlobalDefs.cmake11
-rw-r--r--host/cmake/Modules/UHDPackage.cmake4
-rw-r--r--host/cmake/Modules/UHDUnitTest.cmake4
-rw-r--r--host/cmake/Modules/UHDVersion.cmake64
7 files changed, 133 insertions, 20 deletions
diff --git a/host/cmake/Modules/UHDBuildInfo.cmake b/host/cmake/Modules/UHDBuildInfo.cmake
new file mode 100644
index 000000000..c64f748ae
--- /dev/null
+++ b/host/cmake/Modules/UHDBuildInfo.cmake
@@ -0,0 +1,64 @@
+#
+# Copyright 2015-2016 National Instruments Corp.
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+
+#
+# We need this to be macro because GET_DIRECTORY_PROPERTY works with
+# the current directory.
+#
+MACRO(UHD_LOAD_BUILD_INFO)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "Loading build info.")
+
+ # Build date
+ IF(IGNORE_BUILD_DATE)
+ SET(UHD_BUILD_DATE "")
+ ELSE()
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c
+ "import time; print(time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime()))"
+ OUTPUT_VARIABLE UHD_BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ ENDIF(IGNORE_BUILD_DATE)
+
+ # Compiler name
+ IF(MSVC)
+ IF(MSVC10)
+ SET(UHD_C_COMPILER "MSVC 2010")
+ SET(UHD_CXX_COMPILER "MSVC 2010")
+ ELSEIF(MSVC11)
+ SET(UHD_C_COMPILER "MSVC 2012")
+ SET(UHD_CXX_COMPILER "MSVC 2012")
+ ELSEIF(MSVC12)
+ SET(UHD_C_COMPILER "MSVC 2013")
+ SET(UHD_CXX_COMPILER "MSVC 2013")
+ ELSEIF(MSVC14)
+ SET(UHD_C_COMPILER "MSVC 2015")
+ SET(UHD_CXX_COMPILER "MSVC 2015")
+ ELSE()
+ # Go with the ugly string
+ SET(UHD_C_COMPILER "MSVC ${CMAKE_C_COMPILER_VERSION}")
+ SET(UHD_CXX_COMPILER "MSVC ${CMAKE_CXX_COMPILER_VERSION}")
+ ENDIF(MSVC10)
+ ELSE()
+ SET(UHD_C_COMPILER "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
+ SET(UHD_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
+ ENDIF(MSVC)
+
+ # Compiler flags
+ GET_DIRECTORY_PROPERTY(uhd_flags COMPILE_DEFINITIONS)
+ SET(UHD_C_FLAGS "${uhd_flags}${CMAKE_C_FLAGS}") # CMAKE_C_FLAGS starts with a space
+ SET(UHD_CXX_FLAGS "${uhd_flags}${CMAKE_CXX_FLAGS}") # CMAKE_CXX_FLAGS starts with a space
+ENDMACRO(UHD_LOAD_BUILD_INFO)
diff --git a/host/cmake/Modules/UHDConfig.cmake.in b/host/cmake/Modules/UHDConfig.cmake.in
index 78f01706f..e0951a93e 100644
--- a/host/cmake/Modules/UHDConfig.cmake.in
+++ b/host/cmake/Modules/UHDConfig.cmake.in
@@ -36,6 +36,7 @@ set(ENV{UHD_CONFIG_USED} TRUE)
# set default values
SET(UHD_FOUND TRUE)
+SET(UHD_RFNOC_FOUND @UHD_RFNOC_FOUND@)
SET(UHD_INCLUDE_HINTS)
SET(UHD_LIBDIR_HINTS)
SET(UHD_DIR $ENV{UHD_DIR})
diff --git a/host/cmake/Modules/UHDConfigVersion.cmake.in b/host/cmake/Modules/UHDConfigVersion.cmake.in
index 67e0e408d..549798324 100644
--- a/host/cmake/Modules/UHDConfigVersion.cmake.in
+++ b/host/cmake/Modules/UHDConfigVersion.cmake.in
@@ -30,7 +30,8 @@ set(ENV{UHD_CONFIG_VERSION_USED} TRUE)
# statically in here to avoid using Python all over again.
SET(MAJOR_VERSION @TRIMMED_VERSION_MAJOR@)
-SET(MINOR_VERSION @TRIMMED_VERSION_MINOR@)
+SET(API_VERSION @TRIMMED_VERSION_API@)
+SET(ABI_VERSION @TRIMMED_VERSION_ABI@)
SET(PATCH_VERSION @TRIMMED_VERSION_PATCH@)
SET(DEVEL_VERSION @UHD_VERSION_DEVEL@)
@@ -53,7 +54,7 @@ ENDIF(NOT PACKAGE_FIND_VERSION)
# to add a fake patch version that should be higher than anything the user
# requests.
IF(DEVEL_VERSION)
- SET(PACKAGE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.999")
+ SET(PACKAGE_VERSION "${MAJOR_VERSION}.${API_VERSION}.${ABI_VERSION}.999")
ENDIF(DEVEL_VERSION)
# assume incorrect versioning by default
diff --git a/host/cmake/Modules/UHDGlobalDefs.cmake b/host/cmake/Modules/UHDGlobalDefs.cmake
index 58c0b1287..167861402 100644
--- a/host/cmake/Modules/UHDGlobalDefs.cmake
+++ b/host/cmake/Modules/UHDGlobalDefs.cmake
@@ -1,5 +1,5 @@
#
-# Copyright 2015 Ettus Research LLC
+# Copyright 2015,2016 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
@@ -24,11 +24,16 @@ CHECK_CXX_SYMBOL_EXISTS(log2 cmath HAVE_LOG2)
## Macros for the version number
IF(UHD_VERSION_DEVEL)
- MATH(EXPR UHD_VERSION_ADDED "10000 * ${TRIMMED_VERSION_MAJOR} + 100 * ${TRIMMED_VERSION_MINOR} + 99")
+ MATH(EXPR UHD_VERSION_ADDED "1000000 * ${TRIMMED_VERSION_MAJOR} + 10000 * ${TRIMMED_VERSION_API} + 100 * ${TRIMMED_VERSION_ABI} + 99")
ELSE()
- MATH(EXPR UHD_VERSION_ADDED "10000 * ${TRIMMED_VERSION_MAJOR} + 100 * ${TRIMMED_VERSION_MINOR} + ${TRIMMED_VERSION_PATCH}")
+ MATH(EXPR UHD_VERSION_ADDED "1000000 * ${TRIMMED_VERSION_MAJOR} + 10000 * ${TRIMMED_VERSION_API} + 100 * ${TRIMMED_VERSION_ABI} + ${TRIMMED_VERSION_PATCH}")
ENDIF(UHD_VERSION_DEVEL)
ADD_DEFINITIONS(-DUHD_VERSION=${UHD_VERSION_ADDED})
+## RFNoC
+IF(ENABLE_RFNOC)
+ ADD_DEFINITIONS(-DUHD_RFNOC_ENABLED)
+ENDIF(ENABLE_RFNOC)
+
## make sure the code knows about config.h
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
diff --git a/host/cmake/Modules/UHDPackage.cmake b/host/cmake/Modules/UHDPackage.cmake
index b9fcdf9ed..6c36407b9 100644
--- a/host/cmake/Modules/UHDPackage.cmake
+++ b/host/cmake/Modules/UHDPackage.cmake
@@ -1,5 +1,5 @@
#
-# Copyright 2010-2014 Ettus Research LLC
+# Copyright 2010-2016 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
@@ -114,7 +114,7 @@ ENDIF()
# Setup CPack General
########################################################################
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - USRP Hardware Driver")
-SET(CPACK_PACKAGE_VENDOR "Ettus Research LLC")
+SET(CPACK_PACKAGE_VENDOR "Ettus Research (National Instruments)")
SET(CPACK_PACKAGE_CONTACT "Ettus Research <support@ettus.com>")
SET(CPACK_PACKAGE_VERSION "${UHD_VERSION}")
SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.md)
diff --git a/host/cmake/Modules/UHDUnitTest.cmake b/host/cmake/Modules/UHDUnitTest.cmake
index f3e848906..b543a4d1c 100644
--- a/host/cmake/Modules/UHDUnitTest.cmake
+++ b/host/cmake/Modules/UHDUnitTest.cmake
@@ -60,7 +60,7 @@ function(UHD_ADD_TEST test_name)
#replace list separator with the path separator
string(REPLACE ";" ":" libpath "${libpath}")
- list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}")
+ list(APPEND environs "PATH=${binpath}" "${LD_PATH_VAR}=${libpath}" "UHD_RFNOC_DIR=${CMAKE_SOURCE_DIR}/include/uhd/rfnoc")
#generate a bat file that sets the environment and runs the test
if (CMAKE_CROSSCOMPILING)
@@ -92,7 +92,7 @@ function(UHD_ADD_TEST test_name)
#replace list separator with the path separator (escaped)
string(REPLACE ";" "\\;" libpath "${libpath}")
- list(APPEND environs "PATH=${libpath}")
+ list(APPEND environs "PATH=${libpath}" "UHD_RFNOC_DIR=${CMAKE_SOURCE_DIR}/include/uhd/rfnoc")
#generate a bat file that sets the environment and runs the test
set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat)
diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake
index 4b26efdb2..5b1c314f0 100644
--- a/host/cmake/Modules/UHDVersion.cmake
+++ b/host/cmake/Modules/UHDVersion.cmake
@@ -1,5 +1,5 @@
#
-# Copyright 2010-2014 Ettus Research LLC
+# Copyright 2010-2014,2016 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
@@ -21,20 +21,61 @@ 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
+# - Increment major on large-scale library changes
+# - Increment API on API changes
+# - Increment ABI on ABI changes
+# - Increment patch for bugfixes and docs
# - set UHD_VERSION_DEVEL to true for master and development branches
########################################################################
SET(UHD_VERSION_MAJOR 003)
-SET(UHD_VERSION_MINOR 009)
-SET(UHD_VERSION_PATCH 004)
+SET(UHD_VERSION_API 010)
+SET(UHD_VERSION_ABI 000)
+SET(UHD_VERSION_PATCH 000)
SET(UHD_VERSION_DEVEL FALSE)
########################################################################
-# Set up trimmed version numbers for DLL resource files and packages
+# If we're on a development branch, we skip the patch version
########################################################################
+IF(DEFINED UHD_VERSION_PATCH_OVERRIDE)
+ SET(UHD_VERSION_DEVEL FALSE)
+ SET(UHD_VERSION_PATCH ${UHD_VERSION_PATCH_OVERRIDE})
+ENDIF(DEFINED UHD_VERSION_PATCH_OVERRIDE)
+IF(NOT DEFINED UHD_VERSION_DEVEL)
+ SET(UHD_VERSION_DEVEL FALSE)
+ENDIF(NOT DEFINED UHD_VERSION_DEVEL)
+SET(UHD_GIT_BRANCH "")
+IF(GIT_FOUND)
+ EXECUTE_PROCESS(
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
+ OUTPUT_VARIABLE _git_branch OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE _git_branch_result
+ )
+ IF(_git_branch_result EQUAL 0)
+ SET(UHD_GIT_BRANCH ${_git_branch})
+ IF(UHD_GIT_BRANCH STREQUAL "maint")
+ MESSAGE(STATUS "Operating on maint branch (stable).")
+ SET(UHD_VERSION_DEVEL FALSE)
+ ELSEIF(UHD_GIT_BRANCH STREQUAL "master")
+ MESSAGE(STATUS "Operating on master branch.")
+ SET(UHD_VERSION_DEVEL TRUE)
+ ELSE()
+ MESSAGE(STATUS "Working off of feature or development branch. Updating version number.")
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "print('${_git_branch}'.replace('/', '-'))"
+ OUTPUT_VARIABLE _git_safe_branch OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ SET(UHD_VERSION_PATCH ${_git_safe_branch})
+ SET(UHD_VERSION_DEVEL TRUE)
+ ENDIF()
+ ELSE()
+ MESSAGE(STATUS "Could not determine git branch. Probably building from tarball.")
+ ENDIF()
+ENDIF(GIT_FOUND)
+########################################################################
+# Set up trimmed version numbers for DLL resource files and packages
+########################################################################
FUNCTION(DEPAD_NUM input_num output_num)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -45,13 +86,14 @@ FUNCTION(DEPAD_NUM input_num output_num)
ENDFUNCTION(DEPAD_NUM)
DEPAD_NUM(${UHD_VERSION_MAJOR} TRIMMED_VERSION_MAJOR)
-DEPAD_NUM(${UHD_VERSION_MINOR} TRIMMED_VERSION_MINOR)
+DEPAD_NUM(${UHD_VERSION_API} TRIMMED_VERSION_API)
+DEPAD_NUM(${UHD_VERSION_ABI} TRIMMED_VERSION_ABI)
IF(UHD_VERSION_DEVEL)
SET(TRIMMED_VERSION_PATCH ${UHD_VERSION_PATCH})
ELSE(UHD_VERSION_DEVEL)
DEPAD_NUM(${UHD_VERSION_PATCH} TRIMMED_VERSION_PATCH)
ENDIF(UHD_VERSION_DEVEL)
-SET(TRIMMED_UHD_VERSION "${TRIMMED_VERSION_MAJOR}.${TRIMMED_VERSION_MINOR}.${TRIMMED_VERSION_PATCH}")
+SET(TRIMMED_UHD_VERSION "${TRIMMED_VERSION_MAJOR}.${TRIMMED_VERSION_API}.${TRIMMED_VERSION_ABI}.${TRIMMED_VERSION_PATCH}")
########################################################################
# Version information discovery through git log
@@ -112,7 +154,7 @@ ENDIF()
########################################################################
IF(TRIM_UHD_VERSION STREQUAL "True")
- SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_GIT_HASH}")
+ SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_API}.${UHD_VERSION_ABI}.${UHD_VERSION_PATCH}-${UHD_GIT_HASH}")
ELSE()
- SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_GIT_COUNT}-${UHD_GIT_HASH}")
+ SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_API}.${UHD_VERSION_ABI}.${UHD_VERSION_PATCH}-${UHD_GIT_COUNT}-${UHD_GIT_HASH}")
ENDIF()