From 9863f9c160cc2f2c1ac37bab93e8804bbf6e06fb Mon Sep 17 00:00:00 2001 From: PioLing <964472638@qq.com> Date: Fri, 3 Jan 2025 11:33:35 +0800 Subject: [PATCH] Add logo and version information to exe on windows (#4093) --- CMakeLists.txt | 2 +- api/CMakeLists.txt | 8 ++++++- api/tests/CMakeLists.txt | 2 +- ext-codec/CMakeLists.txt | 2 +- player/CMakeLists.txt | 2 +- resource.rc | 44 +++++++++++++++++++++++++++++++++++++++ server/CMakeLists.txt | 11 +++++++++- src/CMakeLists.txt | 2 +- srt/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- www/logo.ico | Bin 0 -> 1435 bytes 11 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 resource.rc create mode 100644 www/logo.ico diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f5c7123..7a844dc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2016-2022 The ZLMediaKit project authors. All Rights Reserved. +# Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index 102a03a6..ef04a417 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2016-2022 The ZLMediaKit project authors. All Rights Reserved. +# Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -77,6 +77,12 @@ install(TARGETS mk_api LIBRARY DESTINATION ${INSTALL_PATH_LIB} RUNTIME DESTINATION ${INSTALL_PATH_RUNTIME}) +if(MSVC) + set(RESOURCE_FILE "${CMAKE_SOURCE_DIR}/resource.rc") + set_source_files_properties(${RESOURCE_FILE} PROPERTIES LANGUAGE RC) + target_sources(mk_api PRIVATE ${RESOURCE_FILE}) +endif() + # IOS 跳过测试代码 if(IOS) return() diff --git a/api/tests/CMakeLists.txt b/api/tests/CMakeLists.txt index 8108b71b..737ac6b6 100644 --- a/api/tests/CMakeLists.txt +++ b/api/tests/CMakeLists.txt @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2016-2022 The ZLMediaKit project authors. All Rights Reserved. +# Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/ext-codec/CMakeLists.txt b/ext-codec/CMakeLists.txt index 23190fb8..5fefad0c 100644 --- a/ext-codec/CMakeLists.txt +++ b/ext-codec/CMakeLists.txt @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2016-2022 The ZLMediaKit project authors. All Rights Reserved. +# Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/player/CMakeLists.txt b/player/CMakeLists.txt index e36b2a46..e255f139 100644 --- a/player/CMakeLists.txt +++ b/player/CMakeLists.txt @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2016-2022 The ZLMediaKit project authors. All Rights Reserved. +# Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/resource.rc b/resource.rc new file mode 100644 index 00000000..dc23bf1b --- /dev/null +++ b/resource.rc @@ -0,0 +1,44 @@ +#ifdef APSTUDIO_INVOKED +#error This file is not editable by Visual C++. +#endif //APSTUDIO_INVOKED + +#include "winres.h" +#include "ZLMVersion.h" +#define ZLM_VERSION 8,0,0,1 + +// 拼接 BRANCH_NAME 和 COMMIT_HASH ,例如 master - 1c8ed1c +#define COMMIT_HASH_BRANCH_STR BRANCH_NAME " - " COMMIT_HASH + +IDI_ICON1 ICON DISCARDABLE "www//logo.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION ZLM_VERSION + PRODUCTVERSION ZLM_VERSION + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Applied ZLMediaKit Informatics Software" + VALUE "FileDescription", "This file is part of the C++ ZLM" + VALUE "FileVersion", COMMIT_HASH_BRANCH_STR + VALUE "InternalName", COMMIT_HASH_BRANCH_STR + VALUE "LegalCopyright", "Copyright (c) 2016-present The ZLMediaKit project authors" + VALUE "ProductName", "https://github.com/ZLMediaKit" + VALUE "ProductVersion", COMMIT_HASH_BRANCH_STR + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END \ No newline at end of file diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 63abc05d..1e198208 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2016-2022 The ZLMediaKit project authors. All Rights Reserved. +# Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -56,4 +56,13 @@ else() target_link_libraries(MediaServer ${MK_LINK_LIBRARIES}) endif() +if(MSVC) + set(RESOURCE_FILE "${CMAKE_SOURCE_DIR}/resource.rc") + set_source_files_properties(${RESOURCE_FILE} PROPERTIES LANGUAGE RC) + target_sources(MediaServer PRIVATE ${RESOURCE_FILE}) +else() + # Android, IOS, macOS ... + # CLion, GCC ... +endif() + install(TARGETS MediaServer DESTINATION ${INSTALL_PATH_RUNTIME}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7ce2eb88..3241d9e0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2016-2022 The ZLMediaKit project authors. All Rights Reserved. +# Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/srt/CMakeLists.txt b/srt/CMakeLists.txt index fcbdbd8a..417c6535 100644 --- a/srt/CMakeLists.txt +++ b/srt/CMakeLists.txt @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2016-2022 The ZLMediaKit project authors. All Rights Reserved. +# Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7bf8a5f0..6781dfab 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2016-2022 The ZLMediaKit project authors. All Rights Reserved. +# Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/www/logo.ico b/www/logo.ico new file mode 100644 index 0000000000000000000000000000000000000000..132a1ec59e14b92a9a69f41c6f89e9694bb22312 GIT binary patch literal 1435 zcmV;M1!VdF0096205C8B0000W0EGnr02TlM0EtjeM-2)Z3IG5A4M|8uQUCw|FaQ7m zFbD z0Dy!50Qvv`0D$NK0Cg|`0P0`>06Lfe02gqax=}m;00jd{L_t(&f$f=FY!p=($A90M z%kH*o3xz^$fmSISkXt~4R#FhKG+?4pgNZRF@?d;|R~|$$DqfH$PzgS%7=k`Yf*}MD zNdUPRLqIN4P_a~tu_B) zscaj#SB(Ha!DQtyy>A@=*H8STdM(VD0x8Idr83tpw8)y0x%r*<^N{ zyUDiYf#LAkuQCP*M;#V!J&9K0{*)m^5K!QV@YT}+N+0l09F3_Ie>Me~IL1d;#KB|5 zy78I{ts$zxYYN?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