Commit e9548c4c authored by Niklas Haas's avatar Niklas Haas

meson.build: improve the #define templating

Slightly more hacky but requires less boilerplate.
parent 81fa451b
......@@ -34,6 +34,6 @@
// Feature tests. These aren't described in further detail, but may be useful
// for programmers wanting to programmatically check for feature support
// in their compiled libshaderc versions.
#mesondefine PL_HAVE_SHADERC
@extra_defs@
#endif // LIBPLACEBO_CONTEXT_H_
......@@ -16,19 +16,6 @@ add_global_arguments([
cc = meson.get_compiler('c')
# Configuration
conf = configuration_data()
conf.set('majorver', majorver)
conf.set('apiver', apiver)
conf.set('fixver', fixver)
gitdesc = run_command('git', 'describe')
if gitdesc.returncode() == 0
conf.set_quoted('version', gitdesc.stdout().strip())
else
conf.set_quoted('version', 'v' + version)
endif
# Source files
headers = [
'public/colorspace.h',
......@@ -64,21 +51,35 @@ components = [
],
]
# Configuration
conf = configuration_data()
conf.set('majorver', majorver)
conf.set('apiver', apiver)
conf.set('fixver', fixver)
gitdesc = run_command('git', 'describe')
if gitdesc.returncode() == 0
conf.set_quoted('version', gitdesc.stdout().strip())
else
conf.set_quoted('version', 'v' + version)
endif
# Build process
bdeps = [ cc.find_library('m', required: false) ]
defs = ''
foreach c : components
name = c[0]
name = c[0].underscorify().to_upper()
dep = c[1]
srcs = c[2]
conf.set10('PL_HAVE_' + name.underscorify().to_upper(), dep.found())
defs += '#define PL_HAVE_@0@ @1@\n'.format(name, dep.found() ? 1 : 0)
if dep.found()
bdeps += dep
sources += srcs
sources += c[2]
endif
endforeach
conf.set('extra_defs', defs)
configure_file(
input: 'config.h.in',
output: 'config.h',
......
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