Permalink
Browse files

Separate mypaint-config.h and config.h.

MyPaint uses some of the constants from `mypaint-config.h` but much of
the generated part from configuration should not be public because it
conflicts with the configuration of other autotooled project.
Split it so that the generated constants are not in the public header.
This means also that config.h cannot be included from any of the other
public headers and the main problem with this was that the macro
MYPAINT_CONFIG_USE_GLIB cannot be used inside a public header anymore.
I slightly reorganized installed files to account for this.
  • Loading branch information...
1 parent ae76bd4 commit 5e68f90e2c8ab6f179f15989c546994b0a43e18f Jehan committed May 22, 2016
View
@@ -1,6 +1,8 @@
ACLOCAL_AMFLAGS = -I m4macros
+if WITH_GLIB
libmypaint_glib = glib/mypaint-brush.h
+endif
## GObject introspection ##
@@ -98,6 +100,7 @@ nobase_libmypaint_public_HEADERS = \
LIBMYPAINT_SOURCES = \
brushmodes.c \
+ config.h \
fifo.c \
helpers.c \
mypaint-mapping.c \
@@ -116,14 +119,7 @@ LIBMYPAINT_SOURCES = \
libmypaint_la_SOURCES = $(libmypaint_public_HEADERS) $(LIBMYPAINT_SOURCES)
-# Force generated source files to be built first.
-# Automatic dependency tracking does not always work as expected. See:
-# https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html
-BUILT_SOURCES = mypaint-config.h
-DISTCLEANFILES = mypaint-config.h MyPaint-@LIBMYPAINT_MAJOR_VERSION@.@LIBMYPAINT_MINOR_VERSION@.gir.files
-
-mypaint-config.h: mypaint-config.h.top config.h mypaint-config.h.bottom
- cat $^ >$@
+DISTCLEANFILES = MyPaint-@LIBMYPAINT_MAJOR_VERSION@.@LIBMYPAINT_MINOR_VERSION@.gir.files
EXTRA_DIST = \
brushsettings.json \
@@ -138,8 +134,6 @@ EXTRA_DIST = \
generate.py \
helpers.h \
libmypaint.c \
- mypaint-config.h.bottom \
- mypaint-config.h.top \
operationqueue.h \
rng-double.h \
tiled-surface-private.h \
View
@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <config.h>
+
#include <stdint.h>
#include <assert.h>
View
@@ -15,6 +15,8 @@
*
*/
+#include <config.h>
+
#include <stdlib.h>
#include "fifo.h"
@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <config.h>
+
#include <stdlib.h>
#include <assert.h>
@@ -21,6 +21,7 @@
G_BEGIN_DECLS
+#include <mypaint-config.h>
#include <glib/mypaint-gegl-glib.h>
#include <mypaint-tiled-surface.h>
@@ -3,7 +3,6 @@
#include <mypaint-config.h>
-#if MYPAINT_CONFIG_USE_GLIB
#include <glib-object.h>
#define MYPAINT_TYPE_BRUSH (mypaint_brush_get_type ())
@@ -22,6 +21,4 @@ GType mypaint_fixed_tiled_surface_get_type(void);
#define MYPAINT_VALUE_HOLDS_RECTANGLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), MYPAINT_TYPE_RECTANGLE))
GType mypaint_rectangle_get_type(void);
-#endif
-
#endif // MYPAINTBRUSHGLIB_H
@@ -1,3 +1,4 @@
+#include <config.h>
#include <mypaint-config.h>
#if MYPAINT_CONFIG_USE_GLIB
@@ -3,13 +3,9 @@
#include <mypaint-config.h>
-#if MYPAINT_CONFIG_USE_GLIB
-
#include <glib-object.h>
#define MYPAINT_GEGL_TYPE_TILED_SURFACE (mypaint_gegl_tiled_surface_get_type ())
#define MYPAINT_GEGL_VALUE_HOLDS_TILED_SURFACE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), MYPAINT_GEGL_TYPE_TILED_SURFACE))
GType mypaint_gegl_tiled_surface_get_type(void);
-#endif
-
#endif // MYPAINTGEGLGLIB_H
View
@@ -17,6 +17,8 @@
#ifndef HELPERS_C
#define HELPERS_C
+#include <config.h>
+
#include <assert.h>
#include <stdint.h>
#include <math.h>
@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <config.h>
+
#include "mypaint-brush-settings.h"
#include <string.h>
@@ -17,6 +17,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <mypaint-config.h>
#include <mypaint-glib-compat.h>
#include <mypaint-brush-settings-gen.h>
View
@@ -14,12 +14,19 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <config.h>
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
+#if MYPAINT_CONFIG_USE_GLIB
+#include <glib.h>
+#include <glib/mypaint-brush.h>
+#endif
+
#include "mypaint-brush.h"
#include "mypaint-brush-settings.h"
View
@@ -18,16 +18,14 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <mypaint-glib-compat.h>
+#include <mypaint-config.h>
#include <mypaint-surface.h>
#include <mypaint-brush-settings.h>
G_BEGIN_DECLS
typedef struct MyPaintBrush MyPaintBrush;
-#include <glib/mypaint-brush.h>
-
MyPaintBrush *
mypaint_brush_new(void);
@@ -13,4 +13,4 @@
#define MYPAINT_MAX_MIPMAP_LEVEL 4
#endif
-/* Start generated config */
+#endif /* MYPAINTCONFIG_H */
@@ -1,3 +0,0 @@
-/* End generated config */
-
-#endif /* MYPAINTCONFIG_H */
@@ -4,6 +4,12 @@
#include <stdio.h>
#include <string.h>
+#include <config.h>
+
+#if MYPAINT_CONFIG_USE_GLIB
+#include <glib.h>
+#endif
+
#include <mypaint-fixed-tiled-surface.h>
@@ -1,6 +1,7 @@
#ifndef MYPAINTFIXEDTILEDSURFACE_H
#define MYPAINTFIXEDTILEDSURFACE_H
+#include <mypaint-config.h>
#include <mypaint-glib-compat.h>
#include <mypaint-tiled-surface.h>
View
@@ -3,13 +3,7 @@
#include <mypaint-config.h>
-#if MYPAINT_CONFIG_USE_GLIB
-
-#include <glib.h>
-
-#else // not MYPAINT_CONFIG_USE_GLIB
-
-#ifndef __G_LIB_H_
+#ifndef __G_LIB_H__
/* From $INCLUDEPATH/glib-2.0/glib/gmacros.h */
#ifdef __cplusplus
@@ -33,8 +27,6 @@ typedef gint gboolean;
/* From $LIBPATH/glib-2.0/include/glibconfig.h */
typedef unsigned short guint16;
-#endif // __G_LIB_H_
-
-#endif // MYPAINT_CONFIG_USE_GLIB
+#endif // __G_LIB_H__
#endif // MYPAINTGLIBCOMPAT_H
View
@@ -17,9 +17,15 @@
#ifndef MAPPING_C
#define MAPPING_C
+#include <config.h>
+
#include <stdlib.h>
#include <assert.h>
+#if MYPAINT_CONFIG_USE_GLIB
+#include <glib.h>
+#endif
+
#include "mypaint-mapping.h"
#include "helpers.h"
View
@@ -1,6 +1,7 @@
#ifndef MAPPING_H
#define MAPPING_H
+#include <mypaint-config.h>
#include <mypaint-glib-compat.h>
G_BEGIN_DECLS
View
@@ -15,6 +15,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <config.h>
+
#include <mypaint-rectangle.h>
#include <stdlib.h>
#include <string.h>
View
@@ -18,6 +18,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <mypaint-config.h>
#include <mypaint-glib-compat.h>
G_BEGIN_DECLS
View
@@ -15,6 +15,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <config.h>
+
#include <assert.h>
#include "mypaint-surface.h"
View
@@ -18,7 +18,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <mypaint-glib-compat.h>
+#include <mypaint-config.h>
#include <mypaint-rectangle.h>
G_BEGIN_DECLS
@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <config.h>
+
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
@@ -23,6 +25,7 @@
#include <omp.h>
#endif
+#include "mypaint-config.h"
#include "mypaint-tiled-surface.h"
#include "tiled-surface-private.h"
#include "helpers.h"
View
@@ -1,4 +1,5 @@
+#include <config.h>
#include <mypaint-config.h>
#ifdef _OPENMP
View
@@ -14,11 +14,17 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <config.h>
#include <stdlib.h>
#include <assert.h>
+#if MYPAINT_CONFIG_USE_GLIB
+#include <glib.h>
+#else // not MYPAINT_CONFIG_USE_GLIB
#include <mypaint-glib-compat.h>
+#endif
+
#include "operationqueue.h"
#include "fifo.h"
View
@@ -21,6 +21,8 @@
* independent generator objects. All changes made to this file are considered
* to be in the public domain. */
+#include <config.h>
+
#include "rng-double.h"
#include <stdlib.h>
View
@@ -1,7 +1,14 @@
#ifndef RNGDOUBLE_H
#define RNGDOUBLE_H
+#include "mypaint-config.h"
+
+#if MYPAINT_CONFIG_USE_GLIB
+#include <glib.h>
+#else // not MYPAINT_CONFIG_USE_GLIB
#include <mypaint-glib-compat.h>
+#endif
+
G_BEGIN_DECLS
@@ -15,7 +15,12 @@
*/
#include "mypaint-benchmark.h"
+
+#if MYPAINT_CONFIG_USE_GLIB
+#include <glib.h>
+#else // not MYPAINT_CONFIG_USE_GLIB
#include <mypaint-glib-compat.h>
+#endif
#include <stdio.h>
#include <string.h>
@@ -1,3 +1,4 @@
+#include "mypaint-config.h"
#include <stdlib.h>
#include <stdio.h>
View
@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <config.h>
+
#include <stdlib.h>
#include <assert.h>
View
@@ -17,7 +17,11 @@
#ifndef TILEMAP_H
#define TILEMAP_H
+#if MYPAINT_CONFIG_USE_GLIB
+#include <glib.h>
+#else // not MYPAINT_CONFIG_USE_GLIB
#include <mypaint-glib-compat.h>
+#endif
G_BEGIN_DECLS
Oops, something went wrong.

0 comments on commit 5e68f90

Please sign in to comment.