1
0
Fork 0

meson: create git_version.h in build directory in version.sh

This commit is contained in:
Myaamori 2020-10-27 19:31:58 +00:00 committed by Ryan Lucia
parent bb02d3bc5e
commit 51b8248ac8
2 changed files with 5 additions and 4 deletions

View File

@ -13,7 +13,7 @@ else
endif
version_inc = include_directories('.')
version_h = custom_target('git_version.h',
command: [version_sh, meson.current_build_dir()],
command: [version_sh, meson.current_build_dir(), meson.current_source_dir()],
build_by_default: true,
build_always_stale: true, # has internal check whether target file will be refreshed
output: ['git_version.h', 'git_version.xml'])

View File

@ -1,7 +1,8 @@
srcdir="$1"
builddir="$1"
srcdir="$2"
# If no git repo try to read from the existing git_version.h, for building from tarballs
version_h_path="${srcdir}/git_version.h"
version_h_path="${builddir}/git_version.h"
if ! test -d "${srcdir}/.git"; then
if test -f "${version_h_path}"; then
while read line; do
@ -65,7 +66,7 @@ export BUILD_GIT_VERSION_NUMBER="${git_revision}"
export BUILD_GIT_VERSION_STRING="${git_version_str}"
export VERSION_SOURCE="from git"
cat << EOF > "${srcdir}/git_version.xml"
cat << EOF > "${builddir}/git_version.xml"
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>