Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add English resource info for mingw/clang build. #847

Merged
merged 2 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cmake/AddRCInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ if ("${git_branch}" STREQUAL "master")
else()
set(build_release ON)
endif()
set(original_filename "rime.dll")
if(MSVC)
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DLOCALIZE_VERSION_INFO")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # mingw
set(original_filename "librime.dll")
lotem marked this conversation as resolved.
Show resolved Hide resolved
endif()

# generate tag_suffix for nightly and release
if(build_release)
set(tag_suffix ".0")
Expand All @@ -40,9 +47,26 @@ else(build_release)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(arch_suffix "Win32")
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # clang
set(arch_suffix "${arch_suffix} clang")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # mingw
set(arch_suffix "${arch_suffix} mingw")
endif()
# set tag_suffix
set(tag_suffix "-${git_commit} Nightly build ${arch_suffix}")
endif(build_release)

# if mingw env add -c 65001 to CMAKE_RC_FLAGS
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -c 65001")
endif()
# if clang build, use llvm-rc to compile resource file
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_RC_COMPILER "llvm-rc")
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -finput-charset=UTF-8")
endif()

# set resource file
set(rime_resource_file "${CMAKE_CURRENT_SOURCE_DIR}/rime.rc")
# convert rime_version to comma separated format
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set(rime_core_module_src
${rime_config_src})

# add rc info for windows MSVC build
if(MSVC)
if(WIN32)
include(${CMAKE_SOURCE_DIR}/cmake/AddRCInfo.cmake)
endif()

Expand Down
12 changes: 8 additions & 4 deletions src/rime.rc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "winver.h"
#ifdef MSVC
#ifdef LOCALIZE_VERSION_INFO
#pragma code_page (65001)
#endif

Expand All @@ -18,13 +18,14 @@ VS_VERSION_INFO VERSIONINFO
BEGIN
BLOCK "StringFileInfo"
BEGIN
#ifdef LOCALIZE_VERSION_INFO
BLOCK "080404b0"
BEGIN
VALUE "CompanyName", "式恕堂"
VALUE "FileDescription", "中州韵输入法引擎"
VALUE "InternalName", "librime"
VALUE "LegalCopyright", "式恕堂 版权所无"
VALUE "OriginalFilename", "rime.dll"
VALUE "OriginalFilename", "@original_filename@"
VALUE "ProductName", "中州韵输入法引擎"
VALUE "ProductVersion", "@rime_version@@tag_suffix@"
END
Expand All @@ -34,25 +35,28 @@ BEGIN
VALUE "FileDescription", "中州韻輸入法引擎"
VALUE "InternalName", "librime"
VALUE "LegalCopyright", "式恕堂 版權所無"
VALUE "OriginalFilename", "rime.dll"
VALUE "OriginalFilename", "@original_filename@"
VALUE "ProductName", "中州韻輸入法引擎"
VALUE "ProductVersion", "@rime_version@@tag_suffix@"
END
#endif
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Rime Developers"
VALUE "FileDescription", "Rime Input Method Engine"
VALUE "InternalName", "librime"
VALUE "LegalCopyright", "Copyleft Rime Developers"
VALUE "OriginalFilename", "rime.dll"
VALUE "OriginalFilename", "@original_filename@"
VALUE "ProductName", "Rime Input Method Engine"
VALUE "ProductVersion", "@rime_version@@tag_suffix@"
END
END
BLOCK "VarFileInfo"
BEGIN
#ifdef LOCALIZE_VERSION_INFO
VALUE "Translation", 0x804, 1200
VALUE "Translation", 0x409, 1200
#endif
VALUE "Translation", 0x409, 1252
END
END