[libvirt PATCH 127/351] meson: introduce src directory

Pavel Hrdina posted 351 patches 5 years, 6 months ago
There is a newer version of this series
[libvirt PATCH 127/351] meson: introduce src directory
Posted by Pavel Hrdina 5 years, 6 months ago
WARN_FLAGS are not relevant for meson as all warning flags are set to
the whole project using add_project_arguments().

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 meson.build     |  2 ++
 src/Makefile.am | 19 +------------------
 src/meson.build | 19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 18 deletions(-)
 create mode 100644 src/meson.build

diff --git a/meson.build b/meson.build
index 48db9aa0d0a..457d752ffb5 100644
--- a/meson.build
+++ b/meson.build
@@ -2200,6 +2200,8 @@ subdir('scripts')
 
 subdir('include')
 
+subdir('src')
+
 
 # generate meson-config.h file
 configure_file(output: 'meson-config.h', configuration: conf)
diff --git a/src/Makefile.am b/src/Makefile.am
index 6cf23bb0bdf..7d0e7b2e96c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,28 +19,11 @@
 # No libraries with the exception of LIBXML should be listed
 # here. List them against the individual XXX_la_CFLAGS targets
 # that actually use them.
-AM_CPPFLAGS =	-I$(top_srcdir) \
-		-I../include \
-		-I$(top_srcdir)/include \
+AM_CPPFLAGS = \
 		-I$(srcdir)/util \
 		-I./util \
-		-DIN_LIBVIRT \
-		-Dabs_top_builddir="\"$(abs_top_builddir)\"" \
-		-Dabs_top_srcdir="\"$(abs_top_srcdir)\"" \
 		$(NULL)
 
-AM_CFLAGS =	$(LIBXML_CFLAGS) \
-		$(GLIB_CFLAGS) \
-		$(WARN_CFLAGS) \
-		$(WIN32_EXTRA_CFLAGS) \
-		$(COVERAGE_CFLAGS) \
-		$(NULL)
-AM_LDFLAGS =	$(DRIVER_MODULES_LDFLAGS) \
-		$(COVERAGE_LDFLAGS) \
-		$(RELRO_LDFLAGS) \
-		$(NO_INDIRECT_LDFLAGS) \
-		$(MINGW_EXTRA_LDFLAGS) \
-		$(NULL)
 AM_LDFLAGS_MOD = \
 	-module \
 	-avoid-version \
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 00000000000..0f5b83744fd
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,19 @@
+src_inc_dir = include_directories('.')
+
+src_dep = declare_dependency(
+  compile_args: [
+    '-DIN_LIBVIRT',
+    '-Dabs_top_builddir="@0@"'.format(meson.build_root()),
+    '-Dabs_top_srcdir="@0@"'.format(meson.source_root()),
+  ] + coverage_flags + win32_flags,
+  dependencies: [
+    glib_dep,
+    libxml_dep,
+  ],
+  include_directories: [
+    libvirt_inc,
+    src_inc_dir,
+    top_inc_dir,
+  ],
+  link_args: libvirt_relro + libvirt_no_indirect + coverage_flags + driver_modules_flags + win32_link_flags,
+)
-- 
2.26.2

Re: [libvirt PATCH 127/351] meson: introduce src directory
Posted by Peter Krempa 5 years, 6 months ago
On Thu, Jul 16, 2020 at 11:56:03 +0200, Pavel Hrdina wrote:
> WARN_FLAGS are not relevant for meson as all warning flags are set to
> the whole project using add_project_arguments().
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---



> diff --git a/src/meson.build b/src/meson.build
> new file mode 100644
> index 00000000000..0f5b83744fd
> --- /dev/null
> +++ b/src/meson.build
> @@ -0,0 +1,19 @@
> +src_inc_dir = include_directories('.')
> +
> +src_dep = declare_dependency(
> +  compile_args: [
> +    '-DIN_LIBVIRT',
> +    '-Dabs_top_builddir="@0@"'.format(meson.build_root()),
> +    '-Dabs_top_srcdir="@0@"'.format(meson.source_root()),
> +  ] + coverage_flags + win32_flags,
> +  dependencies: [
> +    glib_dep,
> +    libxml_dep,
> +  ],
> +  include_directories: [
> +    libvirt_inc,
> +    src_inc_dir,
> +    top_inc_dir,
> +  ],
> +  link_args: libvirt_relro + libvirt_no_indirect + coverage_flags + driver_modules_flags + win32_link_flags,

Could we do thes one per line?


> +)
> -- 
> 2.26.2
> 

Re: [libvirt PATCH 127/351] meson: introduce src directory
Posted by Pavel Hrdina 5 years, 6 months ago
On Wed, Jul 22, 2020 at 04:55:27PM +0200, Peter Krempa wrote:
> On Thu, Jul 16, 2020 at 11:56:03 +0200, Pavel Hrdina wrote:
> > WARN_FLAGS are not relevant for meson as all warning flags are set to
> > the whole project using add_project_arguments().
> > 
> > Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> > ---
> 
> 
> 
> > diff --git a/src/meson.build b/src/meson.build
> > new file mode 100644
> > index 00000000000..0f5b83744fd
> > --- /dev/null
> > +++ b/src/meson.build
> > @@ -0,0 +1,19 @@
> > +src_inc_dir = include_directories('.')
> > +
> > +src_dep = declare_dependency(
> > +  compile_args: [
> > +    '-DIN_LIBVIRT',
> > +    '-Dabs_top_builddir="@0@"'.format(meson.build_root()),
> > +    '-Dabs_top_srcdir="@0@"'.format(meson.source_root()),
> > +  ] + coverage_flags + win32_flags,
> > +  dependencies: [
> > +    glib_dep,
> > +    libxml_dep,
> > +  ],
> > +  include_directories: [
> > +    libvirt_inc,
> > +    src_inc_dir,
> > +    top_inc_dir,
> > +  ],
> > +  link_args: libvirt_relro + libvirt_no_indirect + coverage_flags + driver_modules_flags + win32_link_flags,
> 
> Could we do thes one per line?

Sure, originally I tried using:

    link_args: [
      libvirt_relro,
      libvirt_no_indirect,
      coverage_flags,
      driver_modules_flags,
      win32_link_flags,
    ],

but Meson complains here that the items has to be strings, which is sad,
I should probably report this. I guess it's only declare_dependency()
related as in other functions it's happy with this and will expand the
inner arrays.

I tried and this works so I'll go with it:

    link_args: (
      libvirt_relro
      + libvirt_no_indirect
      + coverage_flags
      + driver_modules_flags
      + win32_link_flags
    ),

Pavel