build: Generate xemu version header

This commit is contained in:
Matt Borgerson 2021-05-19 00:12:22 -07:00 committed by mborgerson
parent e0f4ea28ca
commit 6e2d5a993f
5 changed files with 49 additions and 33 deletions

1
.gitignore vendored
View File

@ -16,5 +16,4 @@ GTAGS
build.log
/dist
/xemu-version.c
/xemu.ini

View File

@ -149,6 +149,20 @@ if sparse.found()
'-Wno-non-pointer-null'])
endif
###########################################
# xemu Version
###########################################
xemu_version_cmd = [find_program('scripts/xemu-version.sh'),
meson.current_source_dir()]
xemu_version = custom_target('xemu-version-macro.h',
output: 'xemu-version-macro.h',
command: xemu_version_cmd,
capture: true,
build_by_default: true,
build_always_stale: true)
###########################################
# Target-specific checks and dependencies #
###########################################
@ -178,7 +192,8 @@ if targetos == 'windows'
win = import('windows')
version_res = win.compile_resources('version.rc',
depend_files: files('pc-bios/qemu-nsis.ico'),
include_directories: include_directories('.'))
include_directories: include_directories('.'),
depends: xemu_version)
elif targetos == 'darwin'
coref = dependency('appleframeworks', modules: 'CoreFoundation')
iokit = dependency('appleframeworks', modules: 'IOKit')
@ -1712,16 +1727,8 @@ qemu_version = custom_target('qemu-version.h',
build_by_default: true,
build_always_stale: true)
xemu_version_cmd = [find_program('scripts/xemu-version.sh'),
meson.current_source_dir()]
xemu_version = custom_target('xemu-version.c',
output: 'xemu-version.c',
command: xemu_version_cmd,
capture: true,
build_by_default: true,
build_always_stale: true)
genh += qemu_version
genh += xemu_version
hxdep = []
hx_headers = [
@ -1946,13 +1953,7 @@ if have_block
softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
endif
specific_ss.add(files('xemu-xbe.c'))
libxemuver = static_library('xemuver', sources: xemu_version,
name_suffix: 'fa',
build_by_default: false)
xemuver = declare_dependency(link_whole: libxemuver)
common_ss.add(xemuver)
specific_ss.add(files('xemu-xbe.c', 'xemu-version.c'))
common_ss.add(files('cpus-common.c'))

View File

@ -26,9 +26,26 @@ XEMU_VERSION=$( \
cat XEMU_VERSION; \
fi)
get_version_field() {
echo ${XEMU_VERSION}-0 | cut -d- -f$1
}
get_version_dot () {
echo $(get_version_field 1) | cut -d. -f$1
}
XEMU_VERSION_MAJOR=$(get_version_dot 1)
XEMU_VERSION_MINOR=$(get_version_dot 2)
XEMU_VERSION_MICRO=$(get_version_dot 3)
XEMU_VERSION_PATCH=$(get_version_field 2)
cat <<EOF
const char *xemu_version = "$XEMU_VERSION";
const char *xemu_branch = "$XEMU_BRANCH";
const char *xemu_commit = "$XEMU_COMMIT";
const char *xemu_date = "$XEMU_DATE";
#define XEMU_VERSION "$XEMU_VERSION"
#define XEMU_VERSION_MAJOR $XEMU_VERSION_MAJOR
#define XEMU_VERSION_MINOR $XEMU_VERSION_MINOR
#define XEMU_VERSION_MICRO $XEMU_VERSION_MICRO
#define XEMU_VERSION_PATCH $XEMU_VERSION_PATCH
#define XEMU_BRANCH "$XEMU_BRANCH"
#define XEMU_COMMIT "$XEMU_COMMIT"
#define XEMU_DATE "$XEMU_DATE"
EOF

View File

@ -1,17 +1,10 @@
#include <winver.h>
#if 0
#include "config-host.h"
#endif
/* FIXME: Automate */
#define QEMU_VERSION "0.5.1"
#define QEMU_VERSION_MAJOR 0
#define QEMU_VERSION_MINOR 5
#define QEMU_VERSION_MICRO 1
#include "xemu-version-macro.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION QEMU_VERSION_MAJOR,QEMU_VERSION_MINOR,QEMU_VERSION_MICRO,0
PRODUCTVERSION QEMU_VERSION_MAJOR,QEMU_VERSION_MINOR,QEMU_VERSION_MICRO,0
FILEVERSION XEMU_VERSION_MAJOR,XEMU_VERSION_MINOR,XEMU_VERSION_MICRO,XEMU_VERSION_PATCH
PRODUCTVERSION XEMU_VERSION_MAJOR,XEMU_VERSION_MINOR,XEMU_VERSION_MICRO,XEMU_VERSION_PATCH
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
@ -23,7 +16,7 @@ FILESUBTYPE VFT2_UNKNOWN
{
VALUE "CompanyName", "https://xemu.app"
VALUE "FileDescription", "xemu: Original Xbox Emulator"
VALUE "FileVersion", QEMU_VERSION
VALUE "FileVersion", XEMU_VERSION
VALUE "LegalCopyright", "Copyright various authors. Released under the GNU General Public License."
VALUE "LegalTrademarks", "QEMU is a trademark of Fabrice Bellard."
VALUE "ProductName", "xemu"

6
xemu-version.c Normal file
View File

@ -0,0 +1,6 @@
#include "xemu-version-macro.h"
const char *xemu_version = XEMU_VERSION;
const char *xemu_branch = XEMU_BRANCH;;
const char *xemu_commit = XEMU_COMMIT;
const char *xemu_date = XEMU_DATE;