From eb055722cb51640b6af4c20a5a7007fb08f6d545 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Wed, 17 Aug 2022 21:40:39 +0800 Subject: [PATCH] cmake: add windows rc file --- CMakeLists.txt | 14 ++++++++++++-- app.rc.in | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 app.rc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index aa0d4e4..9263499 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,15 @@ cmake_minimum_required(VERSION 2.8) -project(ttyd C) -set(PROJECT_VERSION "1.7.0") +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + project(ttyd C) + set(PROJECT_VERSION_MAJOR "1") + set(PROJECT_VERSION_MINOR "7") + set(PROJECT_VERSION_PATCH "0") + set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") +else() + cmake_policy(SET CMP0048 NEW) + project(ttyd VERSION 1.7.0 LANGUAGES C) +endif() find_package(Git) if(GIT_FOUND) @@ -72,6 +80,8 @@ endif() if(WIN32) list(APPEND LINK_LIBS shell32 ws2_32) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/app.rc.in ${CMAKE_CURRENT_BINARY_DIR}/app.rc @ONLY) + list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/app.rc) elseif(NOT APPLE) list(APPEND LINK_LIBS util) endif() diff --git a/app.rc.in b/app.rc.in new file mode 100644 index 0000000..3b51859 --- /dev/null +++ b/app.rc.in @@ -0,0 +1,32 @@ +#include + +#define VERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 +#define VERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.0\0" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION + PRODUCTVERSION VERSION + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "Share your terminal over the web\0" + VALUE "ProductName", "ttyd\0" + VALUE "ProductVersion", VERSION_STR + VALUE "FileVersion", VERSION_STR + VALUE "InternalName", "ttyd\0" + VALUE "OriginalFilename", "ttyd.exe\0" + VALUE "LegalCopyright", "Copyright (C) 2016-2022 Shuanglei Tao\0" + VALUE "Comment", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END -- 2.43.4