Commit fbf3dd93 authored by santouits's avatar santouits Committed by Øyvind "pippin" Kolås
Browse files

Another project can add babl as a subproject

parent 9d55eea5
Pipeline #260958 passed with stage
in 4 minutes and 19 seconds
# Meson
_build
......@@ -13,10 +13,10 @@ babl_c_args = [
# 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@',
],
......@@ -76,7 +76,7 @@ if git_bin.found() and run_command(
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', ],
)
......@@ -139,19 +139,28 @@ install_headers(babl_headers,
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)
......@@ -169,7 +178,7 @@ if build_gir
)
if build_vapi
gnome.generate_vapi(lib_name,
babl_vapi = gnome.generate_vapi(lib_name,
sources: babl_gir[0],
install: true,
)
......
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.
......@@ -6,7 +6,7 @@ scptarget = host + ':' + location + '/'
xml_insert = find_program(
meson.source_root() / 'tools' / 'xml-insert.py',
xml_insert_file,
native: true
)
......@@ -46,9 +46,9 @@ endif
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', [
......
......@@ -54,7 +54,7 @@ extensions = [
]
foreach ext : extensions
library(
shared_library(
ext[0],
ext[0] + '.c',
c_args: ext[1],
......
......@@ -415,6 +415,15 @@ configure_file(
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
......@@ -447,11 +456,11 @@ endif
# 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',
],
......
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