meson: Rely only on extracted version in lz4.h

So now instead of warning when failing to extract version number
from lz4.h, we error and stop the build instead.
This commit is contained in:
Lzu Tao 2019-04-30 12:25:40 +07:00
parent dd54ea01a2
commit cb1be75c84
2 changed files with 6 additions and 11 deletions

View File

@ -178,9 +178,9 @@ matrix:
compiler: clang compiler: clang
install: install:
- sudo apt-get install -qq python3 tree - sudo apt-get install -qq python3 tree
- curl -o ~/ninja.zip -L 'https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip' - travis_retry curl -o ~/ninja.zip -L 'https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip'
&& unzip ~/ninja.zip -d ~/.local/bin && unzip ~/ninja.zip -d ~/.local/bin
- curl -o ~/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' - travis_retry curl -o ~/get-pip.py 'https://bootstrap.pypa.io/get-pip.py'
&& python3 ~/get-pip.py --user && python3 ~/get-pip.py --user
&& pip3 install --user meson && pip3 install --user meson
script: script:

View File

@ -11,9 +11,7 @@ project('lz4', ['c'],
license: ['BSD', 'GPLv2'], license: ['BSD', 'GPLv2'],
default_options : ['c_std=c99', default_options : ['c_std=c99',
'buildtype=release'], 'buildtype=release'],
# Fall-back version in case of extracting version number from version: 'DUMMY',
# `lz4.h` failed.
version: '1.9.1',
meson_version: '>=0.47.0') meson_version: '>=0.47.0')
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
@ -40,13 +38,10 @@ lz4_h_file = join_paths(meson.current_source_dir(), '../../lib/lz4.h')
GetLz4LibraryVersion_py = files('GetLz4LibraryVersion.py') GetLz4LibraryVersion_py = files('GetLz4LibraryVersion.py')
r = run_command(python3, GetLz4LibraryVersion_py, lz4_h_file) r = run_command(python3, GetLz4LibraryVersion_py, lz4_h_file)
if r.returncode() == 0 if r.returncode() == 0
output = r.stdout().strip() lz4_version = r.stdout().strip()
if output.version_compare('>@0@'.format(lz4_version)) message('Project version is now: @0@'.format(lz4_version))
lz4_version = output
message('Project version is now: @0@'.format(lz4_version))
endif
else else
warning('Cannot find project version in @0@'.format(lz4_h_file)) error('Cannot find project version in @0@'.format(lz4_h_file))
endif endif
lz4_libversion = lz4_version lz4_libversion = lz4_version