[gtksourceview/meson.msvc: 3/8] MSVC builds: Move our math.h to win32/



commit 523525084ad9e787257c8f39cc89e6439f34eeca
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Apr 24 13:45:28 2019 +0800

    MSVC builds: Move our math.h to win32/
    
    Move our math.h with the fallback round() implementation to win32/, and
    ensure that it is included for pre-2013 Visual Studio Meson builds.

 gtksourceview/meson.build | 11 ++++++++++-
 win32/Makefile.am         |  1 +
 win32/{vs9 => }/math.h    |  0
 win32/vs10/Makefile.am    |  6 +-----
 win32/vs11/Makefile.am    |  6 +-----
 win32/vs9/Makefile.am     |  3 +--
 6 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/gtksourceview/meson.build b/gtksourceview/meson.build
index 5d0d6ce1..be74f737 100644
--- a/gtksourceview/meson.build
+++ b/gtksourceview/meson.build
@@ -120,6 +120,15 @@ if config_h.has('OS_OSX')
   ]
 endif
 
+extra_include_dirs = []
+if cc.get_id() == 'msvc'
+  # include our math.h to implement round() for pre-2013 Visual Studio
+  msvc_maj_ver = cc.version().split('.')[0].to_int()
+  if msvc_maj_ver < 18
+    extra_include_dirs = include_directories('../win32')
+  endif
+endif
+
 core_enums_header = '''
 #if !defined (GTK_SOURCE_H_INSIDE) && !defined (GTK_SOURCE_COMPILATION)
 # error "Only <gtksourceview/gtksource.h> can be included directly."
@@ -163,7 +172,7 @@ install_headers(
 )
 
 core_lib = static_library(package_string + 'core', core_sources,
-  include_directories: rootdir,
+  include_directories: [rootdir, extra_include_dirs],
          dependencies: core_deps,
                c_args: core_c_args,
               install: false
diff --git a/win32/Makefile.am b/win32/Makefile.am
index 28b4e445..bee57dfa 100644
--- a/win32/Makefile.am
+++ b/win32/Makefile.am
@@ -33,6 +33,7 @@ EXTRA_DIST = \
        gen-enums.batin \
        pc_base.py      \
        gtksourceviewpc.py      \
+       math.h  \
        $(GENERATED_ITEMS)
 
 gen-enums.bat: $(top_srcdir)/win32/gen-enums.batin enum.headers
diff --git a/win32/vs9/math.h b/win32/math.h
similarity index 100%
rename from win32/vs9/math.h
rename to win32/math.h
diff --git a/win32/vs10/Makefile.am b/win32/vs10/Makefile.am
index 88b6e6d9..a77f64b9 100644
--- a/win32/vs10/Makefile.am
+++ b/win32/vs10/Makefile.am
@@ -1,8 +1,7 @@
 GENERATED_ITEMS =                                      \
        gtksourceview-@GSV_API_VERSION@.vcxproj         \
        gtksourceview-@GSV_API_VERSION@.vcxproj.filters \
-       gtksourceview@GSV_API_VERSION@-install.props    \
-       math.h
+       gtksourceview@GSV_API_VERSION@-install.props
 
 MSVC10_HEADERS_LISTS = \
        gtksourceview-@GSV_API_VERSION@.vs10.headers
@@ -27,9 +26,6 @@ gtksourceview@GSV_API_VERSION@-install.props: $(top_srcdir)/win32/vs10/gtksource
        $(CPP) -P - <$(top_srcdir)/win32/vs10/gtksourceview@GSV_API_VERSION@-install.propsin >$@
        $(RM) $(MSVC10_HEADERS_LISTS)
 
-math.h: $(top_srcdir)/win32/vs9/math.h
-       cp $< $@
-
 DISTCLEANFILES = $(GENERATED_ITEMS)
 
 -include $(top_srcdir)/git.mk
diff --git a/win32/vs11/Makefile.am b/win32/vs11/Makefile.am
index 7a3599bd..5a4dd69e 100644
--- a/win32/vs11/Makefile.am
+++ b/win32/vs11/Makefile.am
@@ -7,11 +7,7 @@ EXTRA_DIST =                                                   \
        gtksourceview-@GSV_API_VERSION@.vcxproj                 \
        gtksourceview-@GSV_API_VERSION@.vcxproj.filters         \
        gtksourceview@GSV_API_VERSION@-install.vcxproj          \
-       gtksourceview@GSV_API_VERSION@-install.vcxproj.filters  \
-       math.h
-
-math.h: $(top_srcdir)/win32/vs9/math.h
-       cp $< $@
+       gtksourceview@GSV_API_VERSION@-install.vcxproj.filters
 
 DISTCLEANFILES = $(EXTRA_DIST)
 
diff --git a/win32/vs9/Makefile.am b/win32/vs9/Makefile.am
index d0d44094..ffe05aec 100644
--- a/win32/vs9/Makefile.am
+++ b/win32/vs9/Makefile.am
@@ -13,8 +13,7 @@ EXTRA_DIST =                                                  \
        gtksourceview@GSV_API_VERSION@-version-paths.vsprops    \
        gtksourceview-@GSV_API_VERSION@.vcprojin                \
        gtksourceview@GSV_API_VERSION@-install.vcproj           \
-       $(GENERATED_ITEMS)                                      \
-       math.h
+       $(GENERATED_ITEMS)
 
 gtksourceview@GSV_API_VERSION@-install.vsprops: 
$(top_srcdir)/win32/vs9/gtksourceview@GSV_API_VERSION@-install.vspropsin $(MSVC_HEADERS_LISTS)
        $(CPP) -P - <$(top_srcdir)/win32/vs9/gtksourceview@GSV_API_VERSION@-install.vspropsin >$@


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]