How to create BOINC ApplicationsSee also: Creating and Configuring a BOINC Project
Last modified: 12 September 2011
These notes tell you how to set up the build environment and build several sample applications:
- Building BOINC applications on Windows
- Building BOINC and BOINC Applications on Linux
- Building BOINC and BOINC applications on MacOS X
If you have your build environment setup and working on Linux or Mac you can verify that everything is working well using a script I've written to automatically check out the latest code and build BOINC:
BOINC ApplicationsThe easiest way to learn to write your own BOINC application is to work your way through the examples listed below. Two of the examples come with the BOINC distribution, concat and upper_case. I have written the others as I have myself learned more and more about creating BOINC applications. I hope the notes are useful, at least for getting someone started.
- Hello, World -- the simplest BOINC program
- concat - concatenates two or more input files into one output file (from BOINC, no graphics) See boinc/apps.
- Yello, World -- the simplest graphics program for BOINC,
- cube - simplest non-trivial 3D graphics application for BOINC
- uppercase - reads text from a file, converting it to upper case. (from BOINC, with graphics) See boinc_samples/uppercase. (Do not confuse this with boinc/apps/upper_case, which is a bare-bones application which is used by the test_uc.py script.)
- The Jack LaLanne program - an API Exerciser
- The 'scroll' application for Pirates@Home - a pathological but interesting example of what not to do. You could skip over this and perhaps come out the better for it.
- The "Sicilian Roulette" application for BOINC - a test of error codes. Skip this too unless you find it interesting.
- Sextant - the Einstein@Home screensaver graphics thread, with some fancy additional features
- Starboard! - xscreensaver GL graphics suite
Spy Hill examples: The source code for many of the example programs is availible either as a tarball (here), or via CVS:cvs -d :pserver:firstname.lastname@example.org/usr/local/cvsroot/boinc checkout src/apps
BOINC examples: The source code for the BOINC sample application "concat" is in the BOINC source distribtuion in boinc/apps, while 'uppercase' is in the separate "boinc_samples" collection, in boinc_samples/uppercase. The "upper_case" program in boinc/apps (not the slight name difference) is for elementary testing of a project installation and is not a full working application. [No longer true! boinc_samples has been merged back into the main boinc SVN. This needs to be updated.]
BOINC GraphicsBOINC graphics are programmed in OpenGL, and use GLUT (the GL Utilities Toolkit), at least on on Linux and Mac. You can easily test your graphics running the graphics application in "standalone" mode.
- The Red Book: OpenGL Programming Guide (Fourth Edition) - The Official Guide to Learning OpenGL, version 1.4, by Dave Shreiner, Mason Woo, Jackie Neider, and Tom Davis (Addison Wesley, 2004).
OpenGL Code Samples from opengl.org Insights on OpenGL for MacOS X. Porting to OpenGL for Windows (from MSDN) OpenGL FAQ 5: Microsoft Windows Specifics
GLUT (GL Utility Toolkit)BOINC does not use the full GLUT API, but it does borrow some functionality and functions. The amount of GLUT in BOINC is different on different platforms. On Windows GLUT is used just for fonts. On Linux GLUT is also used to open windows and so the Linux version of BOINC is more dependent on GLUT than the Windows version. (I will try to fill in more details later...)
Here are some useful links for GLUT:
- GLUT API (in HTML form)
- Source code and documentation for freeglut from SourceForge. I've used freeglut with good success on Windows. It should also work for Linux.
- GLUT 3.7 source code for Windows (from Nate Robins)
- Apple GLUT basics for MacOS X.
JPEG LibraryThere are various versions of the JPEG code or at least headers available on the net or through different software distributions. You cannot go wrong by building the libraries yourself from the canonical sources, though it may take some extra effort. The library may be either static or dynamic, and you can now also build BOINC with SANS_JPEG to exclude dependence on the JPEG library (I've not yet tested this).
On Windows I built the JPEG library from the source here, and I created Solution and Project files for this which others can use:
On Linux you may already have the JPEG library installed on your system, though you need to use the "developer" package, which includes the proper headers. That is, you need the libjpeg-devel package, not just libjpeg. The library installed by this package may be either static or dynamic. I found that in Fedora Core 4 the library is static (libjpeg.a) while in Fedora Core 5 it is dynamic (libjpeg.so). Either will do, but you may have to adjust the Makefile for your application to use a dynamic library.
- Source code zip file for JPEG library for Windows: ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/jpegsr6.zip
- "Solution" and "Project" files to build the JPEG library version 6b using MS Visual C++ 7:
The one problem with using a dynamic library is that the executable will fail on a client computer where the dynamic library is unavailable. To avoid this you can build the static library from source if it is not available on your build machine. Doing so is easy:
I see no compelling reason to prefer use of a dynamic version of the JPEG library, while there is a good reason to link statically.
- Obtain the source code tarball for JPEG libary for Unix from the Independent JPEG Group. Go to http://www.ijg.org/files and get the file jpegsrc.v6b.tar.gz
- Unpack the tarball, `cd` into the subdirectory, and give the commands `./configure` and `make`.
- To install the library in /usr/local/bin (the default location) give the command `make install-lib`. (Just saying `make install` installs supporting programs and man pages, but not the library.)
On Mac you can get a pre-built version of the JPEG library via Fink, or you can build the static library from source, as just described above. (It may also be included as Framework in XCode, but I'm not yet sure of that.)
|http:// pirates.spy-hill.net /help/BOINC_Apps.html||Last modified: 12 September 2011|