mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-04 05:03:10 +02:00
Use vcs_tag
to get Git version instead of run_command
This way Meson will automatically keep the Git hash updated as you make new Git commits, rather than forcing you to reconfigure the build again every time you make a new commit to keep the commit hash updated.
This commit is contained in:
parent
37a7559e38
commit
b9bb3535ae
4 changed files with 11 additions and 4 deletions
|
@ -64,6 +64,10 @@ extern "C" {
|
|||
#include <SDL_loadso.h>
|
||||
#include <SDL_power.h>
|
||||
|
||||
#ifndef MKXPZ_BUILD_XCODE
|
||||
# include "git-hash.h"
|
||||
#endif // MKXPZ_BUILD_XCODE
|
||||
|
||||
extern const char module_rpg1[];
|
||||
extern const char module_rpg2[];
|
||||
extern const char module_rpg3[];
|
||||
|
|
|
@ -7,8 +7,6 @@ if get_option('retro') == false and host_system == 'darwin'
|
|||
error('\nThis Meson project no longer supports macOS. Please use the Xcode project instead.')
|
||||
endif
|
||||
|
||||
git_hash = run_command('git', 'rev-parse', '--short', 'HEAD', check: true).stdout().strip()
|
||||
|
||||
compilers = {'cpp': meson.get_compiler('cpp')}
|
||||
|
||||
global_sources = []
|
||||
|
@ -24,7 +22,6 @@ 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
|
||||
|
@ -149,7 +146,6 @@ if get_option('retro') == true
|
|||
|
||||
retro_defines = [
|
||||
'-DMKXPZ_VERSION="@0@"'.format(meson.project_version()),
|
||||
'-DMKXPZ_GIT_HASH="@0@"'.format(git_hash),
|
||||
'-DWASM_RT_SKIP_SIGNAL_RECOVERY',
|
||||
'-DWASM_RT_TRAP_HANDLER=mkxp_sandbox_trap_handler',
|
||||
'-DMKXPZ_RETRO',
|
||||
|
@ -247,6 +243,7 @@ if get_option('retro') == true
|
|||
include_directories(join_paths(retro_phase1, 'sdl/include')),
|
||||
],
|
||||
sources: [
|
||||
vcs_tag(command: ['git', 'rev-parse', '--short', 'HEAD'], input: 'src/git-hash.h.in', output: 'git-hash.h', replace_string: '@MKXPZ_GIT_HASH@'),
|
||||
'src/core.cpp',
|
||||
'src/sharedstate.cpp',
|
||||
'src/audio/alstream.cpp',
|
||||
|
@ -286,6 +283,8 @@ if get_option('retro') == true
|
|||
)
|
||||
else
|
||||
|
||||
global_sources += vcs_tag(command: ['git', 'rev-parse', '--short', 'HEAD'], input: 'src/git-hash.h.in', output: 'git-hash.h', replace_string: '@MKXPZ_GIT_HASH@')
|
||||
|
||||
xxd = find_program('xxd', native: true)
|
||||
|
||||
# STEAMWORKS
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <AL/alext.h>
|
||||
#include <fluidlite.h>
|
||||
#include <fluidsynth_priv.h>
|
||||
#include "git-hash.h"
|
||||
#include "../binding-sandbox/sandbox.h"
|
||||
#include "../binding-sandbox/binding-sandbox.h"
|
||||
#include "../binding-sandbox/core.h"
|
||||
|
|
3
src/git-hash.h.in
Normal file
3
src/git-hash.h.in
Normal file
|
@ -0,0 +1,3 @@
|
|||
#ifndef MKXPZ_GIT_HASH
|
||||
#define MKXPZ_GIT_HASH "@MKXPZ_GIT_HASH@"
|
||||
#endif /* MKXPZ_GIT_HASH */
|
Loading…
Add table
Reference in a new issue