]> prime8.dev >> repos - ttyd.git/commitdiff
cmake: add windows rc file
authorShuanglei Tao <tsl0922@gmail.com>
Wed, 17 Aug 2022 13:40:39 +0000 (21:40 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Wed, 17 Aug 2022 13:40:39 +0000 (21:40 +0800)
CMakeLists.txt
app.rc.in [new file with mode: 0644]

index aa0d4e4f266e8f6f67c6cc4e881648ad6156e895..92634995e8232b5091573be1582be5ad4e6a1b6e 100644 (file)
@@ -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 (file)
index 0000000..3b51859
--- /dev/null
+++ b/app.rc.in
@@ -0,0 +1,32 @@
+#include <winver.h>
+
+#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