# symbol maps
version_script = custom_target('babl.map',
- input : meson.source_root() / 'export-symbols',
+ input : export_symbols_file,
output: ['babl.map', 'babl.map.clang'],
command: [
- find_program(meson.source_root() / 'gen_babl_map.py'),
+ find_program(gen_babl_map_file),
'@INPUT@',
'@OUTPUT0@',
],
command: [ git_bin.path(), 'describe', '--always' ],
)
- if env_bin.found()
+ if env_bin.found() and not meson.is_subproject()
meson.add_dist_script(
[ 'ninja', 'babl/git-version.h', ],
)
subdir: join_paths(lib_name, 'babl')
)
+babl_deps = [math, thread, dl, lcms]
+babl_includes = [rootInclude, bablBaseInclude]
+
babl = library(
lib_name,
babl_sources,
- include_directories: [rootInclude, bablBaseInclude],
+ include_directories: babl_includes,
c_args: babl_c_args,
link_whole: babl_base,
link_args: babl_link_args,
- dependencies: [math, thread, dl, lcms],
+ dependencies: babl_deps,
link_depends: version_script,
version: so_version,
install: true,
)
+libbabl_dep = declare_dependency(
+ include_directories: babl_includes,
+ link_with: babl,
+ dependencies: babl_deps
+)
+
if build_gir
# identity filter, so GIR doesn't choke on the Babl type
# (since it has the same name as the Babl namespace)
)
if build_vapi
- gnome.generate_vapi(lib_name,
+ babl_vapi = gnome.generate_vapi(lib_name,
sources: babl_gir[0],
install: true,
)
--- /dev/null
+
+Including babl as a meson subproject in your project:
+
+You create a babl.wrap file inside a folder named 'subprojects'
+which contains a way to download the babl source.
+See https://mesonbuild.com/Wrap-dependency-system-manual.html.
+An example will be:
+```
+[wrap-git]
+url = https://gitlab.gnome.org/GNOME/babl
+revision = master
+depth = 1
+```
+
+Next, include in your meson.build file something like this:
+```
+babl = dependency('babl', fallback: ['babl', 'libbabl_dep'])
+```
+
+If babl is installed in your system, meson will use that one,
+otherwise it will download and build babl.
+
+
xml_insert = find_program(
- meson.source_root() / 'tools' / 'xml-insert.py',
+ xml_insert_file,
native: true
)
TOC = files('toc')
html_files = {
'index': [index_static_html, [
- ['AUTHORS', files(meson.source_root() / 'AUTHORS')],
- ['TODO', files(meson.source_root() / 'TODO')],
- ['NEWS', files(meson.source_root() / 'NEWS')],
+ ['AUTHORS', authors_file],
+ ['TODO', todo_file],
+ ['NEWS', news_file],
['TOC', TOC],
]],
'Reference': ['auto', [
configuration: conf
)
+################################################################################
+# Global variables
+
+xml_insert_file = files('tools' / 'xml-insert.py')
+authors_file = files('AUTHORS')
+news_file = files('NEWS')
+todo_file = files('TODO')
+export_symbols_file = files('export-symbols')
+gen_babl_map_file = files('gen_babl_map.py')
################################################################################
# Subdirs
# pkg-config file
-pkgconfig.generate(filebase: 'babl',
+pkgconfig.generate(babl,
+ filebase: 'babl',
name: 'babl',
description: 'Pixel encoding and color space conversion engine.',
version: meson.project_version(),
- libraries: [ babl ],
libraries_private: [
'-lm',
],