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(
)
```
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
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(
'b_lto=false',
'warning_level=3'
],
meson_version: '>=0.57.0'
meson_version: '>=0.50.0'
)
compiler = meson.get_compiler('cpp')
......@@ -72,8 +72,16 @@ if get_option('PISTACHE_USE_SSL')
pc_libs += ['-lssl', '-lcrypto']
endif
fs = import('fs')
version_data_raw = fs.read('version.txt').split('\n')
version_data_raw = ''
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()
foreach _ : version_data_raw
if _ != ''
......
......@@ -50,8 +50,10 @@ libpistache_shared = shared_library(
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)
if get_option('default_library') == 'static'
meson.override_dependency('pistache', pistache_static_dep)
else
meson.override_dependency('pistache', pistache_shared_dep)
if meson.version().version_compare('>=0.54.0')
if get_option('default_library') == 'static'
meson.override_dependency('pistache', pistache_static_dep)
else
meson.override_dependency('pistache', pistache_shared_dep)
endif
endif
......@@ -7,7 +7,7 @@ cppcheck = find_program('cppcheck', required: false)
if cppcheck.found()
cppcheck_args = ['--enable=all','-DCPPCHECK','--suppress=*:third-party*','--suppress=*:tests*','--suppress=noExplicitConstructor:include/pistache/optional.h']
else
warning('can\'t find Cppcheck')
warning('Can\'t find Cppcheck')
endif
# 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