cmake: Add commit to version.hpp template

Switches out the `const uint16_t` for actual defines, which are easier to deal with and work in C out of the box.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-10-13 05:54:20 +02:00
parent aeb34450f6
commit f1a376d44b
3 changed files with 17 additions and 18 deletions

View file

@ -17,19 +17,20 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef STREAMEFFECTS_VERSION_HPP
#define STREAMEFFECTS_VERSION_HPP
#pragma once
#include <inttypes.h>
#include <cinttypes>
#define MAKE_VERSION(major,minor,patch,tweak) ((uint64_t(major) & 0xFFFFull) << 48ull) | ((uint64_t(minor) & 0xFFFFull) << 32ull) | ((uint64_t(patch) & 0xFFFFull) << 16ull) | ((uint64_t(patch) & 0xFFFFull))
#define STREAMEFFECTS_MAKE_VERSION(major,minor,patch,tweak) ((uint64_t(major) & 0xFFFFull) << 48ull) | ((uint64_t(minor) & 0xFFFFull) << 32ull) | ((uint64_t(patch) & 0xFFFFull) << 16ull) | ((uint64_t(patch) & 0xFFFFull))
const uint16_t PROJECT_VERSION_MAJOR = @PROJECT_VERSION_MAJOR@;
const uint16_t PROJECT_VERSION_MINOR = @PROJECT_VERSION_MINOR@;
const uint16_t PROJECT_VERSION_PATCH = @PROJECT_VERSION_PATCH@;
const uint16_t PROJECT_VERSION_TWEAK = @PROJECT_VERSION_TWEAK@;
const uint64_t PROJECT_VERSION = MAKE_VERSION(PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH, PROJECT_VERSION_TWEAK);
#define STREAMEFFECTS_COMMIT "@PROJECT_COMMIT@"
#define STREAMEFFECTS_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define STREAMEFFECTS_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define STREAMEFFECTS_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define STREAMEFFECTS_VERSION_BUILD @PROJECT_VERSION_TWEAK@
#define STREAMEFFECTS_VERSION STREAMEFFECTS_MAKE_VERSION(STREAMEFFECTS_VERSION_MAJOR, STREAMEFFECTS_VERSION_MINOR, STREAMEFFECTS_VERSION_PATCH, STREAMEFFECTS_VERSION_BUILD)
#define STREAMEFFECTS_VERSION_STRING "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@-@PROJECT_COMMIT@"
const uint16_t PLUGIN_VERSION_MAJOR = @PROJECT_VERSION_MAJOR@;
const uint16_t PLUGIN_VERSION_MINOR = @PROJECT_VERSION_MINOR@;
const uint16_t PLUGIN_VERSION_PATCH = @PROJECT_VERSION_PATCH@;
const uint16_t PLUGIN_VERSION_TWEAK = @PROJECT_VERSION_TWEAK@;
const uint64_t PLUGIN_VERSION_FULL = (((uint64_t)(PLUGIN_VERSION_MAJOR & 0xFFFF) << 48ull) | ((uint64_t)(PLUGIN_VERSION_MINOR & 0xFFFF) << 32ull) | ((uint64_t)(PLUGIN_VERSION_PATCH) & 0xFFFFFFFF));
#endif STREAMEFFECTS_VERSION_HPP

View file

@ -562,7 +562,7 @@ void filter::blur::blur_instance::translate_old_settings(obs_data_t* settings)
int64_t version = obs_data_get_int(settings, S_VERSION);
// If it's the same as the current version, return.
if (version == PROJECT_VERSION) {
if (version == STREAMEFFECTS_VERSION) {
return;
}
@ -601,7 +601,7 @@ void filter::blur::blur_instance::translate_old_settings(obs_data_t* settings)
obs_data_unset_user_value(settings, "Filter.Blur.Directional.Angle");
}
obs_data_set_int(settings, S_VERSION, PROJECT_VERSION);
obs_data_set_int(settings, S_VERSION, STREAMEFFECTS_VERSION);
}
obs_properties_t* filter::blur::blur_instance::get_properties()

View file

@ -31,8 +31,7 @@
#include "sources/source-shader.hpp"
MODULE_EXPORT bool obs_module_load(void) try {
P_LOG_INFO("Loading Version %u.%u.%u (Build %u)", PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR,
PROJECT_VERSION_PATCH, PROJECT_VERSION_TWEAK);
P_LOG_INFO("Loading Version %s", STREAMEFFECTS_VERSION_STRING);
// Initialize Source Tracker
obs::source_tracker::initialize();
@ -57,8 +56,7 @@ MODULE_EXPORT bool obs_module_load(void) try {
}
MODULE_EXPORT void obs_module_unload(void) try {
P_LOG_INFO("Unloading Version %u.%u.%u (Build %u)", PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR,
PROJECT_VERSION_PATCH, PROJECT_VERSION_TWEAK);
P_LOG_INFO("Unloading Version %s", STREAMEFFECTS_VERSION_STRING);
// Clean up Sources
source::mirror::mirror_factory::finalize();