Skip to content

Commit

Permalink
Dynamically determine version.
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-graj committed Mar 27, 2023
1 parent 5f206c6 commit 536777e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ obj/
orbvis
*.glade~
builddir/
version.h
6 changes: 3 additions & 3 deletions src/entity/earth.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ void earth_init(void)
model_init(&model, &obj_earth);

shader_init(&shader, (const char *)res_shader_earth_vert, res_shader_earth_vert_len, (const char *)res_shader_earth_frag, res_shader_earth_frag_len, 2, (struct ShaderAttr[]){
{ LOCL_APOS, "in_pos" },
{ LOCL_ATEXCOORD, "in_uv" },
});
{ LOCL_APOS, "in_pos" },
{ LOCL_ATEXCOORD, "in_uv" },
});

texture_init_from_image(&texture_day, res_texture_earth_daymap_jpg, res_texture_earth_daymap_jpg_len, GL_TEXTURE0, GL_TEXTURE_2D);
texture_init_from_image(&texture_night, res_texture_earth_nightmap_jpg, res_texture_earth_nightmap_jpg_len, GL_TEXTURE1, GL_TEXTURE_2D);
Expand Down
6 changes: 3 additions & 3 deletions src/entity/satellite.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ void satellite_init(void)
vao_attr(&vao_orbits, &vbo_orbit_colors, LOCL_COLOR, 3, GL_FLOAT, sizeof(vec3), 0);

shader_init(&shader, (const char *)res_shader_satellite_vert, res_shader_satellite_vert_len, (const char *)res_shader_satellite_frag, res_shader_satellite_frag_len, 2, (struct ShaderAttr[]){
{ LOCL_APOS, "in_pos" },
{ LOCL_COLOR, "in_color" },
});
{ LOCL_APOS, "in_pos" },
{ LOCL_COLOR, "in_color" },
});

alloc_orbit_arrays();

Expand Down
6 changes: 3 additions & 3 deletions src/entity/sky.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ void sky_init(void)
model_transform(&model);

shader_init(&shader, (const char *)res_shader_sky_vert, res_shader_sky_vert_len, (const char *)res_shader_sky_frag, res_shader_sky_frag_len, 2, (struct ShaderAttr[]){
{ LOCL_APOS, "in_pos" },
{ LOCL_ATEXCOORD, "in_uv" },
});
{ LOCL_APOS, "in_pos" },
{ LOCL_ATEXCOORD, "in_uv" },
});

texture_init_from_image(&texture, res_texture_stars_jpg, res_texture_stars_jpg_len, GL_TEXTURE0, GL_TEXTURE_2D);

Expand Down
7 changes: 7 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ orbvis_incdir = include_directories([
'ui',
'util',
])

conf_data = configuration_data()
conf_data.set('version', meson.project_version())
configure_file(input: 'version.h.in',
output : 'version.h',
configuration : conf_data
)
12 changes: 2 additions & 10 deletions src/util/version.h → src/version.h.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Wojciech Graj
* Copyright (c) 2023 Wojciech Graj
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand All @@ -15,22 +15,14 @@
#ifndef __VERSION_H__
#define __VERSION_H__

#include "type.h"

#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
#define VERSION_STRING "@version@"

#ifdef DEBUG
#define DEBUG_STRING "-debug"
#else
#define DEBUG_STRING
#endif

#define VERSION_STRING \
XSTR(VERSION_MAJOR) \
"." XSTR(VERSION_MINOR) "." XSTR(VERSION_PATCH) DEBUG_STRING

#define ABOUT_STRING "OrbVis " VERSION_STRING "\nCopyright (c) 2022-2023 Wojciech Graj" \
"\nLicense GPLv2+: GNU GPL version 2 or later."

Expand Down

0 comments on commit 536777e

Please sign in to comment.