Skip to content

Commit

Permalink
add English resource info for mingw/clang build.
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed Mar 12, 2024
1 parent 1496dc1 commit 2c253fd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
27 changes: 26 additions & 1 deletion cmake/AddRCInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if(git_executable)
endif()
endif()
# set build_release
if ("${git_branch}" STREQUAL "master")
if ("${git_branch}" STREQUAL "resinfo_mingw_clang")
# git_commit
execute_process(
COMMAND git rev-parse --short HEAD
Expand All @@ -30,19 +30,44 @@ 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} -DMSVC")
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")
else(build_release)
message("not build_release")
# arch_suffix
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(arch_suffix "x64")
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
10 changes: 7 additions & 3 deletions src/rime.rc
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ VS_VERSION_INFO VERSIONINFO
BEGIN
BLOCK "StringFileInfo"
BEGIN
#ifdef MSVC
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 MSVC
VALUE "Translation", 0x804, 1200
VALUE "Translation", 0x409, 1200
#endif
VALUE "Translation", 0x409, 1252
END
END

0 comments on commit 2c253fd

Please sign in to comment.