Commit 4383ee86 authored by John Marshall's avatar John Marshall Committed by John Marshall
Browse files

build: subproject improvements:

 - don't expose source in dependency to avoid name clashes
 - add babl path variables to dependency object
 - add babl path variables to uninstalled pc
parent f01acc74
Pipeline #278083 failed with stage
in 21 minutes and 9 seconds
# Copy the public headers here for subproject builds.
foreach _hdr : babl_headers
configure_file(
input: _hdr,
output: '@PLAINNAME@',
copy: true,
)
endforeach
......@@ -54,43 +54,14 @@ if platform_win32
babl_link_args += no_undefined
endif
# sources
babl_version_h = configure_file(
input: 'babl-version.h.in',
output: 'babl-version.h',
configuration: conf,
)
# If git is available, always check if git-version.h should be
# updated. If git is not available, don't do anything if git-version.h
# already exists because then we are probably working with a tarball
# in which case the git-version.h we ship is correct.
if git_bin.found() and run_command(
git_bin,
'rev-parse',
'--is-inside-work-tree',
).returncode() == 0
git_version_h = vcs_tag(
input : 'git-version.h.in',
output: 'git-version.h',
replace_string: '@BABL_GIT_VERSION@',
command: [ git_bin.path(), 'describe', '--always' ],
)
if env_bin.found() and not meson.is_subproject()
meson.add_dist_script(
[ 'ninja', 'babl/git-version.h', ],
)
meson.add_dist_script(
[ 'sh', '-c', ' '.join(
[ 'cp', git_version_h.full_path(), '${MESON_DIST_ROOT}/babl' ]
)]
)
endif
else
git_version_h = files('git-version.h')
endif
babl_sources = [
babl_sources = files(
'babl-cache.c',
'babl-component.c',
'babl-conversion.c',
......@@ -123,25 +94,34 @@ babl_sources = [
'babl-util.c',
'babl-version.c',
'babl.c',
) + [
babl_version_h,
git_version_h,
]
babl_headers = [
babl_headers = files(
'babl-introspect.h',
'babl-macros.h',
'babl-types.h',
'babl.h',
) + [
babl_version_h,
]
install_headers(babl_headers,
subdir: join_paths(lib_name, 'babl')
subdir: lib_name / 'babl'
)
# copy external headers to babl subdirectory for subproject builds as
# we don't want to expose the project root folder due to potential
# name clashes.
if meson.is_subproject()
subdir('babl')
endif
babl_deps = [math, thread, dl, lcms]
babl_includes = [rootInclude, bablBaseInclude]
# build library
babl = library(
lib_name,
babl_sources,
......@@ -155,12 +135,6 @@ babl = library(
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)
......
#ifndef __GIT_VERSION_H__
#define __GIT_VERSION_H__
#ifndef __BABL_GIT_VERSION_H__
#define __BABL_GIT_VERSION_H__
#define BABL_GIT_VERSION "@BABL_GIT_VERSION@"
#endif /* __GIT_VERSION_H__ */
#endif /* __BABL_GIT_VERSION_H__ */
......@@ -30,6 +30,9 @@ buildtype = get_option('buildtype')
babl_prefix = get_option('prefix')
babl_libdir = join_paths(babl_prefix, get_option('libdir'))
project_build_root = meson.current_build_dir()
project_source_root = meson.current_source_dir()
################################################################################
# Projects infos
......@@ -409,12 +412,46 @@ endif
################################################################################
# Configuration files
# This should not be made visible in babl_dep due to possible name clash
# when built as a sub-project.
rootInclude = include_directories('.')
# config.h
configure_file(
output: 'config.h',
configuration: conf
)
# If git is available, always check if git-version.h should be
# updated. If git is not available, don't do anything if git-version.h
# already exists because then we are probably working with a tarball
# in which case the git-version.h we ship is correct.
if git_bin.found() and run_command(
git_bin,
'rev-parse',
'--is-inside-work-tree',
).returncode() == 0
git_version_h = vcs_tag(
input : 'git-version.h.in',
output: 'git-version.h',
replace_string: '@BABL_GIT_VERSION@',
command: [ git_bin.path(), 'describe', '--always' ],
)
if not meson.is_subproject()
meson.add_dist_script(
[ 'ninja', 'git-version.h', ],
)
meson.add_dist_script(
[ 'sh', '-c', ' '.join(
[ 'cp', git_version_h.full_path(), '${MESON_DIST_ROOT}' ]
)]
)
endif
else
git_version_h = files('git-version.h')
endif
################################################################################
# Global variables
......@@ -428,8 +465,6 @@ gen_babl_map_file = files('gen_babl_map.py')
################################################################################
# Subdirs
rootInclude = include_directories('.')
subdir('babl')
subdir('extensions')
subdir('tests')
......@@ -456,17 +491,31 @@ endif
# pkg-config file
pkgconfig.generate(babl,
pkgconfig.generate(
babl,
filebase: 'babl',
name: 'babl',
description: 'Pixel encoding and color space conversion engine.',
version: meson.project_version(),
libraries_private: [
'-lm',
subdirs: lib_name,
uninstalled_variables: [
'babl_path=@0@'.format(babl_extensions_build_dir),
'babl_libdir=@0@'.format(babl_library_build_dir),
],
subdirs: [
lib_name,
)
# dependency for wrap builds
babl_dep = declare_dependency(
include_directories: bablInclude,
link_with : babl,
sources: [
babl_version_h,
is_variable('babl_gir') ? babl_gir : []
],
variables: {
'babl_path' : babl_extensions_build_dir,
'babl_libdir' : babl_library_build_dir,
},
)
################################################################################
......
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