# HG changeset patch # User John Tsiombikas # Date 1409278185 -10800 # Node ID d861e4d6850f1d5969bb7d35db0e00848cf29348 # Parent ded3d0a74e193fd01cef6359edf179acbf46ae4e added unix makefile and configure script diff -r ded3d0a74e19 -r d861e4d6850f .hgignore --- a/.hgignore Fri Aug 29 03:45:25 2014 +0300 +++ b/.hgignore Fri Aug 29 05:09:45 2014 +0300 @@ -4,6 +4,7 @@ \.so$ \.so\. \.a$ +^Makefile$ \.dll$ \.lib$ \.obj$ diff -r ded3d0a74e19 -r d861e4d6850f Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile.in Fri Aug 29 05:09:45 2014 +0300 @@ -0,0 +1,74 @@ +src = $(wildcard src/*.c) +obj = $(src:.c=.o) +dep = $(obj:.o=.d) +name = goatvr +so_major = 0 +so_minor = 1 + +ifdef use_libovr + mod_cflags += -DUSE_LIBOVR + mod_libs += -lovr +endif +ifdef use_openhmd + mod_cflags += -DUSE_OPENHMD + mod_libs += -lhmd +endif + +CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(mod_cflags) +LDFLAGS = $(mod_libs) + +lib_a = lib$(name).a +ifeq ($(shell uname -s), Darwin) + lib_so = lib$(name).dylib + shared = -dynamiclib +else + ldname = lib$(name).so + soname = lib$(name).so.$(so_major) + lib_so = lib$(name).so.$(so_major).$(so_minor) + shared = -shared -Wl,-soname=$(soname) + pic = -fPIC +endif + +.PHONY: all +$(all): $(lib_so) $(lib_a) + +$(lib_so): $(obj) + $(CC) -o $@ $(shared) $(obj) $(LDFLAGS) + +$(lib_a): $(obj) + $(AR) rcs $@ $(obj) + +-include $(dep) + +%.d: %.c + @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ + +.PHONY: clean +clean: + rm -f $(obj) $(bin) + +.PHONY: cleandep +cleandep: clean + rm -f $(dep) + +.PHONY: install +install: $(lib_so) $(lib_a) + mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib + cp src/vr.h $(DESTDIR)$(PREFIX)/include/goatvr.h + cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) + cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) + [ -n "$(soname)" ] && \ + cd $(DESTDIR)$(PREFIX)/lib && \ + ln -s $(lib_so) $(soname) && \ + ln -s $(soname) $(ldname) || \ + true + +.PHONY: uninstall +uninstall: + rm -f $(DESTDIR)$(PREFIX)/include/goatvr.h + rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) + rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) + [ -n "$(soname)" ] && \ + rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ + rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || \ + true diff -r ded3d0a74e19 -r d861e4d6850f configure --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/configure Fri Aug 29 05:09:45 2014 +0300 @@ -0,0 +1,83 @@ +#!/bin/sh + +prefix=/usr/local +opt=false +dbg=true +use_libovr=true +use_openhmd=false # not done + +while [ $# != 0 ]; do + case $1 in + --prefix=*) + value=`echo $arg | sed 's/--prefix=//'` + prefix=${value:-$prefix} + ;; + + --enable-libovr) + use_libovr=true + ;; + --disable-libovr) + use_libovr=false + ;; + + --enable-openhmd) + use_openhmd=true + ;; + --disable-openhmd) + use_openhmd=false + ;; + + --enable-opt) + opt=true + ;; + --disable-opt) + opt=false + ;; + --enable-debug) + dbg=true + ;; + --disable-debug) + dbg=false + ;; + + --help) + echo 'options:' + echo '--prefix=: installation path (default: /usr/local)' + echo '--enable-libovr: enable the Oculus SDK VR module (default)' + echo '--disable-libovr: disable the Oculus SDK VR module' + echo '--enable-openhmd: enable the OpenHMD VR module (default)' + echo '--disable-openhmd: disable the OpenHMD VR module' + echo '--enable-opt: enable optimizations' + echo '--disable-opt: disable optimizations' + echo '--enable-debug: enable debugging symbols (default)' + echo '--disable-debug: disable debugging symbols' + exit 0 + ;; + esac + shift +done + +echo 'Configuring libgoatvr...' +echo " install prefix: $prefix" +echo ' optimizations: ' `$opt && echo yes || echo no` +echo ' debug symbols: ' `$opt && echo yes || echo no` +echo ' use Oculus SDK (LibOVR): ' `$use_libovr && echo yes || echo no` +echo ' use OpenHMD: ' `$use_openhmd && echo yes || echo no` + +echo '# generated makefile, do not edit' >Makefile +echo "PREFIX = $prefix" >>Makefile +if $opt; then + echo 'opt = -O3' >>Makefile +fi +if $dbg; then + echo 'dbg = -g' >>Makefile +fi +if $use_libovr; then + echo 'use_libovr = 1' >>Makefile +fi +if $use_openhmd; then + echo 'use_openhmd = 1' >>Makefile +fi +echo '# ----------------' >>Makefile + +cat Makefile.in >>Makefile diff -r ded3d0a74e19 -r d861e4d6850f src/vr_openhmd.c --- a/src/vr_openhmd.c Fri Aug 29 03:45:25 2014 +0300 +++ b/src/vr_openhmd.c Fri Aug 29 05:09:45 2014 +0300 @@ -7,7 +7,7 @@ #include "opt.h" /* a noble spirit embiggens the framebuffer to avoid aliasing in the middle */ -#define EMBIGGEN 1.5 +#define FB_EMBIGGEN 1.5 static ohmd_context *ctx; static ohmd_device *dev;