diff options
author | Christian Hergert <christian@hergert.me> | 2022-06-24 18:36:14 +0000 |
---|---|---|
committer | Christian Hergert <christian@hergert.me> | 2022-06-24 18:36:14 +0000 |
commit | d560e56f8ee969b61d04340e7b08715bced7f98e (patch) | |
tree | 679765e71122b17acf3e79236f085579687cfa90 | |
parent | ae834d82b0f37b04257c74e60317f8021fe5983b (diff) | |
parent | 4856166c21e96c7118de1055feb51f20bd7a6f40 (diff) | |
download | gtksourceview-d560e56f8ee969b61d04340e7b08715bced7f98e.tar.gz |
Merge branch 'msvc-meson-cleanups' into 'master'
Cleanups and fixes for Visual Studio builds
See merge request GNOME/gtksourceview!269
-rw-r--r-- | gtksourceview/meson.build | 13 | ||||
-rw-r--r-- | msvc/math.h | 58 | ||||
-rw-r--r-- | tests/meson.build | 3 | ||||
-rw-r--r-- | testsuite/test-snippets.c | 4 |
4 files changed, 5 insertions, 73 deletions
diff --git a/gtksourceview/meson.build b/gtksourceview/meson.build index 772e923e..ca204a7f 100644 --- a/gtksourceview/meson.build +++ b/gtksourceview/meson.build @@ -169,15 +169,6 @@ if config_h.has('OS_OSX') ] endif -if cc.get_id() == 'msvc' and cc.version().version_compare('<18') - # include our math.h to implement round() for pre-2013 Visual Studio - gtksourceview_extra_include_dirs = include_directories('../msvc') -else - gtksourceview_extra_include_dirs = [] -endif - -gtksourceview_include_dirs = [rootdir, gtksourceview_extra_include_dirs] - core_enums_header = ''' #if defined (GTK_SOURCE_COMPILATION) @@ -236,7 +227,7 @@ install_headers( core_enums_h = core_enums.get(1) core_lib = static_library(package_string + 'core', core_sources, - include_directories: gtksourceview_include_dirs, + include_directories: rootdir, dependencies: core_deps, c_args: core_c_args + deprecated_c_args, install: false @@ -263,7 +254,7 @@ subdir('completion-providers') gtksource_lib = library(package_string, version: lib_version, darwin_versions: lib_osx_version, - include_directories: gtksourceview_include_dirs, + include_directories: rootdir, dependencies: gtksource_deps, link_whole: gtksource_libs, c_args: core_c_args + deprecated_c_args, diff --git a/msvc/math.h b/msvc/math.h deleted file mode 100644 index 8acdd38f..00000000 --- a/msvc/math.h +++ /dev/null @@ -1,58 +0,0 @@ -/* GdkPixbuf library - Compatibility Math Header for - * pre-Visual Studio 2013 Headers - * to Build GDK-Pixbuf - * - * Copyright (C) 2014 Chun-wei Fan - * - * Authors: Chun-wei Fan <fanc999@yahoo.com.tw> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _MSC_VER -#error "This Header is intended for Visual Studio Builds only" -#endif - -/* Include the stock Visual Studio math.h first */ -#include <../include/math.h> - -/* Visual Studio 2013 and later do not need this compatibility item */ -#if (_MSC_VER < 1800) - -#ifndef __MSVC_MATH_COMPAT_H__ -#define __MSVC_MATH_COMPAT_H__ - -/* Note: This is a rather generic fallback implementation for round(), which is - * okay for the purposes for GTK, but please note the following if intending - * use this implementation: - * - * -The largest floating point value strictly less than 0.5. The problem is - * that the addition produces 1 due to rounding. - * - * -A set of large integers near 2^52 for which adding 0.5 is the same as - * adding 1, again due to rounding. - */ - -static __inline double -round (double x) -{ - if (x >= 0) - return floor (x + 0.5); - else - return ceil (x - 0.5); -} - -#endif /* __MSVC_MATH_COMPAT_H__ */ - -#endif /* _MSC_VER < 1800 */ diff --git a/tests/meson.build b/tests/meson.build index 3f0a0862..6487da0d 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -21,9 +21,6 @@ tests_resources = { } tests_deps = [gtksource_dep] -if cc.get_id() == 'msvc' - tests_deps += [core_dep] -endif foreach test_name, test_sources: tests_sources if tests_resources.has_key(test_name) diff --git a/testsuite/test-snippets.c b/testsuite/test-snippets.c index 36112622..f30d3ca7 100644 --- a/testsuite/test-snippets.c +++ b/testsuite/test-snippets.c @@ -71,11 +71,13 @@ test_snippet_fetching (void) /* Test language id for snippets */ for (guint i = 0; i < n_items; i++) { - g_autoptr(GtkSourceSnippet) snippet = g_list_model_get_item (model, i); + GtkSourceSnippet *snippet = g_list_model_get_item (model, i); const char *language_id = gtk_source_snippet_get_language_id (snippet); g_assert_nonnull (language_id); g_assert_cmpstr (language_id, !=, ""); + + g_object_unref (snippet); } g_assert_finalize_object (mgr); |