[goocanvas/meson.msvc: 6/6] meson.build: Fix building on Visual Studio
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goocanvas/meson.msvc: 6/6] meson.build: Fix building on Visual Studio
- Date: Sat, 12 Jun 2021 07:57:16 +0000 (UTC)
commit d76419d1038ff897f19a464cb7b498f7e0f912ec
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Sat Jun 12 15:53:54 2021 +0800
meson.build: Fix building on Visual Studio
The Meson build files are almost ready to support building with Visual Studio,
so update them a bit to fix that:
* Don't mandate looking for -lm. Windows compilers ship math functions in its
CRT import library and/or inline in the CRT headers.
* Define some compiler flags that are useful for Visual Studio-style builds
* Define BUILDING_GOOCANVAS when building the goocanvas library, so that we
can export the symbols there using compiler directives
meson.build | 10 +++++++++-
src/meson.build | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index 83777f2..a727a16 100644
--- a/meson.build
+++ b/meson.build
@@ -58,7 +58,15 @@ cairo_dep = dependency('cairo', version: '>= 1.10.0')
glib_dep = dependency('glib-2.0', version: '>= 2.28.0')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.0.0')
-m_dep = cc.find_library('m')
+m_dep = cc.find_library('m', required: false)
+
+if cc.get_argument_syntax() == 'msvc'
+ add_project_arguments(cc.get_supported_arguments([
+ '-utf-8', # Use UTF-8 mode
+ '-FImsvc_recommended_pragmas.h',
+ '-D_USE_MATH_DEFINES',
+ ]), language: ['c'])
+endif
enable_introspection = dependency('gobject-introspection-1.0', version: '>= 0.6.7', required:
get_option('introspection')).found()
diff --git a/src/meson.build b/src/meson.build
index 061e75b..1c52689 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -84,7 +84,7 @@ libgoocanvas = shared_library(
sources: sources + enum_sources,
include_directories: top_inc,
dependencies: deps + private_deps,
- c_args: '-DG_LOG_DOMAIN="GooCanvas"',
+ c_args: [ '-DG_LOG_DOMAIN="GooCanvas"', '-DBUILDING_GOOCANVAS'],
install: true,
install_rpath: goocanvas_libdir,
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]