diff --git a/binding/binding-mri.cpp b/binding/binding-mri.cpp
index f7f293a..8dfe675 100644
--- a/binding/binding-mri.cpp
+++ b/binding/binding-mri.cpp
@@ -266,7 +266,12 @@ static void mriBindingInit() {
rb_gv_set("BTEST", rb_bool_new(shState->config().editor.battleTest));
- VALUE vers = rb_utf8_str_new_cstr(MKXPZ_VERSION);
+#ifdef MKXPZ_BUILD_XCODE
+ std::string version = std::string(MKXPZ_VERSION "/") + getPlistValue("GIT_COMMIT_HASH");
+ VALUE vers = rb_utf8_str_new_cstr(version.c_str());
+#else
+ VALUE vers = rb_utf8_str_new_cstr(MKXPZ_VERSION "/" MKXPZ_GIT_HASH);
+#endif
rb_str_freeze(vers);
rb_define_const(mod, "VERSION", vers);
diff --git a/macos/Info.plist b/macos/Info.plist
index 8f7965f..9baaf76 100644
--- a/macos/Info.plist
+++ b/macos/Info.plist
@@ -18,6 +18,8 @@
APPL
CFBundleShortVersionString
$(MARKETING_VERSION)
+ GIT_COMMIT_HASH
+ 81616eb
IFMajorVersion
0
IFMinorVersion
diff --git a/macos/mkxp-z.xcodeproj/project.pbxproj b/macos/mkxp-z.xcodeproj/project.pbxproj
index 26065b5..e89af34 100644
--- a/macos/mkxp-z.xcodeproj/project.pbxproj
+++ b/macos/mkxp-z.xcodeproj/project.pbxproj
@@ -1894,6 +1894,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 3B1C23EF25A19C600075EF5D /* Build configuration list for PBXNativeTarget "Z-steam" */;
buildPhases = (
+ FE4F72FE2A179EE0004FED68 /* ShellScript */,
3B1C237025A19C600075EF5D /* Sources */,
3B1C23C225A19C600075EF5D /* Frameworks */,
3B1C23E625A19C600075EF5D /* Resources */,
@@ -1937,6 +1938,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 3BBE88062705A73400A574AE /* Build configuration list for PBXNativeTarget "Z-steam-universal" */;
buildPhases = (
+ FE4F72FD2A179ED5004FED68 /* ShellScript */,
3BBE87852705A73400A574AE /* Sources */,
3BBE87CE2705A73400A574AE /* Frameworks */,
3BBE87F42705A73400A574AE /* Resources */,
@@ -1961,6 +1963,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 3BC65E122584F3AD0063AFF1 /* Build configuration list for PBXNativeTarget "Z-universal" */;
buildPhases = (
+ FE4F72FB2A179D9E004FED68 /* ShellScript */,
3BC65D8D2584F3AD0063AFF1 /* Sources */,
3BC65DDB2584F3AD0063AFF1 /* Frameworks */,
3BC65E0D2584F3AD0063AFF1 /* Resources */,
@@ -1983,6 +1986,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 3BD2B7222565AEC0003DAD8A /* Build configuration list for PBXNativeTarget "Z-intel" */;
buildPhases = (
+ FE4F72FC2A179ECC004FED68 /* ShellScript */,
3BD2B64C2565AEC0003DAD8A /* Sources */,
3BD2B6E12565AEC0003DAD8A /* Frameworks */,
3BD2B6F82565AEC0003DAD8A /* Resources */,
@@ -2093,6 +2097,77 @@
};
/* End PBXResourcesBuildPhase section */
+/* Begin PBXShellScriptBuildPhase section */
+ FE4F72FB2A179D9E004FED68 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nCOMMIT_HASH=`git rev-parse --short HEAD`\n/usr/libexec/PlistBuddy -c \"Set :GIT_COMMIT_HASH $COMMIT_HASH\" \"${INFOPLIST_FILE}\"\n";
+ };
+ FE4F72FC2A179ECC004FED68 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nCOMMIT_HASH=`git rev-parse --short HEAD`\n/usr/libexec/PlistBuddy -c \"Set :GIT_COMMIT_HASH $COMMIT_HASH\" \"${INFOPLIST_FILE}\"\n";
+ };
+ FE4F72FD2A179ED5004FED68 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nCOMMIT_HASH=`git rev-parse --short HEAD`\n/usr/libexec/PlistBuddy -c \"Set :GIT_COMMIT_HASH $COMMIT_HASH\" \"${INFOPLIST_FILE}\"\n";
+ };
+ FE4F72FE2A179EE0004FED68 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nCOMMIT_HASH=`git rev-parse --short HEAD`\n/usr/libexec/PlistBuddy -c \"Set :GIT_COMMIT_HASH $COMMIT_HASH\" \"${INFOPLIST_FILE}\"\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
/* Begin PBXSourcesBuildPhase section */
3B1C235225A199370075EF5D /* Sources */ = {
isa = PBXSourcesBuildPhase;
diff --git a/meson.build b/meson.build
index 1155bb3..706faf0 100644
--- a/meson.build
+++ b/meson.build
@@ -8,6 +8,8 @@ endif
xxd = find_program('xxd', native: true)
+git_hash = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
+
compilers = {'cpp': meson.get_compiler('cpp')}
global_sources = []
@@ -23,6 +25,7 @@ win64 = (sizeof['void*'] != sizeof['long'])
global_args += '-DMKXPZ_BUILD_MESON'
global_args += '-DMKXPZ_VERSION="@0@"'.format(meson.project_version())
+global_args += '-DMKXPZ_GIT_HASH="@0@"'.format(git_hash)
global_args += '-DHAVE_NANOSLEEP'
# ====================
# Ext libs
diff --git a/src/system/system.h b/src/system/system.h
index 9ad7eed..4ef8738 100644
--- a/src/system/system.h
+++ b/src/system/system.h
@@ -40,6 +40,7 @@ WineHostType getRealHostType();
}
#ifdef MKXPZ_BUILD_XCODE
+std::string getPlistValue(const char *key);
void openSettingsWindow();
bool isMetalSupported();
#endif
diff --git a/src/system/systemImplApple.mm b/src/system/systemImplApple.mm
index 6e86f71..bfbc98b 100644
--- a/src/system/systemImplApple.mm
+++ b/src/system/systemImplApple.mm
@@ -62,3 +62,11 @@ bool isMetalSupported() {
}
return false;
}
+
+std::string getPlistValue(const char *key) {
+ NSString *hash = [[NSBundle mainBundle] objectForInfoDictionaryKey:@(key)];
+ if (hash != nil) {
+ return std::string(hash.UTF8String);
+ }
+ return "";
+}