From 8592153c0f570afbda8657c19124896140f94853 Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Mon, 29 Aug 2022 11:23:15 +0200 Subject: [PATCH] GODT-1803: Added resource file with icon in Windows build. GODT-1803: RC info is now automatically generated. --- internal/frontend/.gitignore | 1 + .../bridge-gui/bridge-gui/CMakeLists.txt | 12 +++++++++ .../bridge-gui/bridge-gui/Resources.rc.in | 26 +++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 internal/frontend/bridge-gui/bridge-gui/Resources.rc.in diff --git a/internal/frontend/.gitignore b/internal/frontend/.gitignore index 4a079f7c..976250b8 100644 --- a/internal/frontend/.gitignore +++ b/internal/frontend/.gitignore @@ -11,3 +11,4 @@ rcc_cgo_*.go # Generated file bridge-gui/bridge-gui/Version.h +bridge-gui/bridge-gui/Resources.rc diff --git a/internal/frontend/bridge-gui/bridge-gui/CMakeLists.txt b/internal/frontend/bridge-gui/bridge-gui/CMakeLists.txt index a8a1a9df..f7779dad 100644 --- a/internal/frontend/bridge-gui/bridge-gui/CMakeLists.txt +++ b/internal/frontend/bridge-gui/bridge-gui/CMakeLists.txt @@ -119,6 +119,18 @@ add_executable(bridge-gui ${DOCK_ICON_SRC_FILE} DockIcon/DockIcon.h ) +if (WIN32) # on Windows, we add a (non-Qt) resource file that contains the application icon and version information. + string(TIMESTAMP BRIDGE_BUILD_YEAR "%Y") + set(REGEX_NUMBER "[0123456789]") # CMake matches does not support \d. + if (${BRIDGE_APP_VERSION} MATCHES "^(${REGEX_NUMBER}+)\\.(${REGEX_NUMBER}+)\\.(${REGEX_NUMBER}+)") + set(BRIDGE_APP_VERSION_COMMA "${CMAKE_MATCH_1},${CMAKE_MATCH_2},${CMAKE_MATCH_3},0") + else() + message(FATAL_ERROR "Could not extract comma-separated version number from ${BRIDGE_APP_VERSION}") + endif() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Resources.rc.in" "${CMAKE_CURRENT_SOURCE_DIR}/Resources.rc") + target_sources(bridge-gui PRIVATE Resources.rc) +endif() + target_precompile_headers(bridge-gui PRIVATE Pch.h) target_include_directories(bridge-gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(bridge-gui diff --git a/internal/frontend/bridge-gui/bridge-gui/Resources.rc.in b/internal/frontend/bridge-gui/bridge-gui/Resources.rc.in new file mode 100644 index 00000000..c779b763 --- /dev/null +++ b/internal/frontend/bridge-gui/bridge-gui/Resources.rc.in @@ -0,0 +1,26 @@ +IDI_ICON1 ICON DISCARDABLE "${BRIDGE_REPO_ROOT}/dist/bridge.ico" + +1 VERSIONINFO +FILEVERSION ${BRIDGE_APP_VERSION_COMMA} +PRODUCTVERSION ${BRIDGE_APP_VERSION_COMMA} +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "The Bridge is an application that runs on your computer in the background and seamlessly encrypts and decrypts your mail as it enters and leaves your computer." + VALUE "CompanyName", "${BRIDGE_VENDOR}" + VALUE "FileDescription", "${BRIDGE_APP_FULL_NAME}" + VALUE "FileVersion", "${BRIDGE_APP_VERSION_COMMA}" + VALUE "InternalName", "${PROJECT_NAME}.exe" + VALUE "LegalCopyright", "(C) ${BRIDGE_BUILD_YEAR} ${BRIDGE_VENDOR}" + VALUE "OriginalFilename", "${PROJECT_NAME}.exe" + VALUE "ProductName", "${BRIDGE_APP_FULL_NAME} for Windows" + VALUE "ProductVersion", "${BRIDGE_APP_VERSION}" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END