]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: src: build libvirt_driver_hyperv.a static library
authorPavel Hrdina <phrdina@redhat.com>
Mon, 27 Jul 2020 06:24:55 +0000 (08:24 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:04 +0000 (09:27 +0200)
Drop automake like print from scripts/hyperv_wmi_generator.py as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
scripts/hyperv_wmi_generator.py
src/Makefile.am
src/hyperv/Makefile.inc.am [deleted file]
src/hyperv/meson.build [new file with mode: 0644]
src/meson.build

index 736eabd598c1ecdc5685f406ed2660907c17f6b1..ac03cf526f55efa952c29921eb1d20404be18c1a 100755 (executable)
@@ -372,12 +372,7 @@ class Property:
         return '    { "%s", "%s", %s },\n' % (self.name, self.type.lower(), str(self.is_array).lower())
 
 
-def open_and_print(filename):
-    if filename.startswith("./"):
-        print("  GEN      " + filename[2:])
-    else:
-        print("  GEN      " + filename)
-
+def open_file(filename):
     return open(filename, "wt")
 
 
@@ -438,9 +433,9 @@ def main():
     input_filename = os.path.join(sys.argv[1], "hyperv", "hyperv_wmi_generator.input")
     output_dirname = os.path.join(sys.argv[2], "hyperv")
 
-    classes_typedef = open_and_print(os.path.join(output_dirname, "hyperv_wmi_classes.generated.typedef"))
-    classes_header = open_and_print(os.path.join(output_dirname, "hyperv_wmi_classes.generated.h"))
-    classes_source = open_and_print(os.path.join(output_dirname, "hyperv_wmi_classes.generated.c"))
+    classes_typedef = open_file(os.path.join(output_dirname, "hyperv_wmi_classes.generated.typedef"))
+    classes_header = open_file(os.path.join(output_dirname, "hyperv_wmi_classes.generated.h"))
+    classes_source = open_file(os.path.join(output_dirname, "hyperv_wmi_classes.generated.c"))
 
     # parse input file
     number = 0
index 953c655d99955191726a1b08512613dfdee3d6b0..0e873f964f737325b8be761c9fb3c8566dd03a59 100644 (file)
@@ -79,7 +79,6 @@ include admin/Makefile.inc.am
 include test/Makefile.inc.am
 include hypervisor/Makefile.inc.am
 include esx/Makefile.inc.am
-include hyperv/Makefile.inc.am
 include vmx/Makefile.inc.am
 include vmware/Makefile.inc.am
 include vbox/Makefile.inc.am
diff --git a/src/hyperv/Makefile.inc.am b/src/hyperv/Makefile.inc.am
deleted file mode 100644 (file)
index a9e88b7..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# vim: filetype=automake
-
-HYPERV_DRIVER_SOURCES = \
-       hyperv/hyperv_private.h \
-       hyperv/hyperv_driver.c \
-       hyperv/hyperv_driver.h \
-       hyperv/hyperv_util.c \
-       hyperv/hyperv_util.h \
-       hyperv/hyperv_wmi.c \
-       hyperv/hyperv_wmi.h \
-       hyperv/hyperv_wmi_classes.c \
-       hyperv/hyperv_wmi_classes.h \
-       hyperv/openwsman.h \
-       $(NULL)
-
-HYPERV_DRIVER_GENERATED = \
-       hyperv/hyperv_wmi_classes.generated.c \
-       hyperv/hyperv_wmi_classes.generated.h \
-       hyperv/hyperv_wmi_classes.generated.typedef \
-       $(NULL)
-
-HYPERV_GENERATED_STAMP = .hyperv_wmi_generator.stamp
-
-DRIVER_SOURCE_FILES += $(addprefix $(srcdir)/,$(HYPERV_DRIVER_SOURCES))
-
-BUILT_SOURCES += $(HYPERV_DRIVER_GENERATED)
-
-$(HYPERV_DRIVER_GENERATED): $(HYPERV_GENERATED_STAMP)
-
-$(HYPERV_GENERATED_STAMP): $(srcdir)/hyperv/hyperv_wmi_generator.input \
-                            $(top_srcdir)/scripts/hyperv_wmi_generator.py
-       $(AM_V_GEN) $(RUNUTF8) $(PYTHON) \
-         $(top_srcdir)/scripts/hyperv_wmi_generator.py $(srcdir) $(builddir) \
-         && touch $@
-
-if WITH_HYPERV
-noinst_LTLIBRARIES += libvirt_driver_hyperv.la
-libvirt_la_BUILT_LIBADD += libvirt_driver_hyperv.la
-libvirt_driver_hyperv_la_CFLAGS = \
-       $(OPENWSMAN_CFLAGS) \
-       -I$(srcdir)/conf \
-       -I$(builddir)/hyperv \
-       $(AM_CFLAGS) \
-       $(NULL)
-libvirt_driver_hyperv_la_LDFLAGS = $(AM_LDFLAGS)
-libvirt_driver_hyperv_la_LIBADD = $(OPENWSMAN_LIBS)
-libvirt_driver_hyperv_la_SOURCES = $(HYPERV_DRIVER_SOURCES)
-endif WITH_HYPERV
diff --git a/src/hyperv/meson.build b/src/hyperv/meson.build
new file mode 100644 (file)
index 0000000..cd12269
--- /dev/null
@@ -0,0 +1,40 @@
+hyperv_sources = [
+  'hyperv_driver.c',
+  'hyperv_util.c',
+  'hyperv_wmi.c',
+  'hyperv_wmi_classes.c',
+]
+
+hyperv_gen_sources = custom_target(
+  'virthypervgen',
+  input: [
+    'hyperv_wmi_generator.input',
+  ],
+  output: [
+    'hyperv_wmi_classes.generated.c',
+    'hyperv_wmi_classes.generated.h',
+    'hyperv_wmi_classes.generated.typedef',
+  ],
+  command: [
+    meson_python_prog, python3_prog.path(), hyperv_wmi_generator_prog.path(),
+    meson.source_root() / 'src',
+    meson.build_root() / 'src',
+  ],
+)
+
+if conf.has('WITH_HYPERV')
+  hyperv_lib = static_library(
+    'virt_driver_hyperv',
+    [
+      hyperv_sources,
+      hyperv_gen_sources[1],
+    ],
+    dependencies: [
+      openwsman_dep,
+      src_dep,
+    ],
+    include_directories: [
+      conf_inc_dir,
+    ]
+  )
+endif
index eabda5483df45fbd37ebb8e43440afcf1912a8f4..e1b9f21af3e63148391a78f03b7efe42d54413fd 100644 (file)
@@ -97,4 +97,5 @@ subdir('vmx')
 subdir('admin')
 
 subdir('esx')
+subdir('hyperv')
 subdir('vmware')