libgoatvr
changeset 1:d861e4d6850f
added unix makefile and configure script
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 29 Aug 2014 05:09:45 +0300 |
parents | ded3d0a74e19 |
children | fc256d38257f |
files | .hgignore Makefile.in configure src/vr_openhmd.c |
diffstat | 4 files changed, 159 insertions(+), 1 deletions(-) [+] |
line diff
1.1 --- a/.hgignore Fri Aug 29 03:45:25 2014 +0300 1.2 +++ b/.hgignore Fri Aug 29 05:09:45 2014 +0300 1.3 @@ -4,6 +4,7 @@ 1.4 \.so$ 1.5 \.so\. 1.6 \.a$ 1.7 +^Makefile$ 1.8 \.dll$ 1.9 \.lib$ 1.10 \.obj$
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/Makefile.in Fri Aug 29 05:09:45 2014 +0300 2.3 @@ -0,0 +1,74 @@ 2.4 +src = $(wildcard src/*.c) 2.5 +obj = $(src:.c=.o) 2.6 +dep = $(obj:.o=.d) 2.7 +name = goatvr 2.8 +so_major = 0 2.9 +so_minor = 1 2.10 + 2.11 +ifdef use_libovr 2.12 + mod_cflags += -DUSE_LIBOVR 2.13 + mod_libs += -lovr 2.14 +endif 2.15 +ifdef use_openhmd 2.16 + mod_cflags += -DUSE_OPENHMD 2.17 + mod_libs += -lhmd 2.18 +endif 2.19 + 2.20 +CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(mod_cflags) 2.21 +LDFLAGS = $(mod_libs) 2.22 + 2.23 +lib_a = lib$(name).a 2.24 +ifeq ($(shell uname -s), Darwin) 2.25 + lib_so = lib$(name).dylib 2.26 + shared = -dynamiclib 2.27 +else 2.28 + ldname = lib$(name).so 2.29 + soname = lib$(name).so.$(so_major) 2.30 + lib_so = lib$(name).so.$(so_major).$(so_minor) 2.31 + shared = -shared -Wl,-soname=$(soname) 2.32 + pic = -fPIC 2.33 +endif 2.34 + 2.35 +.PHONY: all 2.36 +$(all): $(lib_so) $(lib_a) 2.37 + 2.38 +$(lib_so): $(obj) 2.39 + $(CC) -o $@ $(shared) $(obj) $(LDFLAGS) 2.40 + 2.41 +$(lib_a): $(obj) 2.42 + $(AR) rcs $@ $(obj) 2.43 + 2.44 +-include $(dep) 2.45 + 2.46 +%.d: %.c 2.47 + @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ 2.48 + 2.49 +.PHONY: clean 2.50 +clean: 2.51 + rm -f $(obj) $(bin) 2.52 + 2.53 +.PHONY: cleandep 2.54 +cleandep: clean 2.55 + rm -f $(dep) 2.56 + 2.57 +.PHONY: install 2.58 +install: $(lib_so) $(lib_a) 2.59 + mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib 2.60 + cp src/vr.h $(DESTDIR)$(PREFIX)/include/goatvr.h 2.61 + cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) 2.62 + cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) 2.63 + [ -n "$(soname)" ] && \ 2.64 + cd $(DESTDIR)$(PREFIX)/lib && \ 2.65 + ln -s $(lib_so) $(soname) && \ 2.66 + ln -s $(soname) $(ldname) || \ 2.67 + true 2.68 + 2.69 +.PHONY: uninstall 2.70 +uninstall: 2.71 + rm -f $(DESTDIR)$(PREFIX)/include/goatvr.h 2.72 + rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) 2.73 + rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) 2.74 + [ -n "$(soname)" ] && \ 2.75 + rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ 2.76 + rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || \ 2.77 + true
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/configure Fri Aug 29 05:09:45 2014 +0300 3.3 @@ -0,0 +1,83 @@ 3.4 +#!/bin/sh 3.5 + 3.6 +prefix=/usr/local 3.7 +opt=false 3.8 +dbg=true 3.9 +use_libovr=true 3.10 +use_openhmd=false # not done 3.11 + 3.12 +while [ $# != 0 ]; do 3.13 + case $1 in 3.14 + --prefix=*) 3.15 + value=`echo $arg | sed 's/--prefix=//'` 3.16 + prefix=${value:-$prefix} 3.17 + ;; 3.18 + 3.19 + --enable-libovr) 3.20 + use_libovr=true 3.21 + ;; 3.22 + --disable-libovr) 3.23 + use_libovr=false 3.24 + ;; 3.25 + 3.26 + --enable-openhmd) 3.27 + use_openhmd=true 3.28 + ;; 3.29 + --disable-openhmd) 3.30 + use_openhmd=false 3.31 + ;; 3.32 + 3.33 + --enable-opt) 3.34 + opt=true 3.35 + ;; 3.36 + --disable-opt) 3.37 + opt=false 3.38 + ;; 3.39 + --enable-debug) 3.40 + dbg=true 3.41 + ;; 3.42 + --disable-debug) 3.43 + dbg=false 3.44 + ;; 3.45 + 3.46 + --help) 3.47 + echo 'options:' 3.48 + echo '--prefix=<path>: installation path (default: /usr/local)' 3.49 + echo '--enable-libovr: enable the Oculus SDK VR module (default)' 3.50 + echo '--disable-libovr: disable the Oculus SDK VR module' 3.51 + echo '--enable-openhmd: enable the OpenHMD VR module (default)' 3.52 + echo '--disable-openhmd: disable the OpenHMD VR module' 3.53 + echo '--enable-opt: enable optimizations' 3.54 + echo '--disable-opt: disable optimizations' 3.55 + echo '--enable-debug: enable debugging symbols (default)' 3.56 + echo '--disable-debug: disable debugging symbols' 3.57 + exit 0 3.58 + ;; 3.59 + esac 3.60 + shift 3.61 +done 3.62 + 3.63 +echo 'Configuring libgoatvr...' 3.64 +echo " install prefix: $prefix" 3.65 +echo ' optimizations: ' `$opt && echo yes || echo no` 3.66 +echo ' debug symbols: ' `$opt && echo yes || echo no` 3.67 +echo ' use Oculus SDK (LibOVR): ' `$use_libovr && echo yes || echo no` 3.68 +echo ' use OpenHMD: ' `$use_openhmd && echo yes || echo no` 3.69 + 3.70 +echo '# generated makefile, do not edit' >Makefile 3.71 +echo "PREFIX = $prefix" >>Makefile 3.72 +if $opt; then 3.73 + echo 'opt = -O3' >>Makefile 3.74 +fi 3.75 +if $dbg; then 3.76 + echo 'dbg = -g' >>Makefile 3.77 +fi 3.78 +if $use_libovr; then 3.79 + echo 'use_libovr = 1' >>Makefile 3.80 +fi 3.81 +if $use_openhmd; then 3.82 + echo 'use_openhmd = 1' >>Makefile 3.83 +fi 3.84 +echo '# ----------------' >>Makefile 3.85 + 3.86 +cat Makefile.in >>Makefile
4.1 --- a/src/vr_openhmd.c Fri Aug 29 03:45:25 2014 +0300 4.2 +++ b/src/vr_openhmd.c Fri Aug 29 05:09:45 2014 +0300 4.3 @@ -7,7 +7,7 @@ 4.4 #include "opt.h" 4.5 4.6 /* a noble spirit embiggens the framebuffer to avoid aliasing in the middle */ 4.7 -#define EMBIGGEN 1.5 4.8 +#define FB_EMBIGGEN 1.5 4.9 4.10 static ohmd_context *ctx; 4.11 static ohmd_device *dev;