Commit e9639c2d authored by Niklas Haas's avatar Niklas Haas

meson: allow disabling components

Test framework is disabled by default, everything else is auto-probed.
parent 3efd9a2f
......@@ -105,6 +105,24 @@ If you wish to install the build products to the configured prefix (typically
advised except for developers who know what they're doing. Regular users
should rely on distro packages.
If you want to disable optional components, for example Vulkan support, you
can do so by passing `-Ddisable-$name=true` as part of the `meson build` step.
You can also reconfigure the build directory in-place, e.g.:
```bash
$ meson configure build -Ddisable-vulkan=true -Ddisable-shaderc=true
```
## Testing
To enable building and executing the tests, you need to build with
`enable-tests`, i.e.:
```bash
$ meson build -Denable-tests=true && cd build
$ ninja test
```
## Using
Building a trivial project using libplacebo is straightforward:
......
# Optional components
option('disable-vulkan', type: 'boolean', value: false,
description: 'Disable the vulkan-based renderer')
option('disable-shaderc', type: 'boolean', value: false,
description: 'Disable the libshaderc SPIR-V compiler')
# Miscellaneous
option('enable-tests', type: 'boolean', value: false,
description: 'Enable building the test cases')
......@@ -88,8 +88,10 @@ defs = ''
foreach c : components
name = c[0].underscorify().to_upper()
dep = c[1]
defs += '#define PL_HAVE_@0@ @1@\n'.format(name, dep.found() ? 1 : 0)
if dep.found()
has_dep = dep.found() and not get_option('disable-' + c[0])
defs += '#define PL_HAVE_@0@ @1@\n'.format(name, has_dep ? 1 : 0)
if has_dep
bdeps += dep
if (c.length() > 2)
sources += c[2]
......@@ -130,7 +132,9 @@ pkg.generate(
tdeps = declare_dependency(link_with: lib)
foreach t : tests
e = executable(t, 'tests/' + t, dependencies: tdeps)
test(t, e)
endforeach
if get_option('enable-tests')
foreach t : tests
e = executable(t, 'tests/' + t, dependencies: tdeps)
test(t, e)
endforeach
endif
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