forked from rime/librime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add resource info for windows MSVC build (rime#845)
- Loading branch information
1 parent
e8c3823
commit 2d4eea9
Showing
3 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# check if git is installed in system | ||
find_program(git_executable git) | ||
# check if ${CMAKE_SOURCE_DIR} is git repository if git is installed | ||
# and set git_branch | ||
if(git_executable) | ||
execute_process( | ||
COMMAND git rev-parse --is-inside-work-tree | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
RESULT_VARIABLE git_repo) | ||
if(NOT git_repo EQUAL 0) | ||
set(git_executable "") | ||
else() | ||
# git_branch | ||
execute_process( | ||
COMMAND git rev-parse --abbrev-ref HEAD | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE git_branch | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
endif() | ||
endif() | ||
# set build_release | ||
if ("${git_branch}" STREQUAL "master") | ||
# git_commit | ||
execute_process( | ||
COMMAND git rev-parse --short HEAD | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE git_commit | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
set(build_release OFF) | ||
else() | ||
set(build_release ON) | ||
endif() | ||
# generate tag_suffix for nightly and release | ||
if(build_release) | ||
set(tag_suffix ".0") | ||
else(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() | ||
# set tag_suffix | ||
set(tag_suffix "-${git_commit} Nightly build ${arch_suffix}") | ||
endif(build_release) | ||
# set resource file | ||
set(rime_resource_file "${CMAKE_CURRENT_SOURCE_DIR}/rime.rc") | ||
# convert rime_version to comma separated format | ||
string(REPLACE "." "," rime_version_comma_separated ${rime_version}) | ||
# configure resource file, make version info to actually value | ||
configure_file(${rime_resource_file} ${CMAKE_CURRENT_BINARY_DIR}/rime.rc @ONLY) | ||
# append resource file to source file list | ||
list(APPEND rime_core_module_src ${CMAKE_CURRENT_BINARY_DIR}/rime.rc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include "winver.h" | ||
#ifdef MSVC | ||
#pragma code_page (65001) | ||
#endif | ||
|
||
VS_VERSION_INFO VERSIONINFO | ||
FILEVERSION @rime_version_comma_separated@,0 | ||
PRODUCTVERSION @rime_version_comma_separated@,0 | ||
FILEFLAGSMASK 0x17L | ||
#ifdef _DEBUG | ||
FILEFLAGS 0x1L | ||
#else | ||
FILEFLAGS 0x0L | ||
#endif | ||
FILEOS 0x40004L | ||
FILETYPE 0x1L | ||
FILESUBTYPE 0x0L | ||
BEGIN | ||
BLOCK "StringFileInfo" | ||
BEGIN | ||
BLOCK "080404b0" | ||
BEGIN | ||
VALUE "CompanyName", "式恕堂" | ||
VALUE "FileDescription", "中州韵输入法引擎" | ||
VALUE "InternalName", "librime" | ||
VALUE "LegalCopyright", "式恕堂 版权所无" | ||
VALUE "OriginalFilename", "rime.dll" | ||
VALUE "ProductName", "中州韵输入法引擎" | ||
VALUE "ProductVersion", "@rime_version@@tag_suffix@" | ||
END | ||
BLOCK "040904b0" | ||
BEGIN | ||
VALUE "CompanyName", "式恕堂" | ||
VALUE "FileDescription", "中州韻輸入法引擎" | ||
VALUE "InternalName", "librime" | ||
VALUE "LegalCopyright", "式恕堂 版權所無" | ||
VALUE "OriginalFilename", "rime.dll" | ||
VALUE "ProductName", "中州韻輸入法引擎" | ||
VALUE "ProductVersion", "@rime_version@@tag_suffix@" | ||
END | ||
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 "ProductName", "Rime Input Method Engine" | ||
VALUE "ProductVersion", "@rime_version@@tag_suffix@" | ||
END | ||
END | ||
BLOCK "VarFileInfo" | ||
BEGIN | ||
VALUE "Translation", 0x804, 1200 | ||
VALUE "Translation", 0x409, 1200 | ||
VALUE "Translation", 0x409, 1252 | ||
END | ||
END |