build: Start moving to a non-recursive layout

*** WARNING: THIS COMMIT CHANGES THE BUILD ***

Do not recurse into the backend directories to build private, internal
libraries.

We only recurse from clutter/ into the cogl sub-directory; from there,
we don't recurse any further. All the backend-specific code in Cogl and
Clutter is compiled conditionally depending on the macros defined by the
configure script.

We still recurse from the top-level directory into doc, clutter and
tests, because gtk-doc and tests do not deal nicely with non-recursive
layouts.

This change makes Clutter compile slightly faster, and cleans up the
build system, especially when dealing with introspection data.

Ideally, we also want to make Cogl part of the top-level build, so that
we can finally drop the sed trick to change the shared library from the
GIR before compiling it.

Currently disabled:

  ‣ OSX backend
  ‣ Fruity backend

Currently enabled but untested:

  ‣ EGL backend
  ‣ Windows backend
This commit is contained in:
Emmanuele Bassi 2010-09-13 11:30:30 +01:00
parent 14dbe81deb
commit eb179d4b67
25 changed files with 161 additions and 270 deletions

View File

@ -1,8 +1,10 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
# preamble
NULL =
SUBDIRS = driver
SUBDIRS =
BUILT_SOURCES =
@ -12,23 +14,6 @@ DISTCLEANFILES =
noinst_LTLIBRARIES =
# pkg-config ==================================================================
pc_files = \
cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc \
cogl-$(CLUTTER_API_VERSION).pc
cogl-$(CLUTTER_API_VERSION).pc: cogl.pc
$(QUIET_GEN)cp -f $< $(@F)
cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc: cogl.pc
$(QUIET_GEN)cp -f $< $(@F)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files)
EXTRA_DIST += cogl.pc.in
CLEANFILES += $(pc_files)
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/clutter/cogl \
@ -54,6 +39,20 @@ BUILT_SOURCES += cogl-defines.h
DISTCLEANFILES += cogl-defines.h
EXTRA_DIST += cogl-defines.h.in
# pkg-config
pc_files = \
cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc \
cogl-$(CLUTTER_API_VERSION).pc
cogl-$(COGL_DRIVER)-$(CLUTTER_API_VERSION).pc: cogl-$(CLUTTER_API_VERSION).pc
$(QUIET_GEN)cp -f $< $(@F)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files)
EXTRA_DIST += cogl.pc.in
DISTCLEANFILES += $(pc_files)
# public headers
cogl_public_h = \
$(srcdir)/cogl-object.h \
@ -76,6 +75,58 @@ cogl_public_h = \
$(srcdir)/cogl.h \
$(NULL)
# driver sources
cogl_driver_sources =
if COGL_DRIVER_GL
cogl_driver_sources += \
$(srcdir)/driver/gl/cogl-context-driver-gl.c \
$(srcdir)/driver/gl/cogl-context-driver-gl.h \
$(srcdir)/driver/gl/cogl-feature-functions-gl.h \
$(srcdir)/driver/gl/cogl-gl.c \
$(srcdir)/driver/gl/cogl-program-gl.c \
$(srcdir)/driver/gl/cogl-program-gl.h \
$(srcdir)/driver/gl/cogl-texture-driver-gl.c \
$(NULL)
endif
if COGL_DRIVER_GLES
cogl_driver_sources += \
$(srcdir)/driver/gles/cogl-context-driver-gles.c \
$(srcdir)/driver/gles/cogl-context-driver-gles.h \
$(srcdir)/driver/gles/cogl-feature-functions-gles.h \
$(srcdir)/driver/gles/cogl-gles.c \
$(srcdir)/driver/gles/cogl-program-gles.c \
$(srcdir)/driver/gles/cogl-program-gles.h \
$(srcdir)/driver/gles/cogl-texture-driver-gles.c \
$(NULL)
if USE_GLES2_WRAPPER
cogl_driver_sources += \
$(srcdir)/driver/gles/cogl-gles2-wrapper.c \
$(srcdir)/driver/gles/cogl-gles2-wrapper.h \
$(NULL)
BUILT_SOURCES += \
cogl-fixed-vertex-shader.h \
cogl-fixed-vertex-shader.c \
cogl-fixed-fragment-shader.h \
cogl-fixed-fragment-shader.c
%.h: $(srcdir)/driver/gles/%.glsl
/bin/sh $(top_srcdir)/build/stringify.sh -h $< > $@
%.c: $(srcdir)/driver/gles/%.glsl
/bin/sh $(top_srcdir)/build/stringify.sh $< > $@
endif # USE_GLES2_WAPPER
EXTRA_DIST += \
$(srcdir)/driver/gles/cogl-fixed-vertex-shader.glsl \
$(srcdir)/driver/gles/cogl-fixed-fragment-shader.glsl \
$(NULL)
endif # COGL_DRIVER_GLES
# winsys sources, common to all backends
cogl_winsys_common_sources = \
$(srcdir)/winsys/cogl-winsys.h \
@ -114,11 +165,13 @@ cogl_tesselator_sources = \
$(NULL)
EXTRA_DIST += \
$(srcdir)/tesselator/README \
$(srcdir)/tesselator/priorityq-heap.c
$(srcdir)/tesselator/README \
$(srcdir)/tesselator/priorityq-heap.c \
$(NULL)
# sources
cogl_sources_c = \
$(cogl_driver_sources) \
$(cogl_winsys_common_sources) \
$(cogl_tesselator_sources) \
$(srcdir)/cogl-debug.h \
@ -212,6 +265,47 @@ cogl_sources_c = \
$(srcdir)/cogl-callback-list.c \
$(NULL)
if SUPPORT_XLIB
cogl_public_h += \
$(srcdir)/winsys/cogl-texture-pixmap-x11.h
cogl_sources_c += \
$(srcdir)/winsys/cogl-xlib.h \
$(srcdir)/winsys/cogl-xlib.c \
$(srcdir)/winsys/cogl-texture-pixmap-x11.c \
$(srcdir)/winsys/cogl-texture-pixmap-x11-private.h
endif
if SUPPORT_GLX
cogl_sources_c += \
$(srcdir)/winsys/cogl-glx.c
endif
if SUPPORT_EGL_PLATFORM_POWERVR_X11
cogl_sources_c += \
$(srcdir)/winsys/cogl-egl.c
endif
if SUPPORT_EGL_PLATFORM_POWERVR_NULL
cogl_sources_c += \
$(srcdir)/winsys/cogl-egl.c
endif
if SUPPORT_EGL_PLATFORM_POWERVR_GDL
cogl_sources_c += \
$(srcdir)/winsys/cogl-egl.c
endif
if SUPPORT_EGL_PLATFORM_FRUITY
cogl_sources_c += \
$(srcdir)/winsys/cogl-fruity.c
endif
if SUPPORT_WIN32
cogl_sources_c += \
$(srcdir)/winsys/cogl-win32.c
endif
if SUPPORT_OSX
cogl_sources_c += \
$(srcdir)/winsys/cogl-osx.c
endif
EXTRA_DIST += stb_image.c
# glib-mkenums rules
glib_enum_h = cogl-enum-types.h
glib_enum_c = cogl-enum-types.c
@ -220,54 +314,10 @@ include $(top_srcdir)/build/autotools/Makefile.am.enums
noinst_LTLIBRARIES += libclutter-cogl.la
libclutter_cogl_la_LIBADD = \
-lm $(CLUTTER_LIBS) \
$(top_builddir)/clutter/cogl/cogl/driver/$(COGL_DRIVER)/libclutter-cogl-driver.la
libclutter_cogl_la_LIBADD = -lm $(CLUTTER_LIBS)
libclutter_cogl_la_SOURCES = $(cogl_sources_c)
nodist_libclutter_cogl_la_SOURCES = $(BUILT_SOURCES)
if SUPPORT_XLIB
cogl_public_h += \
$(srcdir)/winsys/cogl-texture-pixmap-x11.h
libclutter_cogl_la_SOURCES += \
$(srcdir)/winsys/cogl-xlib.h \
$(srcdir)/winsys/cogl-xlib.c \
$(srcdir)/winsys/cogl-texture-pixmap-x11.c \
$(srcdir)/winsys/cogl-texture-pixmap-x11-private.h
endif
if SUPPORT_GLX
libclutter_cogl_la_SOURCES += \
$(srcdir)/winsys/cogl-glx.c
endif
if SUPPORT_EGL_PLATFORM_POWERVR_X11
libclutter_cogl_la_SOURCES += \
$(srcdir)/winsys/cogl-egl.c
endif
if SUPPORT_EGL_PLATFORM_POWERVR_NULL
libclutter_cogl_la_SOURCES += \
$(srcdir)/winsys/cogl-egl.c
endif
if SUPPORT_EGL_PLATFORM_POWERVR_GDL
libclutter_cogl_la_SOURCES += \
$(srcdir)/winsys/cogl-egl.c
endif
if SUPPORT_EGL_PLATFORM_FRUITY
libclutter_cogl_la_SOURCES += \
$(srcdir)/winsys/cogl-fruity.c
endif
if SUPPORT_WIN32
libclutter_cogl_la_SOURCES += \
$(srcdir)/winsys/cogl-win32.c
endif
if SUPPORT_OSX
libclutter_cogl_la_SOURCES += \
$(srcdir)/winsys/cogl-osx.c
endif
EXTRA_DIST += stb_image.c
# COGL installed headers
cogl_headers = \
$(cogl_public_h) \

