[pygobject/meson.msvc: 2/4] meson builds: Support Visual Studio as well
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/meson.msvc: 2/4] meson builds: Support Visual Studio as well
- Date: Mon, 1 Oct 2018 07:36:43 +0000 (UTC)
commit 976cacdf98bf122a8ca6034ba22aa8045d7a4bc6
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Sep 26 17:20:29 2018 +0800
meson builds: Support Visual Studio as well
Check for the Cairo headers and libraries on Visual Studio builds if the
pkg-config files could not be found, as we don't have direct control
over the build system for Cairo/Cairo-GObject for Visual Studio.
Also, don't add gcc/CLang-specific compiler flags for Visual Studio
builds, but just force-include msvc_recommended_pragmas.h, which is
shipped with GLib, which should make the compiler-time checks that we
really want to look out for.
meson.build | 126 +++++++++++++++++++++++++++++++++---------------------------
1 file changed, 69 insertions(+), 57 deletions(-)
---
diff --git a/meson.build b/meson.build
index bedfe6c3..5bf59680 100644
--- a/meson.build
+++ b/meson.build
@@ -37,9 +37,18 @@ ffi_dep = dependency('libffi', version : '>= 3.0',
with_pycairo = get_option('pycairo')
+cc = meson.get_compiler('c')
+
if with_pycairo
- cairo_dep = dependency('cairo')
- cairo_gobject_dep = dependency('cairo-gobject')
+ cairo_dep = dependency('cairo', required: cc.get_id() != 'msvc')
+ cairo_gobject_dep = dependency('cairo-gobject', required: cc.get_id() != 'msvc')
+
+ if cc.get_id() == 'msvc' and (not cairo_gobject_dep.found() or not cairo_dep.found())
+ if cc.has_header('cairo.h') and cc.has_header ('cairo-gobject.h')
+ cairo_dep = cc.find_library ('cairo')
+ cairo_gobject_dep = cc.find_library ('cairo-gobject')
+ endif
+ endif
if python.language_version().version_compare('>= 3.0')
pycairo_name = 'py3cairo'
@@ -55,65 +64,68 @@ if with_pycairo
)
endif
-cc = meson.get_compiler('c')
+main_c_args = []
+if cc.get_id() == 'msvc'
+ main_c_args += [ '-FImsvc_recommended_pragmas.h' ]
+else
+ main_c_args += [
+ '-Wall',
+ '-Warray-bounds',
+ '-Wcast-align',
+ '-Wdeclaration-after-statement',
+ '-Wduplicated-branches',
+ '-Wextra',
+ '-Wformat=2',
+ '-Wformat-nonliteral',
+ '-Wformat-security',
+ '-Wimplicit-function-declaration',
+ '-Winit-self',
+ '-Wjump-misses-init',
+ '-Wlogical-op',
+ '-Wmissing-declarations',
+ '-Wmissing-format-attribute',
+ '-Wmissing-include-dirs',
+ '-Wmissing-noreturn',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wnull-dereference',
+ '-Wold-style-definition',
+ '-Wpacked',
+ '-Wpointer-arith',
+ '-Wrestrict',
+ '-Wreturn-type',
+ '-Wshadow',
+ '-Wsign-compare',
+ '-Wstrict-aliasing',
+ '-Wstrict-prototypes',
+ '-Wundef',
+ '-Wunused-but-set-variable',
+ '-Wwrite-strings',
+ ]
-main_c_args = [
- '-Wall',
- '-Warray-bounds',
- '-Wcast-align',
- '-Wdeclaration-after-statement',
- '-Wduplicated-branches',
- '-Wextra',
- '-Wformat=2',
- '-Wformat-nonliteral',
- '-Wformat-security',
- '-Wimplicit-function-declaration',
- '-Winit-self',
- '-Wjump-misses-init',
- '-Wlogical-op',
- '-Wmissing-declarations',
- '-Wmissing-format-attribute',
- '-Wmissing-include-dirs',
- '-Wmissing-noreturn',
- '-Wmissing-prototypes',
- '-Wnested-externs',
- '-Wnull-dereference',
- '-Wold-style-definition',
- '-Wpacked',
- '-Wpointer-arith',
- '-Wrestrict',
- '-Wreturn-type',
- '-Wshadow',
- '-Wsign-compare',
- '-Wstrict-aliasing',
- '-Wstrict-prototypes',
- '-Wundef',
- '-Wunused-but-set-variable',
- '-Wwrite-strings',
-]
-
-main_c_args += [
- '-Wno-incompatible-pointer-types-discards-qualifiers',
- '-Wno-missing-field-initializers',
- '-Wno-unused-parameter',
- '-Wno-discarded-qualifiers',
- '-Wno-sign-conversion',
- '-Wno-cast-function-type',
- '-Wno-int-conversion',
-]
-
-main_c_args += [
- '-fno-strict-aliasing',
- '-fvisibility=hidden',
-]
-
-if not ['3.3', '3.4'].contains(python.language_version())
main_c_args += [
- '-Wswitch-default',
+ '-Wno-incompatible-pointer-types-discards-qualifiers',
+ '-Wno-missing-field-initializers',
+ '-Wno-unused-parameter',
+ '-Wno-discarded-qualifiers',
+ '-Wno-sign-conversion',
+ '-Wno-cast-function-type',
+ '-Wno-int-conversion',
+ ]
+
+ main_c_args += [
+ '-fno-strict-aliasing',
+ '-fvisibility=hidden',
]
-endif
-main_c_args = cc.get_supported_arguments(main_c_args)
+ if not ['3.3', '3.4'].contains(python.language_version())
+ main_c_args += [
+ '-Wswitch-default',
+ ]
+ endif
+
+ main_c_args = cc.get_supported_arguments(main_c_args)
+endif
pyext_c_args = ['-DPY_SSIZE_T_CLEAN']
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]