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

[x64対応] バージョン情報にPlatform情報を埋め込み (32bit/64bit) #179

Merged
merged 8 commits into from
Jun 25, 2018
1 change: 1 addition & 0 deletions sakura/preBuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ if "%GIT_ENABLED%" == "1" (
: Output gitrev.h
set GITREV_H=..\sakura_core\gitrev.h
type nul > %GITREV_H%
echo #pragma once >> %GITREV_H%
if "%COMMITID%" == "" (
type nul >> %GITREV_H%
) else (
Expand Down
5 changes: 3 additions & 2 deletions sakura/sakura.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
<Command>call preBuild.bat</Command>
</PreBuildEvent>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0411</Culture>
</ResourceCompile>
</ItemDefinitionGroup>
Expand Down Expand Up @@ -227,7 +227,7 @@
<Command>call preBuild.bat</Command>
</PreBuildEvent>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0411</Culture>
</ResourceCompile>
</ItemDefinitionGroup>
Expand Down Expand Up @@ -502,6 +502,7 @@
<ClInclude Include="..\sakura_core\util\tchar_receive.h" />
<ClInclude Include="..\sakura_core\util\tchar_template.h" />
<ClInclude Include="..\sakura_core\util\window.h" />
<ClInclude Include="..\sakura_core\version.h" />
<ClInclude Include="..\sakura_core\view\CCaret.h" />
<ClInclude Include="..\sakura_core\view\CEditView.h" />
<ClInclude Include="..\sakura_core\view\CEditView_Paint.h" />
Expand Down
3 changes: 3 additions & 0 deletions sakura/sakura.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,9 @@
<Filter>Cpp Source Files\uiparts</Filter>
</ClInclude>
<ClInclude Include="..\sakura_core\gitrev.h" />
<ClInclude Include="..\sakura_core\version.h">
<Filter>Other Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\sakura_core\Funccode_x.hsrc">
Expand Down
30 changes: 18 additions & 12 deletions sakura_core/dlg/CDlgAbout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include "uiparts/HandCursor.h"
#include "util/file.h"
#include "util/module.h"
#include "gitrev.h"
#include "sakura_rc.h" // 2002/2/10 aroka 復帰
#include "version.h"
#include "sakura.hh"

// バージョン情報 CDlgAbout.cpp //@@@ 2002.01.07 add start MIK
Expand Down Expand Up @@ -160,22 +160,28 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
// Last Modified: 1999/9/9 00:00:00
// (あればSKR_PATCH_INFOの文字列がそのまま表示)
CNativeT cmemMsg;
cmemMsg.AppendString(LS(STR_DLGABOUT_APPNAME));
cmemMsg.AppendString(LS(STR_DLGABOUT_APPNAME)); // e.g. "サクラエディタ", "Sakura Editor"
cmemMsg.AppendString(_T(" "));

// バージョン&リビジョン情報
// バージョン情報・コンフィグ情報 //
#ifdef GIT_COMMIT_HASH
#define VER_GITHASH "(GitHash " GIT_COMMIT_HASH ")\r\n"
#else
#define VER_GITHASH ""
#endif
DWORD dwVersionMS, dwVersionLS;
GetAppVersionInfo( NULL, VS_VERSION_INFO, &dwVersionMS, &dwVersionLS );
auto_sprintf(szMsg, _T("Ver. %d.%d.%d.%d\r\n"),
HIWORD(dwVersionMS),
LOWORD(dwVersionMS),
HIWORD(dwVersionLS),
LOWORD(dwVersionLS)
auto_sprintf(szMsg,
_T(
"v%d.%d.%d.%d %hs %hs\r\n"
"%hs"
),
HIWORD(dwVersionMS), LOWORD(dwVersionMS), HIWORD(dwVersionLS), LOWORD(dwVersionLS), // e.g. {2, 3, 2, 0}
VER_PLATFORM, // e.g. "64bit", "32bit"
VER_CONFIG, // e.g. "DEBUG", ""
VER_GITHASH // e.g. "(GitHash 4a0de5798394409af14ec69c310ba0c86efdfc05)\r\n", ""
);
cmemMsg.AppendString(szMsg);
#if defined(GIT_COMMIT_HASH)
cmemMsg.AppendString(_T("(GitHash " GIT_COMMIT_HASH ")\r\n"));
#endif
cmemMsg.AppendString( szMsg );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以下のようにするのはいかがでしょうか?
追加や削除が容易になると思います。

#ifdef GIT_COMMIT_HASH
#define VER_GITHASH "(GitHash " GIT_COMMIT_HASH ")"
#else
#define VER_GITHASH ""
#endif
	DWORD dwVersionMS, dwVersionLS;
	GetAppVersionInfo( NULL, VS_VERSION_INFO, &dwVersionMS, &dwVersionLS );
	auto_sprintf(szMsg,
		_T("v%d.%d.%d.%d"),
		HIWORD(dwVersionMS), LOWORD(dwVersionMS), HIWORD(dwVersionLS), LOWORD(dwVersionLS) // e.g. {2, 3, 2, 0}
	);
	cmemMsg.AppendString( szMsg );

	cmemMsg.AppendString( _T("  ") _T(VER_PLATFORM) );
#ifdef _DEBUG
	cmemMsg.AppendString( _T("  ") _T(VER_CONFIG) );
#endif
#ifdef GIT_COMMIT_HASH
	cmemMsg.AppendString( _T("\r\n") _T(VER_GITHASH) _T("\r\n"));
#endif
#if defined(GIT_URL)
	cmemMsg.AppendString(_T("(GitURL " GIT_URL ")\r\n"));
#endif
	cmemMsg.AppendString( _T("\r\n") );

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

今は x64 マージを優先したいです

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

了解です

#if defined(GIT_URL)
cmemMsg.AppendString(_T("(GitURL " GIT_URL ")\r\n"));
#endif
Expand Down
13 changes: 2 additions & 11 deletions sakura_core/sakura_rc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#else
#include "sakura_lang.h"
#endif
#include "gitrev.h"
#include "version.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -2814,16 +2814,7 @@ BEGIN
VALUE "LegalTrademarks", " \0"
VALUE "OriginalFilename", "sakura.exe\0"
VALUE "ProductName", "�T�N���G�f�B�^\0"
VALUE "ProductVersion", PR_VER_STR
#if defined(GIT_SHORT_COMMIT_HASH)
" (GitHash " GIT_SHORT_COMMIT_HASH ")"
#endif
#ifdef _DEBUG
" Debug version"
#endif
#ifndef _UNICODE
" ANSI"
#endif
VALUE "ProductVersion", RESOURCE_VERSION_STRING(PR_VER_STR) // e.g. "2.3.2.0 (4a0de579) UNICODE 64bit DEBUG"
END
END
BLOCK "VarFileInfo"
Expand Down
32 changes: 32 additions & 0 deletions sakura_core/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include "gitrev.h"

#ifdef _UNICODE
#define VER_CHARSET "UNICODE"
#else
#define VER_CHARSET "ANSI"
#endif

#ifdef _WIN64
#define VER_PLATFORM "64bit"
#else
#define VER_PLATFORM "32bit"
#endif

#ifdef _DEBUG
#define VER_CONFIG "DEBUG"
#else
#define VER_CONFIG ""
#endif

#ifdef _DEBUG
#define SPACE_WHEN_DEBUG " "
#else
#define SPACE_WHEN_DEBUG ""
#endif

// リソース埋め込み用バージョン文字列
// e.g. "2.3.2.0 (4a0de579) UNICODE 64bit DEBUG"
// e.g. "2.3.2.0 (4a0de579) UNICODE 64bit"
#define RESOURCE_VERSION_STRING(_VersionString) _VersionString " (" GIT_SHORT_COMMIT_HASH ") " VER_CHARSET " " VER_PLATFORM SPACE_WHEN_DEBUG VER_CONFIG
2 changes: 2 additions & 0 deletions sakura_lang_en_US/sakura_lang.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@
#include "../sakura_core/String_define.h"
#endif

#include "../sakura_core/version.h" // #define RESOURCE_VERSION_STRING(_VersionString)

#endif /* SAKURA_SAKURA_LANG_C627B14F_9909_441B_B510_9BBB2D3F078B_H_ */
/*[EOF]*/
6 changes: 3 additions & 3 deletions sakura_lang_en_US/sakura_lang_en_US.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0411</Culture>
</ResourceCompile>
<Link>
Expand Down Expand Up @@ -241,7 +241,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0411</Culture>
</ResourceCompile>
<Link>
Expand All @@ -261,7 +261,7 @@
<ResourceCompile Include="sakura_lang_rc.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="sakura_rc.h" />
<ClInclude Include="sakura_lang.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
14 changes: 2 additions & 12 deletions sakura_lang_en_US/sakura_lang_rc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#else
#include "sakura_lang.h"
#endif
#include "../sakura_core/gitrev.h"
#include "../sakura_core/version.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -2790,7 +2790,6 @@ END
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION FL_VER
PRODUCTVERSION PR_VER
Expand All @@ -2817,16 +2816,7 @@ BEGIN
VALUE "LegalTrademarks", " \0"
VALUE "OriginalFilename", "sakura.exe\0"
VALUE "ProductName", "Sakura Editor Language DLL\0"
VALUE "ProductVersion", PR_VER_STR
#if defined(GIT_SHORT_COMMIT_HASH)
" (GitHash " GIT_SHORT_COMMIT_HASH ")"
#endif
#ifdef _DEBUG
" Debug version"
#endif
#ifndef _UNICODE
" ANSI"
#endif
VALUE "ProductVersion", RESOURCE_VERSION_STRING(PR_VER_STR) // e.g. "2.3.2.0 4a0de579 UNICODE 64bit DEBUG"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

対応しました

END
END
BLOCK "VarFileInfo"
Expand Down