Commit 1907bf36 authored by Oliver Bock's avatar Oliver Bock
Browse files

Implemented build target for Mac OS

* Added dedicated starsphere Makefile (symbol stripping doesn't work with g++ 4.0 on OSX, linker flags static/dynamic not supported)
* Added necessary patch for OGLFT (OpenGL header location, GLU callback convention)
* Tested on i386, using OpenGL framework (not X11)
* Also: fixed a bug in OGLFT build (link freetype library!)
parent 6b30bf8f
......@@ -225,13 +225,18 @@ build_generic()
# note: svn has no force/overwrite switch. patched files might not be updated
# patch: use fixed settings for freetype, deactivate FindFreetype
FREETYPE2_INCLUDE_DIR="$ROOT/install/include"
FREETYPE2_LIBRARIES="$ROOT/install/lib/liboglft.a"
FREETYPE2_LIBRARIES="$ROOT/install/lib/libfreetype.a"
patch CMakeLists.txt < $ROOT/patches/CMakeLists.txt.oglft.patch >> $LOGFILE 2>&1 || failure
# patch: build static lib instead of shared
cd $ROOT/3rdparty/oglft/liboglft || failure
patch CMakeLists.txt < $ROOT/patches/CMakeLists.txt.liboglft.patch >> $LOGFILE 2>&1 || failure
if [ "$1" == "$TARGET_MAC" ]; then
# patch: enable Mac OS support
patch OGLFT.h.cmake < $ROOT/patches/OGLFT.h.cmake.macos.patch >> $LOGFILE 2>&1 || failure
fi
echo "Building OGLFT..." | tee -a $LOGFILE
cd $ROOT/build/oglft || failure
# TODO: do we wanna create universal binaries on mac? If so, add -DCMAKE_OSX_ARCHITECTURES=ppc;i386
cmake -DFREETYPE2_INCLUDE_DIR="$FREETYPE2_INCLUDE_DIR" -DFREETYPE2_LIBRARIES="$FREETYPE2_LIBRARIES" $ROOT/3rdparty/oglft >> $LOGFILE 2>&1 || failure
make >> $LOGFILE 2>&1 || failure
mkdir -p $ROOT/install/include/oglft >> $LOGFILE 2>&1 || failure
......@@ -284,8 +289,12 @@ build_starsphere()
export STARSPHERE_SRC=$ROOT/src/starsphere || failure
export STARSPHERE_INSTALL=$ROOT/install || failure
cd $ROOT/build/starsphere || failure
cp $ROOT/src/starsphere/Makefile . >> $LOGFILE 2>&1 || failure
cp $ROOT/src/starsphere/*.res . >> $LOGFILE 2>&1 || failure
if [ "$1" != "$TARGET_MAC" ]; then
cp $ROOT/src/starsphere/Makefile . >> $LOGFILE 2>&1 || failure
else
cp $ROOT/src/starsphere/Makefile.macos Makefile >> $LOGFILE 2>&1 || failure
fi
make >> $LOGFILE 2>&1 || failure
make install >> $LOGFILE 2>&1 || failure
echo "Successfully built and installed Starsphere [Application]!" | tee -a $LOGFILE
......@@ -305,10 +314,8 @@ build_linux()
build_mac()
{
echo "Not yet implemented: build_mac()"
# build_generic
# build_starsphere
build_generic $TARGET_MAC || failure
build_starsphere $TARGET_MAC || failure
return 0
}
......
--- OGLFT.h.cmake
+++ OGLFT.h.cmake.new 2008-05-23 13:20:10.000000000 +0200
@@ -42,12 +42,21 @@
#include <windows.h>
#endif
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
#include <GL/gl.h>
#include <GL/glu.h>
+#endif
#ifndef OGLFT_NO_SOLID
+#ifdef __APPLE__
+#include <OpenGL/gle.h>
+#else
#include <GL/gle.h>
#endif
+#endif
#ifndef OGLFT_NO_QT
#define OGLFT_QT_VERSION @DESIRED_QT_VERSION@
@@ -97,7 +106,11 @@
};
//! Callback from GLU tessellation routines.
+#ifdef __APPLE__
+ typedef GLvoid (*GLUTessCallback)(...);
+#else
typedef void (*GLUTessCallback)();
+#endif
//! The FreeType library instance.
/*!
###########################################################################
# Copyright (C) 2008 by Oliver Bock #
# oliver.bock[AT]aei.mpg.de #
# #
# This file is part of Einstein@Home. #
# #
# Einstein@Home is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published #
# by the Free Software Foundation, version 2 of the License. #
# #
# Einstein@Home is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with Einstein@Home. If not, see <http://www.gnu.org/licenses/>. #
# #
###########################################################################
# path settings
STARSPHERE_SRC?=$(PWD)
STARSPHERE_INSTALL?=$(PWD)
# config values
CXX ?= g++
# variables
LIBS = -lframework -loglft -L$(STARSPHERE_INSTALL)/lib
LIBS += $(shell $(STARSPHERE_INSTALL)/bin/freetype-config --libs)
LIBS += -lboinc_api -lboinc -L/usr/lib
LIBS += $(shell $(STARSPHERE_INSTALL)/bin/sdl-config --static-libs)
CPPFLAGS = -I$(FRAMEWORK_INSTALL)/include
CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/sdl-config --cflags)
CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/freetype-config --cflags)
CPPFLAGS += -I$(STARSPHERE_INSTALL)/include/BOINC -I/usr/include
DEPS = Makefile
OBJS = Starsphere.o StarsphereS5R3.o EinsteinS5R3Adapter.o starlist.o snr_list.o pulsar_list.o $(RESOURCESPEC).o
DEBUGFLAGSCPP = -pg -ggdb -O0
RESOURCESPEC = resources
# TODO: GraphicsEngineFactory obviously depends on the actual implementations (here starsphere)! need to change the structure! what about plugins?
CPPFLAGS += -I$(STARSPHERE_SRC) -I$(STARSPHERE_SRC)/../framework
# primary role based tagets
default: release
debug: starsphere
memcheck: clean debug starsphere
callgrind: clean debug starsphere
release: clean starsphere
# target specific options
debug: CPPFLAGS += $(DEBUGFLAGSCPP)
memcheck: CPPFLAGS += $(DEBUGFLAGSCPP) -DDEBUG_VALGRIND
callgrind: CPPFLAGS += $(DEBUGFLAGSCPP) -DDEBUG_VALGRIND
release: CPPFLAGS += -DNDEBUG -O3 -Wall -Wno-switch-enum
# file based targets
starsphere: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS)
$(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere $(OBJS) $(LIBS)
Starsphere.o: $(DEPS) $(STARSPHERE_SRC)/Starsphere.cpp $(STARSPHERE_SRC)/Starsphere.h
$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/Starsphere.cpp
StarsphereS5R3.o: $(DEPS) $(STARSPHERE_SRC)/StarsphereS5R3.cpp $(STARSPHERE_SRC)/StarsphereS5R3.h
$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/StarsphereS5R3.cpp
EinsteinS5R3Adapter.o: Makefile $(STARSPHERE_SRC)/EinsteinS5R3Adapter.cpp $(STARSPHERE_SRC)/EinsteinS5R3Adapter.h
$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/EinsteinS5R3Adapter.cpp
starlist.o: $(DEPS) $(STARSPHERE_SRC)/starlist.C
$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/starlist.C
snr_list.o: $(DEPS) $(STARSPHERE_SRC)/snr_list.C
$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/snr_list.C
pulsar_list.o: $(DEPS) $(STARSPHERE_SRC)/pulsar_list.C
$(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/pulsar_list.C
# resource compiler
$(RESOURCESPEC).o: $(STARSPHERE_SRC)/$(RESOURCESPEC).orc
$(STARSPHERE_INSTALL)/bin/orc $(STARSPHERE_SRC)/$(RESOURCESPEC).orc $(RESOURCESPEC).cpp
$(CXX) -g $(CPPFLAGS) -c $(RESOURCESPEC).cpp -o $(RESOURCESPEC).o
# tools
memcheck:
valgrind --tool=memcheck --track-fds=yes --time-stamp=yes --log-file=$(PWD)/memcheck.out.%p --leak-check=full $(PWD)/starsphere
callgrind:
valgrind --tool=callgrind --track-fds=yes --time-stamp=yes $(PWD)/starsphere
install:
cp starsphere $(STARSPHERE_INSTALL)/bin
clean:
rm -f $(RESOURCESPEC).cpp $(OBJS) starsphere
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment