From 4a320f31432f8f7c50456a20c4de0ca9b0dde017 Mon Sep 17 00:00:00 2001 From: Nicholas Corgan Date: Thu, 28 Feb 2013 15:57:35 -0800 Subject: Added Windows DLL resource file to insert version into DLL --- host/cmake/Modules/UHDVersion.cmake | 19 ++++++++++++++++++- host/lib/CMakeLists.txt | 12 ++++++++++++ host/lib/uhd.rc.in | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 host/lib/uhd.rc.in diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake index 1a10f42ba..32ccaafc6 100644 --- a/host/cmake/Modules/UHDVersion.cmake +++ b/host/cmake/Modules/UHDVersion.cmake @@ -1,5 +1,5 @@ # -# Copyright 2010-2012 Ettus Research LLC +# Copyright 2010-2013 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 @@ -29,6 +29,23 @@ SET(UHD_VERSION_MAJOR 003) SET(UHD_VERSION_MINOR 004) SET(UHD_VERSION_PATCH 005) +######################################################################## +# Set up DLL resource version numbers +######################################################################## + +FUNCTION(DEPAD_NUM input_num output_num) + EXECUTE_PROCESS( + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${PYTHON_EXECUTABLE} -c "print int('${input_num}')" + OUTPUT_VARIABLE depadded_num OUTPUT_STRIP_TRAILING_WHITESPACE + ) + SET(${output_num} ${depadded_num} PARENT_SCOPE) +ENDFUNCTION(DEPAD_NUM) + +DEPAD_NUM(${UHD_VERSION_MAJOR} RC_VERSION_MAJOR) +DEPAD_NUM(${UHD_VERSION_MINOR} RC_VERSION_MINOR) +DEPAD_NUM(${UHD_VERSION_PATCH} RC_VERSION_PATCH) + ######################################################################## # Version information discovery through git log ######################################################################## diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 7a76ebd53..d8ff66a96 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -93,6 +93,18 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_BINARY_DIR}/version.cpp ) +######################################################################## +# Add DLL resource file to Windows build +######################################################################## +IF(MSVC) + CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/uhd.rc.in + ${CMAKE_CURRENT_BINARY_DIR}/uhd.rc + @ONLY) + + LIST(APPEND libuhd_sources ${CMAKE_CURRENT_BINARY_DIR}/uhd.rc) +ENDIF(MSVC) + ######################################################################## # Setup libuhd library ######################################################################## diff --git a/host/lib/uhd.rc.in b/host/lib/uhd.rc.in new file mode 100644 index 000000000..01a5e07f5 --- /dev/null +++ b/host/lib/uhd.rc.in @@ -0,0 +1,33 @@ +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @RC_VERSION_MAJOR@,@RC_VERSION_MINOR@,@RC_VERSION_PATCH@,@UHD_GIT_COUNT@ + PRODUCTVERSION @RC_VERSION_MAJOR@,@RC_VERSION_MINOR@,@RC_VERSION_PATCH@,@UHD_GIT_COUNT@ + FILEFLAGSMASK 0x3fL +#ifndef NDEBUG + FILEFLAGS 0x0L +#else + FILEFLAGS 0x1L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_DRV_INSTALLABLE + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "USRP Hardware Driver (UHD) Library" + VALUE "FileVersion", "@UHD_VERSION@" + VALUE "InternalName", "uhd.dll" + VALUE "LegalCopyright", "Licensed under GPLv3 or any later version" + VALUE "OriginalFilename", "uhd.dll" + VALUE "ProductName", "USRP Hardware Driver (UHD) Library" + VALUE "ProductVersion", "@UHD_VERSION@" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END + END -- cgit v1.2.3