View File

@ -25,7 +25,15 @@
#define __COGL_CONTEXT_H
#include "cogl-internal.h"
#include "cogl-context-driver.h"
#if HAVE_COGL_GL
#include "cogl-context-driver-gl.h"
#endif
#if HAVE_COGL_GLES || HAVE_COGL_GLES2
#include "cogl-context-driver-gles.h"
#endif
#include "cogl-context-winsys.h"
#include "cogl-primitives.h"
#include "cogl-clip-stack.h"

View File

@ -44,8 +44,13 @@
#include "cogl-journal-private.h"
#include "cogl-color-private.h"
#include "cogl-profile.h"
#ifndef HAVE_COGL_GLES
#include "cogl-program.h"
#ifdef HAVE_COGL_GL
#include "cogl-program-gl.h"
#endif
#ifdef HAVE_COGL_GLES2
#include "cogl-program-gles.h"
#endif
#include <glib.h>

View File

@ -42,8 +42,13 @@
#include "cogl-texture-private.h"
#include "cogl-blend-string.h"
#include "cogl-profile.h"
#ifndef HAVE_COGL_GLES
#include "cogl-program.h"
#ifdef HAVE_COGL_GL
#include "cogl-program-gl.h"
#endif
#ifdef HAVE_COGL_GLES2
#include "cogl-program-gles.h"
#endif
#include <glib.h>

