From ba7228d4ba4d4c80a65e67db7dab14300384436e Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Thu, 30 May 2019 13:17:55 -0400 Subject: [PATCH 1/3] Embed version info into built DLLs --- .gitignore | 1 + CMakeLists.txt | 14 ++++++++- api/icsneoc/version.rc.template | 51 +++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 api/icsneoc/version.rc.template diff --git a/.gitignore b/.gitignore index 4547624..501296f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ Thumbs.db third-party/concurrentqueue/benchmarks third-party/concurrentqueue/tests *.bak +.vs \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 33983c8..1f52ac4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,19 @@ execute_process( ERROR_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE ) +if(${BUILD_METADATA}) + set(BUILD_METADATA_PLUS +${BUILD_METADATA}) +endif() +if(NOT ${GIT_BRANCH} STREQUAL "master") + set(BUILD_GIT_INFO "${GIT_BRANCH} @ ") +endif() +string(SUBSTRING GIT_DESCRIBE 0 1 GIT_DESCRIBE_FIRST) +if(NOT ${GIT_DESCRIBE_FIRST} STREQUAL "v") + string(APPEND BUILD_GIT_INFO "${GIT_DESCRIBE}") +endif() + configure_file(api/icsneocpp/buildinfo.h.template ${CMAKE_CURRENT_BINARY_DIR}/generated/buildinfo.h) +configure_file(api/icsneoc/version.rc.template ${CMAKE_CURRENT_BINARY_DIR}/generated/icsneoc/version.rc) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) add_library(icsneocpp @@ -154,7 +166,7 @@ if(WIN32) add_definitions(-DWPCAP -DHAVE_REMOTE -DWIN32_LEAN_AND_MEAN) endif(WIN32) -add_library(icsneoc SHARED api/icsneoc/icsneoc.cpp) +add_library(icsneoc SHARED api/icsneoc/icsneoc.cpp ${CMAKE_CURRENT_BINARY_DIR}/generated/icsneoc/version.rc) target_include_directories(icsneoc PUBLIC $ diff --git a/api/icsneoc/version.rc.template b/api/icsneoc/version.rc.template new file mode 100644 index 0000000..d8641de --- /dev/null +++ b/api/icsneoc/version.rc.template @@ -0,0 +1,51 @@ +#define VER_FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@ +#define VER_FILEVERSION_STR "v@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@@BUILD_METADATA_PLUS@ @BUILD_GIT_INFO@" + +#define VER_PRODUCTVERSION VER_FILEVERSION +#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR + +#ifndef DEBUG +#define VER_DEBUG 0 +#else +#define VER_DEBUG VS_FF_DEBUG +#endif + +#include + +VS_VERSION_INFO VERSIONINFO +FILEVERSION VER_FILEVERSION +PRODUCTVERSION VER_PRODUCTVERSION +FILEFLAGSMASK (VS_FF_DEBUG) +FILEFLAGS (VER_DEBUG) +FILEOS VOS__WINDOWS32 +FILETYPE VFT_DLL +FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "Intrepid Control Systems, Inc." + VALUE "FileDescription", "Intrepid Control Systems Open Device Communication C API" + VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "InternalName", "icsneoc.dll" + VALUE "LegalCopyright", "Intrepid Control Systems, Inc. (C) 2018-2019" + VALUE "OriginalFilename", "icsneoc.dll" + VALUE "ProductName", "libicsneo" + VALUE "ProductVersion", VER_PRODUCTVERSION_STR + END + END + + BLOCK "VarFileInfo" + BEGIN + /* The following line should only be modified for localized versions. */ + /* It consists of any number of WORD,WORD pairs, with each pair */ + /* describing a language,codepage combination supported by the file. */ + /* */ + /* For example, a file might have values "0x409,1252" indicating that it */ + /* supports English language (0x409) in the Windows ANSI codepage (1252). */ + + VALUE "Translation", 0x409, 1252 + + END +END \ No newline at end of file From ff1a78c4eb1d73dfea0af484c1ccd33a439881ea Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Wed, 4 Sep 2019 13:31:17 -0400 Subject: [PATCH 2/3] Hotfix for broken device LED updating This is fixed more permanently on the development branch. That change will be preferred over this one, when the time comes to merge. --- device/device.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/device/device.cpp b/device/device.cpp index 0d121a8..81da863 100644 --- a/device/device.cpp +++ b/device/device.cpp @@ -267,5 +267,10 @@ void Device::updateLEDState() { auto msg = std::make_shared(); msg->network = Network::NetID::Device; msg->data = {0x00, 0x06, uint8_t(ledState)}; - transmit(msg); + + std::vector packet; + if(!com->encoder->encode(packet, msg)) + return; + + com->sendPacket(packet); } \ No newline at end of file From 2a47b6f179699f67dc8c39634ea245c49b02ec0f Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Wed, 4 Sep 2019 13:32:09 -0400 Subject: [PATCH 3/3] v0.1.2 Embed version info into DLLs on Windows Fix device LEDs not indicating status properly Build fixes --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 563ceae..0e85cf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.2) -project(libicsneo VERSION 0.1.1) +project(libicsneo VERSION 0.1.2) set(CMAKE_CXX_STANDARD 11)