summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2021-08-11 16:05:08 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2021-08-11 16:45:30 +0800
commit6c91df54fb051a559bd5bbab6c0b1d262fea6cd5 (patch)
tree2f57e34eff710cc32ee3d409bcb4cfbba9781649
parent309f8809937109ae9d06a617eab741123348a6a1 (diff)
downloadlibgd-6c91df54fb051a559bd5bbab6c0b1d262fea6cd5.tar.gz
libgd: Add header to define GD_API
This is the macro that will be used to decorate the symbols in the various headers so that we can use compiler directives to export the symbols as we incorporate libgd items in our GNOME items, as necessary. This will enable items such as gedit to work properly as they expect libgd items to be exported as well during runtime.
-rw-r--r--Makefile.am2
-rw-r--r--libgd/gd-macros.h32
-rw-r--r--libgd/meson.build3
3 files changed, 35 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 5a07144..55c924a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,7 +24,7 @@ endif
libgd_la_LIBADD = $(LIBGD_LIBS) $(LIBM)
libgd_la_LDFLAGS = -avoid-version
-libgd_la_SOURCES = libgd/gd.h
+libgd_la_SOURCES = libgd/gd.h libgd/gd-macros.h
nodist_libgd_la_SOURCES =
catalog_sources = \
diff --git a/libgd/gd-macros.h b/libgd/gd-macros.h
new file mode 100644
index 0000000..a247438
--- /dev/null
+++ b/libgd/gd-macros.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Copyright (c) 2021 Chun-wei Fan
+ *
+ * This program 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 program 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 program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __GD_MACROS_H__
+#define __GD_MACROS_H__
+
+#ifndef GD_API
+# ifdef MSVC_EXPORT_DLL
+# define GD_API __declspec (dllexport)
+# else
+# define GD_API
+# endif
+#endif
+
+#endif /* __GD_MACROS_H__ */
diff --git a/libgd/meson.build b/libgd/meson.build
index 705e8fb..2c58cf4 100644
--- a/libgd/meson.build
+++ b/libgd/meson.build
@@ -2,6 +2,7 @@ gnome = import('gnome')
sources = [
'gd.h',
+ 'gd-macros.h',
'gd-types-catalog.c'
]
built_sources = []
@@ -124,7 +125,7 @@ if get_option('with-notification')
c_args += '-DLIBGD_NOTIFICATION=1'
endif
-if sources.length() == 2
+if sources.length() == 3
error('You must include a feature to be built!')
endif