summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-12-14 11:21:29 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-12-16 12:51:58 +0100
commit9c339f8b0d73c3475edeab37c52dbf991f67b7fa (patch)
tree0b87aeb20b2b8f17076d90510b68f1d02410891a
parentc0dd66c3f6cf25404124b5a4d2e49f5cdc9b7110 (diff)
downloadgobject-introspection-9c339f8b0d73c3475edeab37c52dbf991f67b7fa.tar.gz
girepository: Add version macros and functions. Fixes #200
This adds the following macros and functions: GI_MAJOR_VERSION, GI_MICRO_VERSION, GI_MINOR_VERSION, GI_CHECK_VERSION, gi_get_major_version,gi_get_micro_version, gi_get_minor_version. Since we share a prefix with glib we have to namespace these by using the gi_ prefix. g_gi would also work but we already export symbols with gi_ like gi_cclosure_marshal_generic(), gi_type_tag_get_ffi_type() and gi_type_info_extract_ffi_return_value(), so let's not add another naming scheme.
-rw-r--r--.gitignore1
-rw-r--r--Makefile-examples.am2
-rw-r--r--Makefile-gir.am6
-rw-r--r--Makefile-girepository.am13
-rw-r--r--Makefile-giscanner.am2
-rw-r--r--Makefile-tools.am6
-rw-r--r--configure.ac8
-rw-r--r--docs/reference/gi-docs.xml5
-rw-r--r--docs/reference/gi-sections.txt12
-rw-r--r--gir/meson.build2
-rw-r--r--girepository/girepository.h1
-rw-r--r--girepository/giversion.c114
-rw-r--r--girepository/giversion.h.in47
-rw-r--r--girepository/giversionmacros.h6
-rw-r--r--girepository/meson.build12
-rw-r--r--meson.build5
-rw-r--r--tests/offsets/Makefile.am2
-rw-r--r--tests/repository/Makefile.am8
-rw-r--r--tests/scanner/Makefile.am2
19 files changed, 237 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index c0b05fd0..8cf1b685 100644
--- a/.gitignore
+++ b/.gitignore
@@ -135,6 +135,7 @@ docs/reference/version.xml
docs/giscanner/_build/*
giscanner/_version.py
+girepository/giversion.h
#g-ir-doc-tool tests
*.page
diff --git a/Makefile-examples.am b/Makefile-examples.am
index cc882a86..9404e2bb 100644
--- a/Makefile-examples.am
+++ b/Makefile-examples.am
@@ -1,7 +1,7 @@
noinst_PROGRAMS += glib-print
glib_print_SOURCES = examples/glib-print.c
-glib_print_CFLAGS = $(GOBJECT_CFLAGS) $(WARN_CFLAGS) -I$(top_srcdir)/girepository
+glib_print_CFLAGS = $(GOBJECT_CFLAGS) $(WARN_CFLAGS) -I$(top_srcdir)/girepository -I$(top_builddir)/girepository
glib_print_LDFLAGS = $(WARN_LDFLAGS)
glib_print_LDADD = libgirepository-1.0.la $(GOBJECT_LIBS)
diff --git a/Makefile-gir.am b/Makefile-gir.am
index 3753d1a2..c7eb3779 100644
--- a/Makefile-gir.am
+++ b/Makefile-gir.am
@@ -201,19 +201,23 @@ GIRepository_2_0_gir_SCANNERFLAGS = \
$(WARN_SCANNERFLAGS) \
--identifier-prefix=GI \
--symbol-prefix=g \
+ --symbol-prefix=gi \
--c-include="girepository.h" \
--add-include-path=.
GIRepository_2_0_gir_PACKAGES = gobject-2.0
GIRepository_2_0_gir_INCLUDES = GObject-2.0
GIRepository_2_0_gir_EXPORT_PACKAGES = gobject-introspection-1.0
GIRepository_2_0_gir_CFLAGS = \
- -I$(top_srcdir)/girepository -I$(top_srcdir) \
+ -I$(top_srcdir)/girepository \
+ -I$(top_srcdir) \
+ -I$(top_builddir)/girepository \
-DGI_COMPILATION
GIRepository_2_0_gir_FILES = \
$(top_srcdir)/girepository/girepository.h \
$(top_srcdir)/girepository/girepository.c \
$(top_srcdir)/girepository/gi*info.c \
$(top_srcdir)/girepository/gi*info.h \
+ $(top_builddir)/girepository/giversion.h \
$(top_srcdir)/girepository/gitypelib.h \
$(top_srcdir)/girepository/gitypes.h
diff --git a/Makefile-girepository.am b/Makefile-girepository.am
index 2af8c4a5..c7f74b20 100644
--- a/Makefile-girepository.am
+++ b/Makefile-girepository.am
@@ -24,7 +24,8 @@ girepo_HEADERS = \
girepository/gitypes.h \
girepository/giunioninfo.h \
girepository/giversionmacros.h \
- girepository/givfuncinfo.h
+ girepository/givfuncinfo.h \
+ $(top_builddir)/girepository/giversion.h
lib_LTLIBRARIES += libgirepository-1.0.la
noinst_LTLIBRARIES += libgirepository-internals.la libgirepository-gthash.la
@@ -35,7 +36,8 @@ libgirepository_gthash_la_CFLAGS = \
$(WARN_CFLAGS) \
$(GIREPO_CFLAGS) \
$(GI_HIDDEN_VISIBILITY_CFLAGS) \
- -I$(top_srcdir)/girepository
+ -I$(top_srcdir)/girepository \
+ -I$(top_builddir)/girepository
libgirepository_gthash_la_LDFLAGS = \
$(WARN_LDFLAGS)
libgirepository_gthash_la_LIBADD = libcmph.la $(GIREPO_LIBS)
@@ -55,7 +57,8 @@ libgirepository_internals_la_CFLAGS = \
$(WARN_CFLAGS) \
$(GIREPO_CFLAGS) \
$(GI_HIDDEN_VISIBILITY_CFLAGS) \
- -I$(top_srcdir)/girepository
+ -I$(top_srcdir)/girepository \
+ -I$(top_builddir)/girepository
libgirepository_internals_la_LDFLAGS = \
$(WARN_LDFLAGS)
@@ -86,6 +89,7 @@ libgirepository_1_0_la_SOURCES = \
girepository/gitypelib.c \
girepository/gitypelib-internal.h \
girepository/giunioninfo.c \
+ girepository/giversion.c \
girepository/givfuncinfo.c
libgirepository_1_0_la_CPPFLAGS = \
@@ -93,6 +97,7 @@ libgirepository_1_0_la_CPPFLAGS = \
$(GIREPO_CFLAGS) \
$(GI_HIDDEN_VISIBILITY_CFLAGS) \
-I$(top_srcdir)/girepository \
+ -I$(top_builddir)/girepository \
-DG_IREPOSITORY_COMPILATION
libgirepository_1_0_la_LIBADD = libgirepository-gthash.la $(GIREPO_LIBS)
libgirepository_1_0_la_LDFLAGS = \
@@ -117,5 +122,5 @@ CLEANFILES += gthash-test
TESTS += gthash-test
gthash_test_SOURCES = girepository/gthash.c girepository/gthash-test.c
-gthash_test_CFLAGS = -I$(top_srcdir)/girepository $(GOBJECT_CFLAGS)
+gthash_test_CFLAGS = -I$(top_srcdir)/girepository -I$(top_builddir)/girepository $(GOBJECT_CFLAGS)
gthash_test_LDADD = libcmph.la libgirepository-1.0.la $(GOBJECT_LIBS)
diff --git a/Makefile-giscanner.am b/Makefile-giscanner.am
index 2879ab20..e78df42a 100644
--- a/Makefile-giscanner.am
+++ b/Makefile-giscanner.am
@@ -21,7 +21,7 @@ libgiscanner_la_SOURCES = \
giscanner/sourcescanner.h \
giscanner/scannerlexer.l \
giscanner/scannerparser.y
-libgiscanner_la_CPPFLAGS = -I$(top_srcdir)/girepository -I$(top_srcdir)/giscanner
+libgiscanner_la_CPPFLAGS = -I$(top_srcdir)/girepository -I$(top_builddir)/girepository -I$(top_srcdir)/giscanner
libgiscanner_la_LIBADD = $(GOBJECT_LIBS) $(GIO_LIBS)
libgiscanner_la_CFLAGS = $(GOBJECT_CFLAGS) $(GIO_CFLAGS) $(WARN_CFLAGS_FLEX)
libgiscanner_la_LDFLAGS = $(WARN_LDFLAGS)
diff --git a/Makefile-tools.am b/Makefile-tools.am
index fcaf1e01..06622f4e 100644
--- a/Makefile-tools.am
+++ b/Makefile-tools.am
@@ -24,7 +24,7 @@ g-ir-doc-tool: tools/g-ir-tool-template.in _giscanner.la Makefile
@chmod a+x $@
g_ir_compiler_SOURCES = tools/compiler.c
-g_ir_compiler_CPPFLAGS = -I$(top_srcdir)/girepository
+g_ir_compiler_CPPFLAGS = -I$(top_srcdir)/girepository -I$(top_builddir)/girepository
g_ir_compiler_CFLAGS = $(GIO_CFLAGS) $(WARN_CFLAGS)
g_ir_compiler_LDFLAGS = $(WARN_LDFLAGS)
g_ir_compiler_LDADD = \
@@ -33,7 +33,7 @@ g_ir_compiler_LDADD = \
$(GIREPO_LIBS)
g_ir_generate_SOURCES = tools/generate.c
-g_ir_generate_CPPFLAGS = -I$(top_srcdir)/girepository
+g_ir_generate_CPPFLAGS = -I$(top_srcdir)/girepository -I$(top_builddir)/girepository
g_ir_generate_CFLAGS = $(GIO_CFLAGS) $(WARN_CFLAGS)
g_ir_generate_LDFLAGS = $(WARN_LDFLAGS)
g_ir_generate_LDADD = \
@@ -42,7 +42,7 @@ g_ir_generate_LDADD = \
$(GIREPO_LIBS)
g_ir_inspect_SOURCES = tools/g-ir-inspect.c
-g_ir_inspect_CFLAGS = $(GIO_CFLAGS) $(WARN_CFLAGS) -I$(top_srcdir)/girepository
+g_ir_inspect_CFLAGS = $(GIO_CFLAGS) $(WARN_CFLAGS) -I$(top_srcdir)/girepository -I$(top_builddir)/girepository
g_ir_inspect_LDFLAGS = $(WARN_LDFLAGS)
g_ir_inspect_LDADD = \
libgirepository-1.0.la \
diff --git a/configure.ac b/configure.ac
index 31206f36..b6a0952a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,13 @@ AM_SILENT_RULES([yes])
GI_VERSION=gi_version
AC_SUBST(GI_VERSION)
+GI_MAJOR_VERSION=gi_major_version
+GI_MINOR_VERSION=gi_minor_version
+GI_MICRO_VERSION=gi_micro_version
+AC_SUBST(GI_MAJOR_VERSION)
+AC_SUBST(GI_MINOR_VERSION)
+AC_SUBST(GI_MICRO_VERSION)
+
# Check for Win32
AC_CANONICAL_HOST
case "$host" in
@@ -388,6 +395,7 @@ docs/Makefile
docs/reference/Makefile
docs/reference/version.xml
giscanner/_version.py
+girepository/giversion.h
gobject-introspection-1.0.pc
gobject-introspection-no-export-1.0.pc])
AC_OUTPUT
diff --git a/docs/reference/gi-docs.xml b/docs/reference/gi-docs.xml
index 78db99ae..741023dc 100644
--- a/docs/reference/gi-docs.xml
+++ b/docs/reference/gi-docs.xml
@@ -23,6 +23,7 @@
<xi:include href="xml/girepository.xml"/>
<xi:include href="xml/gitypelib.xml" />
+ <xi:include href="xml/giversion.xml"/>
<xi:include href="xml/gicommontypes.xml"/>
<chapter>
@@ -98,5 +99,9 @@
<title>Index of new symbols in 1.46</title>
<xi:include href="xml/api-index-1.46.xml"><xi:fallback /></xi:include>
</index>
+ <index id="api-index-1-60" role="1.60">
+ <title>Index of new symbols in 1.60</title>
+ <xi:include href="xml/api-index-1.60.xml"><xi:fallback /></xi:include>
+ </index>
<xi:include href="xml/annotation-glossary.xml" />
</book>
diff --git a/docs/reference/gi-sections.txt b/docs/reference/gi-sections.txt
index 224e3cbe..28a59e0c 100644
--- a/docs/reference/gi-sections.txt
+++ b/docs/reference/gi-sections.txt
@@ -55,6 +55,7 @@ GI_AVAILABLE_IN_1_40
GI_AVAILABLE_IN_1_42
GI_AVAILABLE_IN_1_44
GI_AVAILABLE_IN_1_46
+GI_AVAILABLE_IN_1_60
GI_AVAILABLE_IN_ALL
GI_DEPRECATED_IN_1_32
GI_DEPRECATED_IN_1_32_FOR
@@ -75,6 +76,17 @@ GI_DEPRECATED_IN_1_46_FOR
</SECTION>
<SECTION>
+<FILE>giversion</FILE>
+GI_MAJOR_VERSION
+GI_MINOR_VERSION
+GI_MICRO_VERSION
+GI_CHECK_VERSION
+gi_get_major_version
+gi_get_minor_version
+gi_get_micro_version
+</SECTION>
+
+<SECTION>
<FILE>gibaseinfo</FILE>
GIBaseInfo
GIInfoType
diff --git a/gir/meson.build b/gir/meson.build
index 3de41840..0c50fc86 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -387,6 +387,7 @@ gir_files += custom_target('gir-gio',
girepository_command = scanner_command + [
'--identifier-prefix=GI',
'--symbol-prefix=g',
+ '--symbol-prefix=gi',
'--c-include=girepository.h',
'--namespace=GIRepository',
'--nsversion=2.0',
@@ -410,6 +411,7 @@ gir_files += custom_target('gir-girepository',
'--include-uninstalled=' + gobject_gir.full_path(),
'--cflags-begin'] + glib_includes + [
'-I' + meson.current_source_dir() + '/../girepository',
+ '-I' + meson.current_build_dir() + '/../girepository',
'-DGI_COMPILATION',
'--cflags-end',
'@INPUT@',
diff --git a/girepository/girepository.h b/girepository/girepository.h
index e3ed8372..3934ab31 100644
--- a/girepository/girepository.h
+++ b/girepository/girepository.h
@@ -47,6 +47,7 @@
#include <giunioninfo.h>
#include <giversionmacros.h>
#include <givfuncinfo.h>
+#include <giversion.h>
G_BEGIN_DECLS
diff --git a/girepository/giversion.c b/girepository/giversion.c
new file mode 100644
index 00000000..927190fb
--- /dev/null
+++ b/girepository/giversion.c
@@ -0,0 +1,114 @@
+/* Copyright (C) 2018 Christoph Reiter
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <girepository.h>
+
+/**
+ * SECTION:giversion
+ * @Title: Version Information
+ * @Short_description: macros and functions to check the girepository version
+ */
+
+/**
+ * GI_MAJOR_VERSION:
+ *
+ * The major version number of the girepository library.
+ *
+ * Since: 1.60
+ */
+
+/**
+ * GI_MINOR_VERSION:
+ *
+ * The minor version number of the girepository library.
+ *
+ * Since: 1.60
+ */
+
+/**
+ * GI_MICRO_VERSION:
+ *
+ * The micro version number of the girepository library.
+ *
+ * Since: 1.60
+ */
+
+/**
+ * GI_CHECK_VERSION:
+ * @major: the major version to check for
+ * @minor: the minor version to check for
+ * @micro: the micro version to check for
+ *
+ * Checks the version of the girepository library that is being compiled
+ * against.
+ *
+ * Returns: %TRUE if the version of the girepository header files
+ * is the same as or newer than the passed-in version.
+ *
+ * Since: 1.60
+ */
+
+/**
+ * gi_get_major_version:
+ *
+ * Returns the major version number of the girepository library.
+ * (e.g. in version 1.58.2 this is 1.)
+ *
+ * Returns: the major version number of the girepository library
+ *
+ * Since: 1.60
+ */
+guint
+gi_get_major_version (void)
+{
+ return GI_MAJOR_VERSION;
+}
+
+/**
+ * gi_get_minor_version:
+ *
+ * Returns the minor version number of the girepository library.
+ * (e.g. in version 1.58.2 this is 58.)
+ *
+ * Returns: the minor version number of the girepository library
+ *
+ * Since: 1.60
+ */
+guint
+gi_get_minor_version (void)
+{
+ return GI_MINOR_VERSION;
+}
+
+/**
+ * gi_get_micro_version:
+ *
+ * Returns the micro version number of the girepository library.
+ * (e.g. in version 1.58.2 this is 2.)
+ *
+ * Returns: the micro version number of the girepository library
+ *
+ * Since: 1.60
+ */
+guint
+gi_get_micro_version (void)
+{
+ return GI_MICRO_VERSION;
+}
diff --git a/girepository/giversion.h.in b/girepository/giversion.h.in
new file mode 100644
index 00000000..177d33d1
--- /dev/null
+++ b/girepository/giversion.h.in
@@ -0,0 +1,47 @@
+/* Copyright (C) 2018 Christoph Reiter
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIVERISON_H__
+#define __GIVERISON_H__
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+G_BEGIN_DECLS
+
+#define GI_MAJOR_VERSION @GI_MAJOR_VERSION@
+#define GI_MINOR_VERSION @GI_MINOR_VERSION@
+#define GI_MICRO_VERSION @GI_MICRO_VERSION@
+
+#define GI_CHECK_VERSION(major,minor,micro) \
+ (GI_MAJOR_VERSION > (major) || \
+ (GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION > (minor)) || \
+ (GI_MAJOR_VERSION == (major) && GI_MINOR_VERSION == (minor) && \
+ GI_MICRO_VERSION >= (micro)))
+
+GI_AVAILABLE_IN_1_60
+guint gi_get_major_version (void) G_GNUC_CONST;
+GI_AVAILABLE_IN_1_60
+guint gi_get_minor_version (void) G_GNUC_CONST;
+GI_AVAILABLE_IN_1_60
+guint gi_get_micro_version (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GIVERISON_H__ */
diff --git a/girepository/giversionmacros.h b/girepository/giversionmacros.h
index bf8a0861..c32e5bb8 100644
--- a/girepository/giversionmacros.h
+++ b/girepository/giversionmacros.h
@@ -153,4 +153,10 @@
# define GI_AVAILABLE_IN_1_46 _GI_EXTERN
#endif
+#if defined(GLIB_VERSION_2_60) && GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_60
+# define GI_AVAILABLE_IN_1_60 GLIB_UNAVAILABLE(2, 60)
+#else
+# define GI_AVAILABLE_IN_1_60 _GI_EXTERN
+#endif
+
#endif /* __GIVERSIONMACROS_H__ */
diff --git a/girepository/meson.build b/girepository/meson.build
index 6a8c5b5d..cc8d8420 100644
--- a/girepository/meson.build
+++ b/girepository/meson.build
@@ -36,6 +36,12 @@ girepo_internals_dep = declare_dependency(
include_directories: include_directories('.'),
)
+gi_version_h = configure_file(
+ configuration: config,
+ input: 'giversion.h.in',
+ output: 'giversion.h',
+)
+
girepo_headers = [
'giarginfo.h',
'gibaseinfo.h',
@@ -58,6 +64,7 @@ girepo_headers = [
'giunioninfo.h',
'giversionmacros.h',
'givfuncinfo.h',
+ gi_version_h,
]
girepo_sources = [
@@ -81,6 +88,7 @@ girepo_sources = [
'gitypeinfo.c',
'gitypelib.c',
'giunioninfo.c',
+ 'giversion.c',
'givfuncinfo.c',
]
@@ -102,6 +110,7 @@ girepo_gir_sources = files(
'gistructinfo.c',
'gitypeinfo.c',
'giunioninfo.c',
+ 'giversion.c',
'givfuncinfo.c',
'giarginfo.h',
'gibaseinfo.h',
@@ -122,7 +131,8 @@ girepo_gir_sources = files(
'gitypes.h',
'giunioninfo.h',
'givfuncinfo.h',
-)
+) + [gi_version_h]
+
install_headers(girepo_headers, subdir: 'gobject-introspection-1.0')
diff --git a/meson.build b/meson.build
index cf99b605..abebaccc 100644
--- a/meson.build
+++ b/meson.build
@@ -23,6 +23,11 @@ endif
cc = meson.get_compiler('c')
config = configuration_data()
+
+config.set('GI_MAJOR_VERSION', gi_versions[0])
+config.set('GI_MINOR_VERSION', gi_versions[1])
+config.set('GI_MICRO_VERSION', gi_versions[2])
+
config.set_quoted('GIR_SUFFIX', 'gir-1.0')
gir_dir_prefix = get_option('gir-dir-prefix')
if gir_dir_prefix == ''
diff --git a/tests/offsets/Makefile.am b/tests/offsets/Makefile.am
index 269b0ce1..aec41a57 100644
--- a/tests/offsets/Makefile.am
+++ b/tests/offsets/Makefile.am
@@ -36,7 +36,7 @@ CLEANFILES += Offsets-1.0.gir Offsets-1.0.typelib liboffsets.la
EXTRA_PROGRAMS += gitestoffsets
nodist_gitestoffsets_SOURCES = gitestoffsets.c
-gitestoffsets_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository -I$(top_srcdir)/tests
+gitestoffsets_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository -I$(top_builddir)/girepository -I$(top_srcdir)/tests
gitestoffsets_CFLAGS = $(WARN_CFLAGS)
gitestoffsets_LDFLAGS = $(WARN_LDFLAGS)
gitestoffsets_LDADD = $(top_builddir)/libgirepository-1.0.la $(GIREPO_LIBS)
diff --git a/tests/repository/Makefile.am b/tests/repository/Makefile.am
index b6bde9d9..e537ad7a 100644
--- a/tests/repository/Makefile.am
+++ b/tests/repository/Makefile.am
@@ -6,19 +6,19 @@ EXTRA_PROGRAMS = gitestrepo giteststructinfo gitestthrows gitypelibtest
CLEANFILES = $(EXTRA_PROGRAMS)
gitestrepo_SOURCES = gitestrepo.c
-gitestrepo_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
+gitestrepo_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository -I$(top_builddir)/girepository
gitestrepo_LDADD = $(top_builddir)/libgirepository-1.0.la $(GIREPO_LIBS)
giteststructinfo_SOURCES = giteststructinfo.c
-giteststructinfo_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
+giteststructinfo_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository -I$(top_builddir)/girepository
giteststructinfo_LDADD = $(top_builddir)/libgirepository-1.0.la $(GIREPO_LIBS)
gitestthrows_SOURCES = gitestthrows.c
-gitestthrows_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
+gitestthrows_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository -I$(top_builddir)/girepository
gitestthrows_LDADD = $(top_builddir)/libgirepository-1.0.la $(GIREPO_LIBS)
gitypelibtest_SOURCES = gitypelibtest.c
-gitypelibtest_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository
+gitypelibtest_CPPFLAGS = $(GIREPO_CFLAGS) -I$(top_srcdir)/girepository -I$(top_builddir)/girepository
gitypelibtest_LDADD = $(top_builddir)/libgirepository-1.0.la $(GIREPO_LIBS)
TESTS = gitestrepo giteststructinfo gitestthrows gitypelibtest
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
index 9da301fb..d5124e73 100644
--- a/tests/scanner/Makefile.am
+++ b/tests/scanner/Makefile.am
@@ -21,7 +21,7 @@ EXTRA_LTLIBRARIES = \
CLEANFILES += $(EXTRA_LTLIBRARIES)
GI_SCANNER_CFLAGS = -I$(top_srcdir)/tests
-AM_CPPFLAGS = -I$(top_srcdir)/girepository
+AM_CPPFLAGS = -I$(top_srcdir)/girepository -I$(top_builddir)/girepository
AM_CFLAGS = $(GIO_CFLAGS) $(GOBJECT_CFLAGS) $(GTHREAD_CFLAGS) $(GI_HIDDEN_VISIBILITY_CFLAGS) $(GI_SCANNER_CFLAGS) $(WARN_CFLAGS)
# -rpath needed to force libtool to build a shared library for a check_LTLIBRARIES
# target. See http://lists.gnu.org/archive/html/automake/2005-10/msg00107.html