View File

@ -40,8 +40,12 @@
#include "cogl-handle.h"
#include "cogl-shader-private.h"
#ifndef HAVE_COGL_GLES
#include "cogl-program.h"
#ifdef HAVE_COGL_GL
#include "cogl-program-gl.h"
#endif
#ifdef HAVE_COGL_GLES2
#include "cogl-program-gles.h"
#endif
#include <glib.h>

View File

@ -36,8 +36,13 @@
#include "cogl-material-private.h"
#include "cogl-context.h"
#include "cogl-texture-private.h"
#ifndef HAVE_COGL_GLES
#include "cogl-program.h"
#ifdef HAVE_COGL_GL
#include "cogl-program-gl.h"
#endif
#ifdef HAVE_COGL_GLES2
#include "cogl-program-gles.h"
#endif
#ifdef COGL_MATERIAL_BACKEND_GLSL

View File

@ -1,34 +0,0 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
-I$(srcdir)/../.. \
-I$(srcdir)/../../.. \
-I$(srcdir)/../../winsys \
-I../.. \
-I../../.. \
-DG_DISABLE_SINGLE_INCLUDES \
-DG_LOG_DOMAIN=\"Cogl-Driver\" \
-DCLUTTER_COMPILATION
noinst_LTLIBRARIES = libclutter-cogl-driver.la
libclutter_cogl_driver_la_CPPFLAGS = \
$(CLUTTER_CFLAGS) \
$(COGL_DEBUG_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(MAINTAINER_CFLAGS)
libclutter_cogl_driver_la_SOURCES = \
cogl.c \
cogl-texture-driver.c \
cogl-program.h \
cogl-program.c \
cogl-context-driver.h \
cogl-context-driver.c \
cogl-feature-functions.h \
$(NULL)

View File

@ -35,5 +35,5 @@
void
_cogl_create_context_driver (CoglContext *_context)
{
#include "cogl-feature-functions.h"
#include "cogl-feature-functions-gl.h"
}

View File

@ -40,7 +40,7 @@
typedef struct _CoglContextDriver
{
/* This defines a list of function pointers */
#include "cogl-feature-functions.h"
#include "cogl-feature-functions-gl.h"
GLint gl_max_program_temoraries_arb;
} CoglContextDriver;

View File

@ -153,7 +153,7 @@ _cogl_check_driver_valid (GError **error)
#define COGL_FEATURE_END() \
{ NULL, 0 }, \
};
#include "cogl-feature-functions.h"
#include "cogl-feature-functions-gl.h"
/* Define an array of features */
#undef COGL_FEATURE_BEGIN
@ -170,7 +170,7 @@ _cogl_check_driver_valid (GError **error)
static const CoglFeatureData cogl_feature_data[] =
{
#include "cogl-feature-functions.h"
#include "cogl-feature-functions-gl.h"
};
void

View File

@ -29,7 +29,7 @@
#endif
#include "cogl.h"
#include "cogl-program.h"
#include "cogl-program-gl.h"
#include "cogl-shader-private.h"
#include "cogl-internal.h"
#include "cogl-handle.h"

View File

