From c1c89facff08dae67170abcdfcb7a8e0f2ec616b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 13 Apr 2006 21:33:19 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc_samples/; revision=9878 --- checkin_notes | 8 ++++++++ uppercase/Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ uppercase/README | 5 +++++ uppercase/upper_case.C | 7 +++++++ 4 files changed, 61 insertions(+) create mode 100644 uppercase/Makefile create mode 100644 uppercase/README diff --git a/checkin_notes b/checkin_notes index 42071ebc99..def36e6926 100644 --- a/checkin_notes +++ b/checkin_notes @@ -27,3 +27,11 @@ David 12 Apr 2006 upper_case.C win_build/ upper_case.vcproj + +David 13 Apr 2006 + - got graphics to work under Linux; added a Makefile + + uppercase/ + Makefile (new) + README (new) + upper_case.C diff --git a/uppercase/Makefile b/uppercase/Makefile new file mode 100644 index 0000000000..7185417f2c --- /dev/null +++ b/uppercase/Makefile @@ -0,0 +1,41 @@ +# This should work on Linux. Modify as needed for other platforms. + +# Do this first: +# ln -s `g++ -print-file-name=libstdc++.a` +# This creates a symbolic link to the C++ library, +# which is linked statically + +CXXFLAGS = -g \ + -I ../../boinc \ + -I ../../boinc/lib \ + -I ../../boinc/api \ + -L ../../boinc/api \ + -L ../../boinc/lib \ + -L /usr/X11R6/lib \ + -L. + +LIBGLUT = /usr/local/lib/libglut.a +LIBGLU = /usr/X11R6/lib/libGLU.a +LIBJPEG = /usr/lib/libjpeg.a + +PROGS = upper_case upper_case.so + +all: $(PROGS) + +clean: + rm $(PROGS) + +# the -Wl,--export-dynamic causes the main program's symbols +# to be exported to the graphics library + +upper_case: upper_case.o + g++ $(CXXFLAGS) -Wl,--export-dynamic -o upper_case upper_case.o libstdc++.a -pthread -lboinc_api -lboinc -lboinc_graphics_lib -ldl + +upper_case.so: uc_graphics.o + g++ $(CXXFLAGS) -o upper_case.so \ + -shared -fPIC -pthread \ + uc_graphics.o \ + libstdc++.a \ + -lboinc_graphics_impl -lboinc \ + $(LIBGLUT) $(LIBGLU) $(LIBJPEG) \ + -lGL -lX11 -lXmu -lm \ diff --git a/uppercase/README b/uppercase/README new file mode 100644 index 0000000000..4280b90b95 --- /dev/null +++ b/uppercase/README @@ -0,0 +1,5 @@ +The graphics should show a bouncing ball. + +If you want a logo, put a file "logo.jpg" in this directory. + +If you want text, copy Helvetica.txf to this directory. diff --git a/uppercase/upper_case.C b/uppercase/upper_case.C index 2f6ed41692..ad3cf3f2e9 100755 --- a/uppercase/upper_case.C +++ b/uppercase/upper_case.C @@ -45,6 +45,7 @@ #ifdef BOINC_APP_GRAPHICS #include "graphics_api.h" +#include "graphics_lib.h" #endif #include "diagnostics.h" @@ -227,7 +228,13 @@ int main(int argc, char **argv) { fprintf(stderr, "APP: upper_case: starting, argc %d\n", argc); #ifdef BOINC_APP_GRAPHICS +#if defined(_WIN32) || defined(__APPLE__) retval = boinc_init_graphics(worker); +#else + setbuf(stderr, 0); + fprintf(stderr, "About to call graphics init\n"); + retval = boinc_init_graphics_lib(worker, argv[0]); +#endif if (retval) exit(retval); #else retval = boinc_init();