From f70989999d97e8163544857fb2a19af34a3178d1 Mon Sep 17 00:00:00 2001 From: Oliver Bock <oliver.bock@aei.mpg.de> Date: Wed, 23 Jul 2008 11:37:48 +0200 Subject: [PATCH] Added dynamic application setup option using specific Makefile targets --- src/starsphere/Makefile | 30 +++++++++++++++++++++--------- src/starsphere/Makefile.macos | 29 +++++++++++++++++++++-------- src/starsphere/Makefile.mingw | 28 ++++++++++++++++++++-------- src/starsphere/main.cpp | 11 ++++++++++- 4 files changed, 72 insertions(+), 26 deletions(-) diff --git a/src/starsphere/Makefile b/src/starsphere/Makefile index 767d266..361b9e9 100644 --- a/src/starsphere/Makefile +++ b/src/starsphere/Makefile @@ -37,7 +37,7 @@ 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 +OBJS = Starsphere.o StarsphereS5R3.o StarsphereRadio.o EinsteinS5R3Adapter.o EinsteinRadioAdapter.o starlist.o snr_list.o pulsar_list.o $(RESOURCESPEC).o DEBUGFLAGSCPP = -pg -ggdb -O0 RESOURCESPEC = resources @@ -47,20 +47,26 @@ CPPFLAGS += -I$(STARSPHERE_SRC) -I$(STARSPHERE_SRC)/../framework # primary role based tagets default: release debug: starsphere +release: clean starsphere +starsphere: starsphere_EinsteinS5R3 starsphere_EinsteinRadio 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 +release: CPPFLAGS += -D NDEBUG -O3 -Wall -Wno-switch-enum release: LDFLAGS += +starsphere_EinsteinS5R3: CPPFLAGS += -D SCIENCE_APP=EinsteinS5R3 +starsphere_EinsteinRadio: CPPFLAGS += -D SCIENCE_APP=EinsteinRadio +memcheck: CPPFLAGS += $(DEBUGFLAGSCPP) -D DEBUG_VALGRIND +callgrind: CPPFLAGS += $(DEBUGFLAGSCPP) -D DEBUG_VALGRIND # file based targets -starsphere: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS) - $(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere $(OBJS) $(LIBS) +starsphere_EinsteinS5R3: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS) + $(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere_EinsteinS5R3 $(OBJS) $(LIBS) + +starsphere_EinsteinRadio: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS) + $(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere_EinsteinRadio $(OBJS) $(LIBS) Starsphere.o: $(DEPS) $(STARSPHERE_SRC)/Starsphere.cpp $(STARSPHERE_SRC)/Starsphere.h $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/Starsphere.cpp @@ -68,9 +74,15 @@ Starsphere.o: $(DEPS) $(STARSPHERE_SRC)/Starsphere.cpp $(STARSPHERE_SRC)/Starsph StarsphereS5R3.o: $(DEPS) $(STARSPHERE_SRC)/StarsphereS5R3.cpp $(STARSPHERE_SRC)/StarsphereS5R3.h $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/StarsphereS5R3.cpp +StarsphereRadio.o: $(DEPS) $(STARSPHERE_SRC)/StarsphereRadio.cpp $(STARSPHERE_SRC)/StarsphereRadio.h + $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/StarsphereRadio.cpp + EinsteinS5R3Adapter.o: Makefile $(STARSPHERE_SRC)/EinsteinS5R3Adapter.cpp $(STARSPHERE_SRC)/EinsteinS5R3Adapter.h $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/EinsteinS5R3Adapter.cpp +EinsteinRadioAdapter.o: Makefile $(STARSPHERE_SRC)/EinsteinRadioAdapter.cpp $(STARSPHERE_SRC)/EinsteinRadioAdapter.h + $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/EinsteinRadioAdapter.cpp + starlist.o: $(DEPS) $(STARSPHERE_SRC)/starlist.C $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/starlist.C @@ -94,7 +106,7 @@ callgrind: valgrind --tool=callgrind --track-fds=yes --time-stamp=yes $(PWD)/starsphere install: - cp starsphere $(STARSPHERE_INSTALL)/bin + cp starsphere_* $(STARSPHERE_INSTALL)/bin clean: - rm -f $(RESOURCESPEC).cpp $(OBJS) starsphere + rm -f $(RESOURCESPEC).cpp $(OBJS) starsphere_* diff --git a/src/starsphere/Makefile.macos b/src/starsphere/Makefile.macos index 8627bea..fee64ee 100644 --- a/src/starsphere/Makefile.macos +++ b/src/starsphere/Makefile.macos @@ -37,7 +37,7 @@ 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 +OBJS = Starsphere.o StarsphereS5R3.o StarsphereRadio.o EinsteinS5R3Adapter.o EinsteinRadioAdapter.o starlist.o snr_list.o pulsar_list.o $(RESOURCESPEC).o DEBUGFLAGSCPP = -pg -ggdb -O0 RESOURCESPEC = resources @@ -47,19 +47,26 @@ CPPFLAGS += -I$(STARSPHERE_SRC) -I$(STARSPHERE_SRC)/../framework # primary role based tagets default: release debug: starsphere +release: clean starsphere +starsphere: starsphere_EinsteinS5R3 starsphere_EinsteinRadio 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 +release: CPPFLAGS += -D NDEBUG -O3 -Wall -Wno-switch-enum +release: LDFLAGS += +starsphere_EinsteinS5R3: CPPFLAGS += -D SCIENCE_APP=EinsteinS5R3 +starsphere_EinsteinRadio: CPPFLAGS += -D SCIENCE_APP=EinsteinRadio +memcheck: CPPFLAGS += $(DEBUGFLAGSCPP) -D DEBUG_VALGRIND +callgrind: CPPFLAGS += $(DEBUGFLAGSCPP) -D DEBUG_VALGRIND # file based targets -starsphere: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS) - $(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere $(OBJS) $(LIBS) +starsphere_EinsteinS5R3: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS) + $(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere_EinsteinS5R3 $(OBJS) $(LIBS) + +starsphere_EinsteinRadio: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS) + $(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere_EinsteinRadio $(OBJS) $(LIBS) Starsphere.o: $(DEPS) $(STARSPHERE_SRC)/Starsphere.cpp $(STARSPHERE_SRC)/Starsphere.h $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/Starsphere.cpp @@ -67,9 +74,15 @@ Starsphere.o: $(DEPS) $(STARSPHERE_SRC)/Starsphere.cpp $(STARSPHERE_SRC)/Starsph StarsphereS5R3.o: $(DEPS) $(STARSPHERE_SRC)/StarsphereS5R3.cpp $(STARSPHERE_SRC)/StarsphereS5R3.h $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/StarsphereS5R3.cpp +StarsphereRadio.o: $(DEPS) $(STARSPHERE_SRC)/StarsphereRadio.cpp $(STARSPHERE_SRC)/StarsphereRadio.h + $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/StarsphereRadio.cpp + EinsteinS5R3Adapter.o: Makefile $(STARSPHERE_SRC)/EinsteinS5R3Adapter.cpp $(STARSPHERE_SRC)/EinsteinS5R3Adapter.h $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/EinsteinS5R3Adapter.cpp +EinsteinRadioAdapter.o: Makefile $(STARSPHERE_SRC)/EinsteinRadioAdapter.cpp $(STARSPHERE_SRC)/EinsteinRadioAdapter.h + $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/EinsteinRadioAdapter.cpp + starlist.o: $(DEPS) $(STARSPHERE_SRC)/starlist.C $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/starlist.C @@ -93,7 +106,7 @@ callgrind: valgrind --tool=callgrind --track-fds=yes --time-stamp=yes $(PWD)/starsphere install: - cp starsphere $(STARSPHERE_INSTALL)/bin + cp starsphere_* $(STARSPHERE_INSTALL)/bin clean: rm -f $(RESOURCESPEC).cpp $(OBJS) starsphere diff --git a/src/starsphere/Makefile.mingw b/src/starsphere/Makefile.mingw index aabf37d..866fe56 100644 --- a/src/starsphere/Makefile.mingw +++ b/src/starsphere/Makefile.mingw @@ -37,7 +37,7 @@ CPPFLAGS += $(shell $(STARSPHERE_INSTALL)/bin/freetype-config --cflags) CPPFLAGS += -I$(STARSPHERE_INSTALL)/include/BOINC DEPS = Makefile -OBJS = Starsphere.o StarsphereS5R3.o EinsteinS5R3Adapter.o starlist.o snr_list.o pulsar_list.o $(RESOURCESPEC).o +OBJS = Starsphere.o StarsphereS5R3.o StarsphereRadio.o EinsteinS5R3Adapter.o EinsteinRadioAdapter.o starlist.o snr_list.o pulsar_list.o $(RESOURCESPEC).o DEBUGFLAGSCPP = -pg -ggdb -O0 RESOURCESPEC = resources @@ -47,20 +47,26 @@ CPPFLAGS += -I$(STARSPHERE_SRC) -I$(STARSPHERE_SRC)/../framework # primary role based tagets default: release debug: starsphere +release: clean starsphere +starsphere: starsphere_EinsteinS5R3 starsphere_EinsteinRadio 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 +release: CPPFLAGS += -D NDEBUG -O3 -Wall -Wno-switch-enum release: LDFLAGS += +starsphere_EinsteinS5R3: CPPFLAGS += -D SCIENCE_APP=EinsteinS5R3 +starsphere_EinsteinRadio: CPPFLAGS += -D SCIENCE_APP=EinsteinRadio +memcheck: CPPFLAGS += $(DEBUGFLAGSCPP) -D DEBUG_VALGRIND +callgrind: CPPFLAGS += $(DEBUGFLAGSCPP) -D DEBUG_VALGRIND # file based targets -starsphere: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS) - $(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere $(OBJS) $(LIBS) +starsphere_EinsteinS5R3: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS) + $(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere_EinsteinS5R3 $(OBJS) $(LIBS) + +starsphere_EinsteinRadio: $(DEPS) $(STARSPHERE_SRC)/main.cpp $(OBJS) + $(CXX) -g $(CPPFLAGS) $(LDFLAGS) $(STARSPHERE_SRC)/main.cpp -o starsphere_EinsteinRadio $(OBJS) $(LIBS) Starsphere.o: $(DEPS) $(STARSPHERE_SRC)/Starsphere.cpp $(STARSPHERE_SRC)/Starsphere.h $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/Starsphere.cpp @@ -68,9 +74,15 @@ Starsphere.o: $(DEPS) $(STARSPHERE_SRC)/Starsphere.cpp $(STARSPHERE_SRC)/Starsph StarsphereS5R3.o: $(DEPS) $(STARSPHERE_SRC)/StarsphereS5R3.cpp $(STARSPHERE_SRC)/StarsphereS5R3.h $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/StarsphereS5R3.cpp +StarsphereRadio.o: $(DEPS) $(STARSPHERE_SRC)/StarsphereRadio.cpp $(STARSPHERE_SRC)/StarsphereRadio.h + $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/StarsphereRadio.cpp + EinsteinS5R3Adapter.o: Makefile $(STARSPHERE_SRC)/EinsteinS5R3Adapter.cpp $(STARSPHERE_SRC)/EinsteinS5R3Adapter.h $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/EinsteinS5R3Adapter.cpp +EinsteinRadioAdapter.o: Makefile $(STARSPHERE_SRC)/EinsteinRadioAdapter.cpp $(STARSPHERE_SRC)/EinsteinRadioAdapter.h + $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/EinsteinRadioAdapter.cpp + starlist.o: $(DEPS) $(STARSPHERE_SRC)/starlist.C $(CXX) -g $(CPPFLAGS) -c $(STARSPHERE_SRC)/starlist.C @@ -94,7 +106,7 @@ callgrind: valgrind --tool=callgrind --track-fds=yes --time-stamp=yes $(PWD)/starsphere install: - cp starsphere $(STARSPHERE_INSTALL)/bin + cp starsphere_* $(STARSPHERE_INSTALL)/bin clean: rm -f $(RESOURCESPEC).cpp $(OBJS) starsphere diff --git a/src/starsphere/main.cpp b/src/starsphere/main.cpp index c49eefd..bf84e66 100644 --- a/src/starsphere/main.cpp +++ b/src/starsphere/main.cpp @@ -29,12 +29,21 @@ int main(int argc, char **argv) { + + // choose application to be build/used + GraphicsEngineFactory::Applications scienceApplication; +#ifdef SCIENCE_APP + scienceApplication = GraphicsEngineFactory::SCIENCE_APP; +#else + scienceApplication = GraphicsEngineFactory::EinsteinS5R3; +#endif + // prepare main objects WindowManager window; ResourceFactory factory; AbstractGraphicsEngine *graphics = GraphicsEngineFactory::createInstance( GraphicsEngineFactory::Starsphere, - GraphicsEngineFactory::EinsteinS5R3); + scienceApplication); if(!graphics) { cerr << "Requested graphics engine could not be found/instantiated!" << endl; -- GitLab