@ -1,57 +0,0 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
NULL =
INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
-I$(srcdir)/../.. \
-I$(srcdir)/../../.. \
-I$(srcdir)/../../winsys \
-I../.. \
-I../../.. \
-DG_DISABLE_SINGLE_INCLUDES \
-DG_LOG_DOMAIN=\"Cogl-Driver\" \
-DCLUTTER_COMPILATION
noinst_LTLIBRARIES = libclutter-cogl-driver.la
libclutter_cogl_driver_la_CPPFLAGS = \
$(CLUTTER_CFLAGS) \
$(COGL_DEBUG_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(MAINTAINER_CFLAGS)
libclutter_cogl_driver_la_SOURCES = \
cogl.c \
cogl-texture-driver.c \
cogl-context-driver.c \
cogl-context-driver.h \
cogl-gles2-wrapper.h \
cogl-program.h \
cogl-program.c \
cogl-feature-functions.h
if USE_GLES2_WRAPPER
libclutter_cogl_driver_la_SOURCES += \
cogl-gles2-wrapper.c \
cogl-fixed-vertex-shader.h \
cogl-fixed-vertex-shader.c \
cogl-fixed-fragment-shader.h \
cogl-fixed-fragment-shader.c
endif
EXTRA_DIST = \
stringify.sh \
cogl-fixed-vertex-shader.glsl \
cogl-fixed-fragment-shader.glsl
BUILT_SOURCES = \
cogl-fixed-vertex-shader.h \
cogl-fixed-vertex-shader.c \
cogl-fixed-fragment-shader.h \
cogl-fixed-fragment-shader.c
%.h: $(srcdir)/%.glsl
/bin/sh $(srcdir)/stringify.sh -h $< > $@
%.c: $(srcdir)/%.glsl
/bin/sh $(srcdir)/stringify.sh $< > $@

View File

@ -36,7 +36,7 @@
void
_cogl_create_context_driver (CoglContext *_context)
{
#include "cogl-feature-functions.h"
#include "cogl-feature-functions-gles.h"
/* Init the GLES2 wrapper */
#ifdef HAVE_COGL_GLES2

View File

@ -41,7 +41,7 @@
typedef struct _CoglContextDriver
{
/* This defines a list of function pointers */
#include "cogl-feature-functions.h"
#include "cogl-feature-functions-gles.h"
#ifdef HAVE_COGL_GLES2
CoglGles2Wrapper gles2;

View File

@ -50,7 +50,7 @@ _cogl_check_driver_valid (GError **error)
#define COGL_FEATURE_END() \
{ NULL, 0 }, \
};
#include "cogl-feature-functions.h"
#include "cogl-feature-functions-gles.h"
/* Define an array of features */
#undef COGL_FEATURE_BEGIN

View File

@ -25,7 +25,6 @@
#include "config.h"
#endif
#include <clutter/clutter-fixed.h>
#include <string.h>
#include <math.h>

View File

@ -26,7 +26,7 @@
#include "cogl.h" /* needed for gl header include */
#include "cogl-internal.h"
#include "cogl-program.h"
#include "cogl-program-gles.h"
G_BEGIN_DECLS

View File

@ -36,7 +36,7 @@
#include <string.h>
#include "cogl-shader-private.h"
#include "cogl-program.h"
#include "cogl-program-gles.h"
static void _cogl_program_free (CoglProgram *program);

View File

@ -1,94 +0,0 @@
#! /bin/sh
# Cogl
#
# An object oriented GL/GLES Abstraction/Utility Layer
#
# Copyright (C) 2008,2009 Intel Corporation.
#
# 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.
output_copyright ()
{
cat <<EOF
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2008,2009 Intel Corporation.
*
* 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.
*/
EOF
}
# If two arguments are given then generate the header file instead
if test "$#" = 2; then
bfname="${2%.glsl}"
bname=`basename "$bfname"`
varname=`echo -n "${bname}" | tr -c a-z _`
guardname=`echo -n "${varname}" | tr a-z A-Z`
guardname="__${guardname}_H"
output_copyright
echo
echo "#ifndef ${guardname}"
echo "#define ${guardname}"
echo
sed -n \
-e 's/^ *\/\*\*\* \([a-zA-Z0-9_]*\) \*\*\*\//extern const char \1[];/p' \
< "$2"
echo
echo "#endif /* ${guardname} */"
else
bfname="${1%.glsl}";
bname=`basename "${bfname}"`;
varname=`echo -n "${bname}" | tr -c a-z _`;
output_copyright
echo
sed -n \
-e h \
-e 's/^ *\/\*\*\* \([a-zA-Z0-9_]*\) \*\*\*\// ;\nconst char \1[] =/' \
-e 't got' \
-e g \
-e 's/"/\\"/' \
-e 's/^/ "/' \
-e 's/$/\\n"/' \
-e ': got' \
-e p \
< "$1"
echo " ;"
fi