aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Gnome-module.md1
-rw-r--r--mesonbuild/compilers/c.py3
-rw-r--r--mesonbuild/compilers/cpp.py5
-rw-r--r--mesonbuild/modules/gnome.py43
-rw-r--r--mesonbuild/scripts/coverage.py1
-rwxr-xr-xrun_tests.py10
-rwxr-xr-xrun_unittests.py13
-rw-r--r--test cases/frameworks/7 gnome/gir/meson.build3
-rw-r--r--test cases/frameworks/7 gnome/resources-data/meson.build2
-rw-r--r--test cases/frameworks/7 gnome/resources/meson.build8
-rw-r--r--test cases/frameworks/7 gnome/schemas/meson.build5
11 files changed, 64 insertions, 30 deletions
diff --git a/docs/markdown/Gnome-module.md b/docs/markdown/Gnome-module.md
index 3476d34..038f1ea 100644
--- a/docs/markdown/Gnome-module.md
+++ b/docs/markdown/Gnome-module.md
@@ -153,6 +153,7 @@ Compiles and installs gtkdoc documentation into `prefix/share/gtk-doc/html`. Tak
* `html_assets`: a list of assets for the HTML pages
* `content_files`: a list of content files
* `mkdb_args`: a list of arguments to pass to `gtkdoc-mkdb`
+* `ignore_headers`: a list of header files to ignore
This creates a `$module-doc` target that can be ran to build docs and normally these are only built on install.
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 018c353..ec16134 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -777,6 +777,9 @@ class GnuCCompiler(GnuCompiler, CCompiler):
def get_std_shared_lib_link_args(self):
return ['-shared']
+ def get_pch_use_args(self, pch_dir, header):
+ return ['-fpch-preprocess', '-include', os.path.split(header)[-1]]
+
class IntelCCompiler(IntelCompiler, CCompiler):
def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None):
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index a933f0e..a9093b3 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os.path
+
from .. import coredata
from ..mesonlib import version_compare
@@ -126,6 +128,9 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
return options['cpp_winlibs'].value[:]
return []
+ def get_pch_use_args(self, pch_dir, header):
+ return ['-fpch-preprocess', '-include', os.path.split(header)[-1]]
+
class IntelCPPCompiler(IntelCompiler, CPPCompiler):
def __init__(self, exelist, version, icc_type, is_cross, exe_wrap):
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 6bf8b7f..dc6c25f 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -92,7 +92,7 @@ class GnomeModule(ExtensionModule):
gdbuswarning_printed = True
@permittedKwargs({'source_dir', 'c_name', 'dependencies', 'export', 'gresource_bundle', 'install_header',
- 'install', 'install_dir', 'extra_args'})
+ 'install', 'install_dir', 'extra_args', 'build_by_default'})
def compile_resources(self, state, args, kwargs):
self.__print_gresources_warning(state)
glib_version = self._get_native_glib_version(state)
@@ -210,6 +210,8 @@ class GnomeModule(ExtensionModule):
# The header doesn't actually care about the files yet it errors if missing
'depends': depends
}
+ if 'build_by_default' in kwargs:
+ h_kwargs['build_by_default'] = kwargs['build_by_default']
if install_header:
h_kwargs['install'] = install_header
h_kwargs['install_dir'] = kwargs.get('install_dir',
@@ -259,21 +261,28 @@ class GnomeModule(ExtensionModule):
if hasattr(dep, 'held_object'):
dep = dep.held_object
if isinstance(dep, mesonlib.File):
- if dep.fname == missing_basename:
- found = True
- dep_files.remove(missing)
- dep_files.append(dep)
- subdirs.append(dep.subdir)
- break
+ if dep.fname != missing_basename:
+ continue
+ found = True
+ dep_files.remove(missing)
+ dep_files.append(dep)
+ subdirs.append(dep.subdir)
+ break
elif isinstance(dep, build.CustomTarget):
- if dep.get_basename() == missing_basename:
+ fname = None
+ outputs = {(o, os.path.basename(o)) for o in dep.get_outputs()}
+ for o, baseo in outputs:
+ if baseo == missing_basename:
+ fname = o
+ break
+ if fname is not None:
found = True
dep_files.remove(missing)
dep_files.append(
mesonlib.File(
is_built=True,
subdir=dep.get_subdir(),
- fname=dep.get_basename()))
+ fname=fname))
depends.append(dep)
subdirs.append(dep.get_subdir())
break
@@ -367,7 +376,7 @@ class GnomeModule(ExtensionModule):
# Hack to avoid passing some compiler options in
if lib.startswith("-W"):
continue
- if gir_has_extra_lib_arg() and use_gir_args:
+ if gir_has_extra_lib_arg() and use_gir_args and lib.startswith("-l"):
lib = lib.replace('-l', '--extra-library=', 1)
ldflags.update([lib])
@@ -386,7 +395,7 @@ class GnomeModule(ExtensionModule):
@permittedKwargs({'sources', 'nsversion', 'namespace', 'symbol_prefix', 'identifier_prefix',
'export_packages', 'includes', 'dependencies', 'link_with', 'include_directories',
'install', 'install_dir_gir', 'install_dir_typelib', 'extra_args',
- 'packages'})
+ 'packages', 'build_by_default'})
def generate_gir(self, state, args, kwargs):
if len(args) != 1:
raise MesonException('Gir takes one argument')
@@ -585,6 +594,8 @@ class GnomeModule(ExtensionModule):
scankwargs['install'] = kwargs['install']
scankwargs['install_dir'] = kwargs.get('install_dir_gir',
os.path.join(state.environment.get_datadir(), 'gir-1.0'))
+ if 'build_by_default' in kwargs:
+ scankwargs['build_by_default'] = kwargs['build_by_default']
scan_target = GirTarget(girfile, state.subdir, scankwargs)
typelib_output = '%s-%s.typelib' % (ns, nsversion)
@@ -601,11 +612,13 @@ class GnomeModule(ExtensionModule):
typelib_kwargs['install'] = kwargs['install']
typelib_kwargs['install_dir'] = kwargs.get('install_dir_typelib',
os.path.join(state.environment.get_libdir(), 'girepository-1.0'))
+ if 'build_by_default' in kwargs:
+ typelib_kwargs['build_by_default'] = kwargs['build_by_default']
typelib_target = TypelibTarget(typelib_output, state.subdir, typelib_kwargs)
rv = [scan_target, typelib_target]
return ModuleReturnValue(rv, rv)
- @noKwargs
+ @permittedKwargs({'build_by_default'})
def compile_schemas(self, state, args, kwargs):
if args:
raise MesonException('Compile_schemas does not take positional arguments.')
@@ -685,7 +698,7 @@ class GnomeModule(ExtensionModule):
@permittedKwargs({'main_xml', 'main_sgml', 'src_dir', 'dependencies', 'install',
'install_dir', 'scan_args', 'scanobjs_args', 'gobject_typesfile',
'fixxref_args', 'html_args', 'html_assets', 'content_files',
- 'mkdb_args'})
+ 'mkdb_args', 'ignore_headers'})
def gtkdoc(self, state, args, kwargs):
if len(args) != 1:
raise MesonException('Gtkdoc must have one positional argument.')
@@ -809,7 +822,7 @@ class GnomeModule(ExtensionModule):
return []
- @permittedKwargs({'interface_prefix', 'namespace', 'object_manager'})
+ @permittedKwargs({'interface_prefix', 'namespace', 'object_manager', 'build_by_default'})
def gdbus_codegen(self, state, args, kwargs):
if len(args) != 2:
raise MesonException('Gdbus_codegen takes two arguments, name and xml file.')
@@ -835,6 +848,8 @@ class GnomeModule(ExtensionModule):
'output': outputs,
'command': cmd
}
+ if 'build_by_default' in kwargs:
+ custom_kwargs['build_by_default'] = kwargs['build_by_default']
ct = build.CustomTarget(target_name, state.subdir, custom_kwargs)
return ModuleReturnValue(ct, [ct])
diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py
index 441ec0c..d596622 100644
--- a/mesonbuild/scripts/coverage.py
+++ b/mesonbuild/scripts/coverage.py
@@ -58,6 +58,7 @@ def coverage(source_root, build_root, log_dir):
'-o', covinfo])
remove_dir_from_trace(lcov_exe, covinfo, '/usr/include/*')
remove_dir_from_trace(lcov_exe, covinfo, '/usr/local/include/*')
+ remove_dir_from_trace(lcov_exe, covinfo, '/usr/src/*')
subprocess.check_call([genhtml_exe,
'--prefix', build_root,
'--output-directory', htmloutdir,
diff --git a/run_tests.py b/run_tests.py
index b8c5062..efbdaaa 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -190,13 +190,6 @@ if __name__ == '__main__':
# Run tests
print(mlog.bold('Running unittests.').get_text(mlog.colorize_console))
print()
- units = ['InternalTests', 'AllPlatformTests', 'FailureTests']
- if mesonlib.is_linux():
- units += ['LinuxlikeTests']
- if should_run_linux_cross_tests():
- units += ['LinuxArmCrossCompileTests']
- elif mesonlib.is_windows():
- units += ['WindowsTests']
# Can't pass arguments to unit tests, so set the backend to use in the environment
env = os.environ.copy()
env['MESON_UNIT_TEST_BACKEND'] = backend.name
@@ -208,8 +201,7 @@ if __name__ == '__main__':
'coverage.process_startup()\n')
env['COVERAGE_PROCESS_START'] = '.coveragerc'
env['PYTHONPATH'] = os.pathsep.join([td] + env.get('PYTHONPATH', []))
-
- returncode += subprocess.call([sys.executable, 'run_unittests.py', '-v'] + units, env=env)
+ returncode += subprocess.call([sys.executable, 'run_unittests.py', '-v'], env=env)
# Ubuntu packages do not have a binary without -6 suffix.
if should_run_linux_cross_tests():
print(mlog.bold('Running cross compilation tests.').get_text(mlog.colorize_console))
diff --git a/run_unittests.py b/run_unittests.py
index 5782c1d..1f24847 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -30,7 +30,7 @@ import mesonbuild.mlog
import mesonbuild.compilers
import mesonbuild.environment
import mesonbuild.mesonlib
-from mesonbuild.mesonlib import is_windows, is_osx, is_cygwin, windows_proof_rmtree
+from mesonbuild.mesonlib import is_linux, is_windows, is_osx, is_cygwin, windows_proof_rmtree
from mesonbuild.environment import Environment
from mesonbuild.dependencies import DependencyException
from mesonbuild.dependencies import PkgConfigDependency, ExternalProgram
@@ -38,6 +38,7 @@ from mesonbuild.dependencies import PkgConfigDependency, ExternalProgram
from run_tests import exe_suffix, get_fake_options, FakeEnvironment
from run_tests import get_builddir_target_args, get_backend_commands, Backend
from run_tests import ensure_backend_detects_changes, run_configure_inprocess
+from run_tests import should_run_linux_cross_tests
def get_dynamic_section_entry(fname, entry):
@@ -1980,4 +1981,12 @@ def unset_envs():
if __name__ == '__main__':
unset_envs()
- unittest.main(buffer=True)
+ cases = ['InternalTests', 'AllPlatformTests', 'FailureTests']
+ if is_linux():
+ cases += ['LinuxlikeTests']
+ if should_run_linux_cross_tests():
+ cases += ['LinuxArmCrossCompileTests']
+ elif is_windows():
+ cases += ['WindowsTests']
+
+ unittest.main(defaultTest=cases, buffer=True)
diff --git a/test cases/frameworks/7 gnome/gir/meson.build b/test cases/frameworks/7 gnome/gir/meson.build
index 2758541..0b26754 100644
--- a/test cases/frameworks/7 gnome/gir/meson.build
+++ b/test cases/frameworks/7 gnome/gir/meson.build
@@ -28,7 +28,8 @@ gnome.generate_gir(
includes : ['GObject-2.0', 'MesonDep1-1.0'],
# dep1_dep pulls in dep2_dep for us
dependencies : [fake_dep, dep1_dep],
- install : true
+ install : true,
+ build_by_default : true,
)
test('gobject introspection/c', girexe)
diff --git a/test cases/frameworks/7 gnome/resources-data/meson.build b/test cases/frameworks/7 gnome/resources-data/meson.build
index 9458c2d..31a577b 100644
--- a/test cases/frameworks/7 gnome/resources-data/meson.build
+++ b/test cases/frameworks/7 gnome/resources-data/meson.build
@@ -10,7 +10,7 @@ print("This is a generated resource.")
# Generate file res3.txt from file res3.txt.in. This is then included
# in a GResource file, driven by resources/meson.build.
-res3_txt = custom_target('res3.txt',
+res3_txt = custom_target('res3',
input: 'res3.txt.in',
output: 'res3.txt',
command: [python3, '-c', fake_generator_script, '@INPUT@'],
diff --git a/test cases/frameworks/7 gnome/resources/meson.build b/test cases/frameworks/7 gnome/resources/meson.build
index fdf6f63..3ebb2f5 100644
--- a/test cases/frameworks/7 gnome/resources/meson.build
+++ b/test cases/frameworks/7 gnome/resources/meson.build
@@ -45,3 +45,11 @@ if glib.version() >= '2.52.0'
dependencies: gio)
test('generated resource test', generated_res_exe)
endif
+
+# Test build_by_default
+gnome.compile_resources('build-resources',
+ 'simple.gresource.xml',
+ gresource_bundle : true,
+ build_by_default : true,
+ source_dir : '../resources-data',
+)
diff --git a/test cases/frameworks/7 gnome/schemas/meson.build b/test cases/frameworks/7 gnome/schemas/meson.build
index 1947604..9544a57 100644
--- a/test cases/frameworks/7 gnome/schemas/meson.build
+++ b/test cases/frameworks/7 gnome/schemas/meson.build
@@ -1,8 +1,7 @@
-compiled = gnome.compile_schemas()
+compiled = gnome.compile_schemas(build_by_default: true)
install_data('com.github.meson.gschema.xml',
install_dir : 'share/glib-2.0/schemas')
-schemaexe = executable('schemaprog', 'schemaprog.c', compiled,
-dependencies : gio)
+schemaexe = executable('schemaprog', 'schemaprog.c', dependencies : gio)
test('schema test', schemaexe)