Преглед изворни кода

Moved examples from test/ to example/ subdirectory and updated README.md.

Fredrik Hultin пре 12 година
родитељ
комит
8cb31c5953

+ 1 - 1
Makefile.am

@@ -1,4 +1,4 @@
 AUTOMAKE_OPTIONS = foreign
-SUBDIRS = src tests
+SUBDIRS = src tests examples
 pkgconfigdir = $(libdir)/$(PKG_CONFIG_EXTRA_PATH)pkgconfig
 pkgconfig_DATA = pkg-config/openhmd.pc

+ 2 - 2
README.md

@@ -18,7 +18,7 @@ OpenHMD is released under the permissive Boost Software License (see LICENSE for
     * https://github.com/signal11/hidapi/
 
 ## Compiling and Installing
-./configure
+./configure [--enable-openglexample]
 make
 sudo make install
 
@@ -37,4 +37,4 @@ Note that this is *only* if you're linking statically! If you're using the DLL t
 Will be available soon.
 
 ## Using OpenHMD
-Proper usage examples will be provided in the future. Right now, take a look at the tests/simple subdirectory.
+See the examples/ subdirectory for usage examples. The OpenGL example is not built by default, to build it use the --enable-openglexample option for the configure script. It requires SDL, glew and OpenGL.

+ 9 - 9
configure.ac

@@ -36,17 +36,17 @@ esac
 
 PKG_CHECK_MODULES([hidapi], [$hidapi] >= 0.0.5)
 
-# Do we build OpenGL test?
-AC_ARG_ENABLE([opengltest],
-        [AS_HELP_STRING([--enable-opengltest],
-                [enable building of OpenGL test (default n)])],
-        [opengltest_enabled=$enableval],
-        [opengltest_enabled='no'])
+# Do we build OpenGL example?
+AC_ARG_ENABLE([openglexample],
+        [AS_HELP_STRING([--enable-openglexample],
+                [enable building of OpenGL example (default n)])],
+        [openglexample_enabled=$enableval],
+        [openglexample_enabled='no'])
 
-AM_CONDITIONAL([BUILD_OPENGL_TEST], [test "x$opengltest_enabled" != "xno"])
+AM_CONDITIONAL([BUILD_OPENGL_EXAMPLE], [test "x$openglexample_enabled" != "xno"])
 
 # Libs required by OpenGL test
-if test "x$opengltest_enabled" != "xno"; then
+if test "x$openglexample_enabled" != "xno"; then
 	PKG_CHECK_MODULES([sdl], [sdl])
 
 	# Try to find OpenGL with pkg-config
@@ -78,5 +78,5 @@ AC_PROG_CC_C99
 
 AC_CONFIG_HEADERS([config.h])
 
-AC_OUTPUT([Makefile src/Makefile tests/Makefile tests/simple/Makefile tests/unittests/Makefile tests/opengl/Makefile])
+AC_OUTPUT([Makefile src/Makefile tests/Makefile tests/unittests/Makefile examples/Makefile examples/opengl/Makefile examples/simple/Makefile])
 AC_OUTPUT 

+ 5 - 0
examples/Makefile.am

@@ -0,0 +1,5 @@
+SUBDIRS = simple
+
+if BUILD_OPENGL_EXAMPLE
+SUBDIRS += opengl
+endif

+ 5 - 0
examples/opengl/Makefile.am

@@ -0,0 +1,5 @@
+bin_PROGRAMS = openglexample
+AM_CPPFLAGS = -Wall -Werror -I$(top_srcdir)/include -DOHMD_STATIC $(sdl_CFLAGS) $(GLEW_CFLAGS)
+openglexample_SOURCES = gl.c main.c
+openglexample_LDADD = $(top_srcdir)/src/libopenhmd.la -lm 
+openglexample_LDFLAGS = -static-libtool-libs $(sdl_LIBS) $(GLEW_LIBS) $(GL_LIBS)

tests/opengl/gl.c → examples/opengl/gl.c


tests/opengl/gl.h → examples/opengl/gl.h


tests/opengl/main.c → examples/opengl/main.c


tests/opengl/shaders/test1.frag.glsl → examples/opengl/shaders/test1.frag.glsl


tests/opengl/shaders/test1.vert.glsl → examples/opengl/shaders/test1.vert.glsl


tests/simple/Makefile.am → examples/simple/Makefile.am


tests/simple/simple.c → examples/simple/simple.c


+ 1 - 5
tests/Makefile.am

@@ -1,5 +1 @@
-SUBDIRS = unittests simple
-
-if BUILD_OPENGL_TEST
-SUBDIRS += opengl
-endif
+SUBDIRS = unittests

+ 0 - 5
tests/opengl/Makefile.am

@@ -1,5 +0,0 @@
-bin_PROGRAMS = opengltest
-AM_CPPFLAGS = -Wall -Werror -I$(top_srcdir)/include -DOHMD_STATIC $(sdl_CFLAGS) $(GLEW_CFLAGS)
-opengltest_SOURCES = gl.c main.c
-opengltest_LDADD = $(top_srcdir)/src/libopenhmd.la -lm 
-opengltest_LDFLAGS = -static-libtool-libs $(sdl_LIBS) $(GLEW_LIBS) $(GL_LIBS)