summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac8
-rw-r--r--libdimension/Makefile.am10
-rw-r--r--libdimension/gl-stubs.c42
-rw-r--r--tests/libdimension/Makefile.am6
4 files changed, 64 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 089470d..e14f04e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,14 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
+dnl OpenGL canvas export
+AC_ARG_ENABLE([gl],
+ [AS_HELP_STRING([--enable-gl],
+ [Enable OpenGL canvas export [default=yes]])],
+ [],
+ [enable_gl=yes])
+AM_CONDITIONAL([GL], [test "$enable_gl" != "no"])
+
dnl Profile-guided optimization (default disabled)
AC_ARG_ENABLE([pgo],
[AS_HELP_STRING([--enable-pgo],
diff --git a/libdimension/Makefile.am b/libdimension/Makefile.am
index deb60c3..4ce01ff 100644
--- a/libdimension/Makefile.am
+++ b/libdimension/Makefile.am
@@ -57,7 +57,6 @@ libdimension_la_SOURCES = $(nobase_include_HEADERS) \
error.c \
finish_combination.c \
geometry.c \
- gl.c \
inlines.c \
interior.c \
light.c \
@@ -74,7 +73,14 @@ libdimension_la_SOURCES = $(nobase_include_HEADERS) \
sphere.c \
texture.c
libdimension_la_LDFLAGS = -version-info 0:0:0 $(AM_LDFLAGS)
-libdimension_la_LIBADD = -lm -lpthread -lpng -lGL
+libdimension_la_LIBADD = -lm -lpthread -lpng
+
+if GL
+libdimension_la_SOURCES += gl.c
+libdimension_la_LIBADD += -lGL
+else
+libdimension_la_SOURCES += gl-stubs.c
+endif
if PGO
diff --git a/libdimension/gl-stubs.c b/libdimension/gl-stubs.c
new file mode 100644
index 0000000..adcde7c
--- /dev/null
+++ b/libdimension/gl-stubs.c
@@ -0,0 +1,42 @@
+/*************************************************************************
+ * Copyright (C) 2010 Tavian Barnes <tavianator@gmail.com> *
+ * *
+ * This file is part of The Dimension Library. *
+ * *
+ * The Dimension 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 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * The Dimension 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 program. If not, see *
+ * <http://www.gnu.org/licenses/>. *
+ *************************************************************************/
+
+#include "dimension.h"
+
+/* Stubs for GL functions when compiled with --disable-gl */
+
+int
+dmnsn_gl_optimize_canvas(dmnsn_canvas *canvas)
+{
+ return 1;
+}
+
+int
+dmnsn_gl_write_canvas(const dmnsn_canvas *canvas)
+{
+ return 1;
+}
+
+dmnsn_canvas *
+dmnsn_gl_read_canvas(unsigned int x0, unsigned int y0,
+ unsigned int width, unsigned int height)
+{
+ return NULL;
+}
diff --git a/tests/libdimension/Makefile.am b/tests/libdimension/Makefile.am
index 72f9427..9c6c8ad 100644
--- a/tests/libdimension/Makefile.am
+++ b/tests/libdimension/Makefile.am
@@ -29,6 +29,10 @@ check_PROGRAMS = error-test \
TESTS = $(check_PROGRAMS)
XFAIL_TESTS = error-test
+if !GL
+XFAIL_TESTS += gl-test
+endif
+
.PHONY: clean-local-png-test
clean-local: clean-local-png-test
@@ -40,6 +44,8 @@ else
libdimension_tests_la_LIBADD = $(top_builddir)/libdimension/libdimension.la
endif
+libdimension_tests_la_LIBADD += -lX11 -lGL
+
error_test_SOURCES = error.c
error_test_LDADD = libdimension-tests.la