ocarina: Add OCARINA_{MAJOR, MINOR}_VERSION constants

These can be used for version number comparisons as integers, which will
be useful once file version numbers are based off of minor versions.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-08-17 13:30:43 -04:00
parent 0cb44aaf3a
commit 43a0ffd54c
4 changed files with 15 additions and 5 deletions

View File

@ -9,10 +9,9 @@ option(CONFIG_TESTING_ALBUM_ARTWORK "Enable album art fetching tests" ON)
# Configure settings
set(CONFIG_MAJOR 6)
set(CONFIG_MINOR 5)
set(CONFIG_MICRO 0)
set(CONFIG_RC OFF)
set(CONFIG_VERSION "${CONFIG_MAJOR}.${CONFIG_MINOR}.${CONFIG_MICRO}")
set(CONFIG_VERSION "${CONFIG_MAJOR}.${CONFIG_MINOR}")
if (CONFIG_RC)
set(CONFIG_VERSION "${CONFIG_VERSION}-rc")
@ -36,6 +35,8 @@ if (GIT_FOUND AND IS_DIRECTORY .git/)
endif()
add_definitions(-DCONFIG_VERSION=\"${CONFIG_VERSION}\")
add_definitions(-DCONFIG_MAJOR=${CONFIG_MAJOR})
add_definitions(-DCONFIG_MINOR=${CONFIG_MINOR})
find_package(PkgConfig REQUIRED)
function(use_module name module)

View File

@ -16,9 +16,9 @@
#define OCARINA_FLAGS (G_APPLICATION_FLAGS_NONE)
#ifndef CONFIG_DEBUG
const static gchar *OCARINA_NAME = "org.gtk.ocarina";
const static gchar *OCARINA_APP = "org.gtk.ocarina";
#else
const static gchar *OCARINA_NAME = "org.gtk.ocarina-debug";
const static gchar *OCARINA_APP = "org.gtk.ocarina-debug";
#endif
struct core_init_data init_data = {
@ -80,7 +80,7 @@ static void __ocarina_shutdown(GApplication *application, gpointer data)
int main(int argc, char **argv)
{
GtkApplication *ocarina = gtk_application_new(OCARINA_NAME, OCARINA_FLAGS);
GtkApplication *ocarina = gtk_application_new(OCARINA_APP, OCARINA_FLAGS);
startup_argc = argc;
startup_argv = argv;

View File

@ -12,6 +12,9 @@
#define OCARINA_NAME "ocarina"
#endif
#define OCARINA_MAJOR_VERSION CONFIG_MAJOR
#define OCARINA_MINOR_VERSION CONFIG_MINOR
/*
* Scons sets the current version by passing the
* -DCONFIG_VERSION macro when Ocarina is compiled.

View File

@ -8,6 +8,12 @@ static void test_version()
{
g_assert_cmpstr(get_version(), ==, CONFIG_VERSION);
g_assert_cmpstr(OCARINA_NAME, ==, "ocarina-test/core/version");
g_assert_cmpuint(CONFIG_MAJOR, >=, 0);
g_assert_cmpuint(CONFIG_MINOR, >=, 0);
g_assert_cmpuint(OCARINA_MAJOR_VERSION, ==, CONFIG_MAJOR);
g_assert_cmpuint(OCARINA_MINOR_VERSION, ==, CONFIG_MINOR);
}
int main(int argc, char **argv)