@@ -301,7 +301,6 @@ endif
dummy := $(call unnest-vars,, \
authz-obj-y \
chardev-obj-y \
- qga-vss-dll-obj-y \
block-obj-y \
block-obj-m \
storage-daemon-obj-y \
@@ -91,11 +91,3 @@ common-obj-y += disas/
######################################################################
# Resource file for Windows executables
version-obj-$(CONFIG_WIN32) += $(BUILD_DIR)/version.o
-
-######################################################################
-# guest agent
-
-# FIXME: a few definitions from qapi/qapi-types.o and
-# qapi/qapi-visit.o are needed by libqemuutil.a. These should be
-# extracted into a QAPI schema module, or perhaps a separate schema.
-qga-vss-dll-obj-y = qga/
deleted file mode 100644
@@ -1 +0,0 @@
-qga-vss-dll-obj-$(CONFIG_QGA_VSS) += vss-win32/
@@ -44,3 +44,9 @@ qga = executable('qemu-ga', qga_ss.sources(),
link_args: config_host['LIBS_QGA'].split(),
dependencies: [qemuutil, libudev],
install: true)
+
+if targetos == 'windows'
+ if 'CONFIG_QGA_VSS' in config_host
+ subdir('vss-win32')
+ endif
+endif
deleted file mode 100644
@@ -1,23 +0,0 @@
-# rules to build qga-vss.dll
-
-qga-vss-dll-obj-y += requester.o provider.o install.o
-
-obj-qga-vss-dll-obj-y = $(addprefix $(obj)/, $(qga-vss-dll-obj-y))
-$(obj-qga-vss-dll-obj-y): QEMU_CXXFLAGS := $(filter-out -fstack-protector-all -fstack-protector-strong, $(QEMU_CXXFLAGS)) -Wno-unknown-pragmas -Wno-delete-non-virtual-dtor
-
-QGA_VSS_LDFLAGS = -shared -Wl,--add-stdcall-alias,--enable-stdcall-fixup -lglib-2.0 -lole32 -loleaut32 -lshlwapi -luuid -lintl -lws2_32 -static
-$(obj)/qga-vss.dll: $(obj-qga-vss-dll-obj-y) $(SRC_PATH)/$(obj)/qga-vss.def
- $(call quiet-command,$(CXX) -o $@ $(qga-vss-dll-obj-y) $(SRC_PATH)/qga/vss-win32/qga-vss.def $(CXXFLAGS) $(QGA_VSS_LDFLAGS),"LINK","$(TARGET_DIR)$@")
-
-
-# rules to build qga-provider.tlb
-# Currently, only native build is supported because building .tlb
-# (TypeLibrary) from .idl requires WindowsSDK and MIDL (and cl.exe in VC++).
-MIDL=$(WIN_SDK)/Bin/midl
-
-$(obj)/qga-vss.tlb: $(SRC_PATH)/$(obj)/qga-vss.idl
-ifeq ($(WIN_SDK),"")
- $(call quiet-command,cp $(dir $<)qga-vss.tlb $@,"COPY","$(TARGET_DIR)$@")
-else
- $(call quiet-command,$(MIDL) -tlb $@ -I $(WIN_SDK)/Include $<,"MIDL","$(TARGET_DIR)$@")
-endif
new file mode 100644
@@ -0,0 +1,33 @@
+if add_languages('cpp', required: false)
+ glib_static = dependency('glib-2.0', static: true)
+ link_args = cc.get_supported_link_arguments(['-fstack-protector-all', '-fstack-protector-strong',
+ '-Wl,--add-stdcall-alias', '-Wl,--enable-stdcall-fixup'])
+ shared_module('qga-vss', ['requester.cpp', 'provider.cpp', 'install.cpp'],
+ name_prefix: '',
+ cpp_args: ['-Wno-unknown-pragmas', '-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'],
+ link_args: link_args,
+ vs_module_defs: 'qga-vss.def',
+ dependencies: [glib_static, socket,
+ cc.find_library('ole32'),
+ cc.find_library('oleaut32'),
+ cc.find_library('shlwapi'),
+ cc.find_library('uuid'),
+ cc.find_library('intl')])
+endif
+
+# rules to build qga-vss.tlb
+# Currently, only native build is supported because building .tlb
+# (TypeLibrary) from .idl requires WindowsSDK and MIDL (and cl.exe in VC++).
+midl = find_program('midl', required: false)
+if midl.found()
+ gen_tlb = custom_target('gen-tlb',
+ input: 'qga-vss.idl',
+ output: 'qga-vss.tlb',
+ command: [midl, '-tlb', '-I' + config_host['WIN_SDK'],
+ '@INPUT@', '@OUTPUT@'])
+else
+ gen_tlb = custom_target('gen-tlb',
+ input: 'qga-vss.tlb',
+ output: 'qga-vss.tlb',
+ command: ['cp', '@INPUT@', '@OUTPUT@'])
+endif