mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
build: Make sure changing commit hash doesn't trigger a full rebuild
Closes #1137
This commit is contained in:
@@ -301,7 +301,7 @@ namespace hex {
|
||||
}
|
||||
|
||||
runtime.addDefine("__IMHEX__");
|
||||
runtime.addDefine("__IMHEX_VERSION__", IMHEX_VERSION);
|
||||
runtime.addDefine("__IMHEX_VERSION__", ImHexApi::System::getImHexVersion());
|
||||
}
|
||||
|
||||
void addPragma(const std::string &name, const pl::api::PragmaHandler &handler) {
|
||||
|
||||
@@ -586,6 +586,39 @@ namespace hex {
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string getImHexVersion() {
|
||||
#if defined IMHEX_VERSION
|
||||
return IMHEX_VERSION;
|
||||
#else
|
||||
return "Unknown";
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string getCommitHash(bool longHash) {
|
||||
if (longHash) {
|
||||
#if defined GIT_COMMIT_HASH_LONG
|
||||
return GIT_COMMIT_HASH_LONG;
|
||||
#else
|
||||
return "Unknown";
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if defined GIT_COMMIT_HASH_SHORT
|
||||
return GIT_COMMIT_HASH_SHORT;
|
||||
#else
|
||||
return "Unknown";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
std::string getCommitBranch() {
|
||||
#if defined GIT_BRANCH
|
||||
return GIT_BRANCH;
|
||||
#else
|
||||
return "Unknown";
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <hex/api/plugin_manager.hpp>
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
|
||||
#include <hex/helpers/logger.hpp>
|
||||
#include <hex/helpers/utils.hpp>
|
||||
@@ -73,9 +74,13 @@ namespace hex {
|
||||
return false;
|
||||
|
||||
const auto requestedVersion = getCompatibleVersion();
|
||||
if (requestedVersion != IMHEX_VERSION) {
|
||||
log::error("Refused to load plugin '{}' which was built for a different version of ImHex: '{}'", wolv::util::toUTF8String(this->m_path.filename()), requestedVersion);
|
||||
return false;
|
||||
if (requestedVersion != ImHexApi::System::getImHexVersion()) {
|
||||
if (requestedVersion.empty()) {
|
||||
log::warn("Plugin '{}' did not specify a compatible version, assuming it is compatible with the current version of ImHex.", wolv::util::toUTF8String(this->m_path.filename()));
|
||||
} else {
|
||||
log::error("Refused to load plugin '{}' which was built for a different version of ImHex: '{}'", wolv::util::toUTF8String(this->m_path.filename()), requestedVersion);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->m_initializePluginFunction != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user