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