Unverified Commit df5bc509 authored by Tachi's avatar Tachi

Support Meson versions as old as 0.50.0

parent 8f7cd12a
...@@ -149,6 +149,12 @@ executable( ...@@ -149,6 +149,12 @@ executable(
) )
``` ```
If you're using a Meson version older than 0.55.0 you'll have to use the "older" syntax for `depependecy()`:
```meson
dependencies: dependency('pistache', fallback ['pistache', 'pistache_static_dep'])
```
### Makefile ### Makefile
To use within a vanilla makefile, you can call `pkg-config` directly to supply compiler and linker flags using shell substitution. To use within a vanilla makefile, you can call `pkg-config` directly to supply compiler and linker flags using shell substitution.
......
...@@ -10,7 +10,7 @@ project( ...@@ -10,7 +10,7 @@ project(
'b_lto=false', 'b_lto=false',
'warning_level=3' 'warning_level=3'
], ],
meson_version: '>=0.57.0' meson_version: '>=0.50.0'
) )
compiler = meson.get_compiler('cpp') compiler = meson.get_compiler('cpp')
...@@ -72,8 +72,16 @@ if get_option('PISTACHE_USE_SSL') ...@@ -72,8 +72,16 @@ if get_option('PISTACHE_USE_SSL')
pc_libs += ['-lssl', '-lcrypto'] pc_libs += ['-lssl', '-lcrypto']
endif endif
fs = import('fs') version_data_raw = ''
version_data_raw = fs.read('version.txt').split('\n') if meson.version().version_compare('>=0.57.0')
fs = import('fs')
version_data_raw = fs.read('version.txt').split('\n')
else
# Ugly workaround for reading a file
version_data_raw = run_command(
find_program('python3'), '-c', 'print(open("version.txt").read())'
).stdout().strip().split('\n')
endif
version_data_conf = configuration_data() version_data_conf = configuration_data()
foreach _ : version_data_raw foreach _ : version_data_raw
if _ != '' if _ != ''
......
...@@ -50,8 +50,10 @@ libpistache_shared = shared_library( ...@@ -50,8 +50,10 @@ libpistache_shared = shared_library(
pistache_static_dep = declare_dependency(link_with: libpistache_static, include_directories: incl_pistache) pistache_static_dep = declare_dependency(link_with: libpistache_static, include_directories: incl_pistache)
pistache_shared_dep = declare_dependency(link_with: libpistache_shared, include_directories: incl_pistache) pistache_shared_dep = declare_dependency(link_with: libpistache_shared, include_directories: incl_pistache)
if get_option('default_library') == 'static' if meson.version().version_compare('>=0.54.0')
if get_option('default_library') == 'static'
meson.override_dependency('pistache', pistache_static_dep) meson.override_dependency('pistache', pistache_static_dep)
else else
meson.override_dependency('pistache', pistache_shared_dep) meson.override_dependency('pistache', pistache_shared_dep)
endif
endif endif
...@@ -7,7 +7,7 @@ cppcheck = find_program('cppcheck', required: false) ...@@ -7,7 +7,7 @@ cppcheck = find_program('cppcheck', required: false)
if cppcheck.found() if cppcheck.found()
cppcheck_args = ['--enable=all','-DCPPCHECK','--suppress=*:third-party*','--suppress=*:tests*','--suppress=noExplicitConstructor:include/pistache/optional.h'] cppcheck_args = ['--enable=all','-DCPPCHECK','--suppress=*:third-party*','--suppress=*:tests*','--suppress=noExplicitConstructor:include/pistache/optional.h']
else else
warning('can\'t find Cppcheck') warning('Can\'t find Cppcheck')
endif endif
# TODO # TODO
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment