Can specify headers to install with Files.

pull/1068/head
Jussi Pakkanen 8 years ago
parent aa9668a2fc
commit 8f41154827
  1. 5
      mesonbuild/backend/ninjabackend.py
  2. 10
      mesonbuild/interpreter.py
  3. 1
      test cases/common/9 header install/installed_files.txt
  4. 5
      test cases/common/9 header install/meson.build
  5. 3
      test cases/common/9 header install/sub/fileheader.h
  6. 2
      test cases/common/9 header install/sub/meson.build

@ -656,12 +656,15 @@ int dummy;
incroot = self.environment.get_includedir()
headers = self.build.get_headers()
srcdir = self.environment.get_source_dir()
builddir = self.environment.get_build_dir()
for h in headers:
outdir = h.get_custom_install_dir()
if outdir is None:
outdir = os.path.join(incroot, h.get_install_subdir())
for f in h.get_sources():
abspath = os.path.join(self.environment.get_source_dir(), h.get_source_subdir(), f)
assert(isinstance(f, File))
abspath = f.absolute_path(srcdir, builddir)
i = [abspath, outdir]
d.headers.append(i)

@ -457,10 +457,9 @@ class IncludeDirsHolder(InterpreterObject):
class Headers(InterpreterObject):
def __init__(self, src_subdir, sources, kwargs):
def __init__(self, sources, kwargs):
InterpreterObject.__init__(self)
self.sources = sources
self.source_subdir = src_subdir
self.install_subdir = kwargs.get('subdir', '')
self.custom_install_dir = kwargs.get('install_dir', None)
if self.custom_install_dir is not None:
@ -473,9 +472,6 @@ class Headers(InterpreterObject):
def get_install_subdir(self):
return self.install_subdir
def get_source_subdir(self):
return self.source_subdir
def get_sources(self):
return self.sources
@ -2155,9 +2151,9 @@ requirements use the version keyword argument instead.''')
self.build.benchmarks.append(t)
mlog.debug('Adding benchmark "', mlog.bold(args[0]), '".', sep='')
@stringArgs
def func_install_headers(self, node, args, kwargs):
h = Headers(self.subdir, args, kwargs)
source_files = self.source_strings_to_files(args)
h = Headers(source_files, kwargs)
self.build.headers.append(h)
return h

@ -1,3 +1,4 @@
usr/include/rootdir.h
usr/include/subdir/subdir.h
usr/include/vanished.h
usr/include/fileheader.h

@ -2,7 +2,10 @@ project('header install', 'c')
as_array = ['subdir.h']
subdir('vanishing_subdir')
subdir('sub')
h1 = install_headers('rootdir.h')
h2 = install_headers(as_array, subdir : 'subdir')
h3 = install_headers(subheader)
subdir('vanishing_subdir')

@ -0,0 +1,3 @@
#pragma once
#define LIFE "Is life! Na naa, naa-na na."

@ -0,0 +1,2 @@
subheader = files('fileheader.h')
Loading…
Cancel
Save