meson: add win32 build dependency

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-06-16 22:54:17 +02:00
parent f8bd620363
commit 4b896dda9c
4 changed files with 26 additions and 73 deletions

View File

@ -289,8 +289,6 @@ AC_SUBST(RUNUTF8)
dnl MinGW checks
LIBVIRT_WIN_CHECK_COMMON
LIBVIRT_WIN_CHECK_MINGW
LIBVIRT_WIN_CHECK_SYMBOLS
LIBVIRT_WIN_CHECK_WINDRES
@ -400,7 +398,6 @@ LIBVIRT_RESULT_YAJL
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Windows])
AC_MSG_NOTICE([])
LIBVIRT_WIN_RESULT_COMMON
LIBVIRT_WIN_RESULT_WINDRES
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Miscellaneous])

View File

@ -1,42 +0,0 @@
dnl The MinGW common checks
dnl
dnl Copyright (C) 2016 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
dnl
AC_DEFUN([LIBVIRT_WIN_CHECK_COMMON], [
WIN32_EXTRA_CFLAGS=
WIN32_EXTRA_LIBS=
case "$host" in
*-*-mingw* )
WIN32_EXTRA_LIBS="-lole32 -loleaut32"
# If the host is Windows, and shared libraries are disabled, we
# need to add -DLIBVIRT_STATIC to the CFLAGS for proper linking
if test "x$enable_shared" = "xno"; then
WIN32_EXTRA_CFLAGS="-DLIBVIRT_STATIC"
fi
;;
esac
AC_SUBST([WIN32_EXTRA_CFLAGS])
AC_SUBST([WIN32_EXTRA_LIBS])
])
AC_DEFUN([LIBVIRT_WIN_RESULT_COMMON], [
details="CFLAGS='$WIN32_EXTRA_CFLAGS' LIBS='$WIN32_EXTRA_LIBS'"
LIBVIRT_RESULT([MinGW], [$with_win], [$details])
])

View File

@ -1,28 +0,0 @@
dnl The MinGW check
dnl
dnl Copyright (C) 2016 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
dnl
AC_DEFUN([LIBVIRT_WIN_CHECK_MINGW], [
MINGW_EXTRA_LDFLAGS=
case "$host" in
*-*-mingw*)
MINGW_EXTRA_LDFLAGS="-no-undefined"
esac
AC_SUBST([MINGW_EXTRA_LDFLAGS])
])

View File

@ -1401,6 +1401,27 @@ if not get_option('virtualport').disabled()
endif
endif
if host_machine.system() == 'windows'
ole32_dep = cc.find_library('ole32')
oleaut32_dep = cc.find_library('oleaut32')
win32_dep = declare_dependency(
dependencies: [
ole32_dep,
oleaut32_dep,
],
)
if get_option('default_library') == 'static'
win32_flags = [ '-DLIBVIRT_STATIC' ]
else
win32_flags = []
endif
win32_link_flags = [ '-Wl,-no-undefined' ]
else
win32_dep = dependency('', required: false)
win32_flags = []
win32_link_flags = []
endif
# generic build dependencies checks
@ -1519,6 +1540,11 @@ libs_summary = {
}
summary(libs_summary, section: 'Libraries', bool_yn: true)
win_summary = {
'MinGW': host_machine.system() == 'windows',
}
summary(win_summary, section: 'Windows', bool_yn: true)
test_summary = {
'Coverage': coverage_flags.length() > 0,
}