Skip to content

Commit

Permalink
build: add English resource info for mingw/clang build. (#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed Mar 17, 2024
1 parent 51076a8 commit 09da263
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
24 changes: 24 additions & 0 deletions cmake/AddRCInfo.cmake
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")
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
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
@@ -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

0 comments on commit 09da263

Please sign in to comment.