# HG changeset patch # User Radek Brich # Date 1207752674 -7200 # Node ID 440e1ae804594136c6cb93e2d526a86b71d69953 # Parent 07c2f80847192912238aecdd64963a249abb8f52 add many SCons targets (see DEVNOTES) make automatic model downloading work again remove Makefiles -- now obsolete and hardly maintainable diff -r 07c2f8084719 -r 440e1ae80459 DEVNOTES --- a/DEVNOTES Wed Apr 09 11:35:59 2008 +0200 +++ b/DEVNOTES Wed Apr 09 16:51:14 2008 +0200 @@ -1,3 +1,26 @@ +SCons Targets +------------- +models = local-models, download-models +local-models +download-models + +demos = python-demos, cc-demos +python-demos +cc-demos + +libs = static-lib, python-module +objs +static-lib +shared-objs +python-module + +all = no-docs, docs +no-download = libs, demos, local-models +no-docs = libs, demos, models +docs + +Default is no-docs. + Classes ------- diff -r 07c2f8084719 -r 440e1ae80459 Makefile --- a/Makefile Wed Apr 09 11:35:59 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -ROOT=$(shell pwd) -include config.mk - -nomodels: libs-float libs-double python-module demos ccdemos - -all: nomodels models - -.PHONY : all nomodels clean distclean help - -help: - @echo 'available targets:' - @echo ' all make everything' - @echo ' nomodels make everything except models' - @echo ' models download models' - @echo ' python-module build the Python module' - @echo ' demos prepare Python demos' - @echo ' ccdemos build C++ demos' - @echo ' help this help message' - @echo ' clean remove auxiliary files and executables' - @echo ' distclean remove all non-distribution files (use with care)' - @echo 'default target is nomodels' - -python-module: libs-float - $(MAKE) -C src python-module - -demos: python-module models - $(MAKE) -C demos - -ccdemos: libs-float libs-double models - $(MAKE) -C ccdemos - -models: - $(MAKE) -C models - -libs-float: - $(MAKE) -C src libs-float - -libs-double: - $(MAKE) -C src libs-double - -clean: - $(MAKE) -C src clean - $(MAKE) -C demos clean - $(MAKE) -C ccdemos clean - -distclean: clean - $(MAKE) -C demos distclean - $(MAKE) -C ccdemos distclean - $(MAKE) -C models distclean - - -# TARGETS -######### - -tests: testvector testmatrix - - -# RULES -####### - -test%: tests/%.cc - $(CXX) -o $@ tests/$*.cc $(CCFLAGS) - ./$@ - - -# DEPENDENCIES -############## - - -# library tests -testvector: tests/vector.cc src/vector.h diff -r 07c2f8084719 -r 440e1ae80459 SConstruct --- a/SConstruct Wed Apr 09 11:35:59 2008 +0200 +++ b/SConstruct Wed Apr 09 16:51:14 2008 +0200 @@ -1,13 +1,41 @@ Decider('MD5-timestamp') +import os +env = Environment(ENV = {'PATH' : os.environ['PATH']}) + +### GNU C++ Compiler +#env.Replace(CXX="g++") +#env.Append(CCFLAGS="-O3 -Wall -pipe -ffast-math -msse3 ") -# CXX=icpc -# CCFLAGS=-g -fno-strict-aliasing -I$(ROOT)/include -# -Wall | -w1 +### Intel C++ Compiler +env.Replace(CXX="icpc") +env.Append(CCFLAGS="-O3 -w1 -mtune=core2 -xT ") + +### MinGW32 +# LDFLAGS+=-lpthreadGC2 +# PY_CCFLAGS=-I"C:\Program Files\Python25\include" +# PY_LDFLAGS=-L"C:\Program Files\Python25\libs" -lpython25 + +# pthread +env.Append(CCFLAGS="-pthread ") + +# CCFLAGS=-g -fno-strict-aliasing # float: -fsingle-precision-constant # double: -DPYRIT_DOUBLE -(lib, pymodule) = SConscript('src/SConscript', build_dir='build/lib', duplicate=0) +(lib, pymodule) = SConscript('src/SConscript', build_dir='build/lib', duplicate=0, exports='env') + +SConscript('ccdemos/SConscript', build_dir='build/ccdemos', duplicate=0, exports='env lib') +SConscript('demos/SConscript', exports='pymodule') +env.Alias('demos', ['cc-demos', 'python-demos']) + +SConscript('models/SConscript') -SConscript('ccdemos/SConscript', build_dir='build/ccdemos', duplicate=0, exports='lib') -SConscript('demos/SConscript', exports='pymodule') -SConscript('models/SConscript') +env.Alias('docs', Command('docs/html', [], 'doxygen')) +env.Clean('docs', ['docs/html', 'docs/latex']) + +env.Alias('all', ['no-docs', 'docs']) +env.Alias('no-docs', ['libs', 'demos', 'models']) +env.Alias('no-download', ['libs', 'demos', 'local-models']) + +env.Alias('pyrit', 'no-download') +Default('pyrit') diff -r 07c2f8084719 -r 440e1ae80459 ccdemos/Makefile --- a/ccdemos/Makefile Wed Apr 09 11:35:59 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -ifndef $(ROOT) - ROOT=$(shell pwd)/.. -endif - -include $(ROOT)/config.mk - -### single precision -#RTLIBS=libs-float -#CCFLAGS+=-fsingle-precision-constant - -### double precision -RTLIBS=libs-double -CCFLAGS+=-DPYRIT_DOUBLE - - -### Rules ### -%.o: %.cc - $(CXX) -c -o $@ $(CCFLAGS) $(SDL_CCFLAGS) $< - -%: %.o - $(CXX) -o $@ $(ROOT)/bin/$(RTLIBS)/*.o $< image.o $(LDFLAGS) $(SDL_LDFLAGS) -lpng - -### Targets ### -all: realtime realtime_dragon realtime_bunny spheres_shadow textures - -realtime: realtime.o $(RTLIBS) image.o -realtime_dragon: realtime_dragon.o $(RTLIBS) image.o -realtime_bunny: realtime_bunny.o $(RTLIBS) image.o -spheres_shadow: spheres_shadow.o $(RTLIBS) image.o -textures: textures.o $(RTLIBS) image.o - -realtime.o: realtime.cc common_sdl.h -realtime_dragon.o: realtime_dragon.cc common_sdl.h common_ply.h -realtime_bunny.o: realtime_bunny.cc common_sdl.h common_ply.h -spheres_shadow.o: spheres_shadow.cc common_sdl.h -textures.o: textures.cc common_sdl.h - -libs-float: - $(MAKE) -C ../src libs-float - -libs-double: - $(MAKE) -C ../src libs-double - -image.o: image.c - $(CXX) -c -o $@ $*.c - -clean: - rm -f realtime realtime_dragon realtime_bunny spheres_shadow textures *.o - -distclean: clean - rm -rf *.png diff -r 07c2f8084719 -r 440e1ae80459 ccdemos/SConscript --- a/ccdemos/SConscript Wed Apr 09 11:35:59 2008 +0200 +++ b/ccdemos/SConscript Wed Apr 09 16:51:14 2008 +0200 @@ -1,6 +1,5 @@ -Import('lib') - -env = Environment(CPPPATH = ['.','#include'], LIBPATH='#build/lib', LIBS='pyrit') +Import('env lib') +env.Append(CPPPATH = ['.','#include'], LIBPATH='#build/lib', LIBS='pyrit') import os SDL_CCFLAGS = os.popen('sdl-config --cflags').read() @@ -8,9 +7,13 @@ sdlenv = env.Clone() sdlenv.Append(LINKFLAGS=SDL_LDFLAGS, CCFLAGS=SDL_CCFLAGS) +l = [] image_obj = env.Object('image.c', CC="$CXX") -sdlenv.Program(['realtime.cc']) -sdlenv.Program(['realtime_bunny.cc']) -sdlenv.Program(['realtime_dragon.cc']) -sdlenv.Program(['spheres_shadow.cc']+image_obj, LIBS="$LIBS:png") -sdlenv.Program(['textures.cc']+image_obj, LIBS="$LIBS:png") +l.append( image_obj ) +l.append( sdlenv.Program(['realtime.cc']) ) +l.append( sdlenv.Program(['realtime_bunny.cc']) ) +l.append( sdlenv.Program(['realtime_dragon.cc']) ) +l.append( sdlenv.Program(['spheres_shadow.cc']+image_obj, LIBS="$LIBS:png") ) +l.append( sdlenv.Program(['textures.cc']+image_obj, LIBS="$LIBS:png") ) + +env.Alias('cc-demos', l) diff -r 07c2f8084719 -r 440e1ae80459 config.mk --- a/config.mk Wed Apr 09 11:35:59 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -CXX=ccache g++ - -CCFLAGS=-g -Wall -Wno-write-strings -fno-strict-aliasing -I$(ROOT)/include -LDFLAGS= - -PY_CCFLAGS=$(shell python-config --includes) -PY_LDFLAGS=$(shell python-config --libs) - -SDL_CCFLAGS=$(shell sdl-config --cflags) -SDL_LDFLAGS=$(shell sdl-config --libs) - -ifeq ($(OS), Windows_NT) - CCFLAGS+=-DPTHREADS - LDFLAGS+=-lpthreadGC2 - PY_CCFLAGS=-I"C:\Program Files\Python25\include" - PY_LDFLAGS=-L"C:\Program Files\Python25\libs" -lpython25 - MODULENAME=raytracer.pyd -else - CCFLAGS+=-pthread -DPTHREADS -fPIC - LDFLAGS+=-pthread - MODULENAME=raytracermodule.so -endif - -# optimizations -CCFLAGS+=-O3 -pipe -ffast-math -msse3 diff -r 07c2f8084719 -r 440e1ae80459 demos/Makefile --- a/demos/Makefile Wed Apr 09 11:35:59 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -ifndef $(ROOT) - ROOT=$(shell pwd)/.. -endif - - -all: ModulePath reqs models - -ModulePath: - echo "$(ROOT)/bin/python-module" > ModulePath - -reqs: - $(MAKE) -C .. libs-float python-module - -models: - $(MAKE) -C .. models - -clean: ; - -distclean: clean - rm -f *.png - rm -f *.pyc - rm -f kdtree.obj diff -r 07c2f8084719 -r 440e1ae80459 demos/SConscript --- a/demos/SConscript Wed Apr 09 11:35:59 2008 +0200 +++ b/demos/SConscript Wed Apr 09 16:51:14 2008 +0200 @@ -8,7 +8,10 @@ 'triangles_monkey.py', 'triangles_sphere.py', 'objreader.py', 'plyreader.py', 'lworeader.py'] +l = [] for file in files: - env.Copy('#build/demos/'+file, file) + l.append( env.Copy('#build/demos/'+file, file) ) -env.Copy('#build/demos/'+str(pymodule[0]).split('/')[-1], str(pymodule[0])) +l.append( env.Copy('#build/demos/'+str(pymodule[0]).split('/')[-1], str(pymodule[0])) ) + +env.Alias('python-demos', l) diff -r 07c2f8084719 -r 440e1ae80459 models/Makefile --- a/models/Makefile Wed Apr 09 11:35:59 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -ifndef $(ROOT) - ROOT=$(shell pwd)/.. -endif - - -all: models - -models: bunny happy dragon - -bunny: - wget ftp://graphics.stanford.edu/pub/3Dscanrep/bunny.tar.gz - tar xzf bunny.tar.gz - rm bunny.tar.gz - rm -rf bunny/data - mv bunny/reconstruction/* bunny - rmdir bunny/reconstruction - -happy: - wget ftp://graphics.stanford.edu/pub/3Dscanrep/happy/happy_recon.tar.gz - tar xzf happy_recon.tar.gz - rm happy_recon.tar.gz - mv happy_recon happy - -dragon: - wget ftp://graphics.stanford.edu/pub/3Dscanrep/dragon/dragon_recon.tar.gz - tar xzf dragon_recon.tar.gz - rm dragon_recon.tar.gz - mv dragon_recon dragon - -clean: ; - -distclean: clean - rm -rf bunny - rm -rf happy - rm -rf dragon diff -r 07c2f8084719 -r 440e1ae80459 models/SConscript --- a/models/SConscript Wed Apr 09 11:35:59 2008 +0200 +++ b/models/SConscript Wed Apr 09 16:51:14 2008 +0200 @@ -2,8 +2,16 @@ env.Append(BUILDERS = {'Copy':Builder(action=Copy('$TARGET','$SOURCE'), single_source=True)}) files = ['lwo/Nissan300ZX.lwo', 'obj/cube.obj', 'obj/sphere.obj', 'obj/monkey.obj'] +l = [] for file in files: - env.Copy('#build/models/'+file, file) + l.append( env.Copy('#build/models/'+file, file) ) + +env.Alias('local-models', l) -Command(Dir('#build/models/ply/'), [], Dir('#models/').abspath+'/download-stanford $TARGET') -Clean(Dir('#build/models/ply/'), Dir('#build/models/ply/')) +plydir = Dir('#build/models/ply/') +Command(plydir, [], Dir('#models/').abspath+'/download-stanford $TARGET') +Clean(plydir, plydir) + +env.Alias('download-models', plydir) + +env.Alias('models', ['local-models', 'download-models']) diff -r 07c2f8084719 -r 440e1ae80459 src/Makefile --- a/src/Makefile Wed Apr 09 11:35:59 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -ifndef $(ROOT) - ROOT=$(shell pwd)/.. -endif - -include $(ROOT)/config.mk - -vpath %.cc $(ROOT)/src -vpath %.h $(ROOT)/include -LIBOBJS=raytracer.o scene.o sampler.o noise.o container.o kdtree.o octree.o -CCFLAGS+=-I$(ROOT)/include - -### Targets ### -all: libs-float libs-double python-module - -libs-float: - mkdir -p $(ROOT)/bin/$@ - $(MAKE) -C $(ROOT)/bin/$@ -f $(ROOT)/src/Makefile libs ROOT="$(ROOT)" CCFLAGS="$(CCFLAGS) -fsingle-precision-constant" - -libs-double: - mkdir -p $(ROOT)/bin/$@ - $(MAKE) -C $(ROOT)/bin/$@ -f $(ROOT)/src/Makefile libs ROOT="$(ROOT)" CCFLAGS="$(CCFLAGS) -DPYRIT_DOUBLE" - -libs: $(LIBOBJS) - -python-module: libs-float - mkdir -p $(ROOT)/bin/$@ - $(MAKE) -C $(ROOT)/bin/$@ -f $(ROOT)/src/Makefile $(MODULENAME) ROOT="$(ROOT)" - -$(MODULENAME): raytracermodule.o - $(CXX) -shared -o $@ $< $(ROOT)/bin/libs-float/*.o $(LDFLAGS) $(PY_LDFLAGS) - -clean: - rm -rf $(ROOT)/bin/libs-* - rm -rf $(ROOT)/bin/python-module - - -### Rules ### -%.o: %.cc - $(CXX) -c -o $@ $(CCFLAGS) $< - - -### Dependencies ### -matrix.o: matrix.cc matrix.h vector.h common.h -noise.o: noise.cc noise.h common.h -scene.o: scene.cc scene.h sampler.h vector.h noise.h common.h -sampler.o: sampler.cc sampler.h vector.h common.h -container.o: container.cc container.h scene.h common.h -kdtree.o: kdtree.cc kdtree.h scene.h common.h -octree.o: octree.cc octree.h scene.h common.h -raytracer.o: raytracer.cc raytracer.h scene.h vector.h noise.h common.h - -raytracermodule.o: raytracermodule.cc $(LIBOBJS) - $(CXX) -c -o $@ $(CCFLAGS) $(PY_CCFLAGS) $< diff -r 07c2f8084719 -r 440e1ae80459 src/SConscript --- a/src/SConscript Wed Apr 09 11:35:59 2008 +0200 +++ b/src/SConscript Wed Apr 09 16:51:14 2008 +0200 @@ -1,11 +1,11 @@ -env = Environment(CPPPATH = '#include') +Import('env') +env.Append(CPPPATH = '#include') import os PY_CCFLAGS = os.popen('python-config --includes').read() PY_LDFLAGS = os.popen('python-config --libs').read() pyenv = env.Clone() pyenv.Append(LINKFLAGS=PY_LDFLAGS, CCFLAGS=PY_CCFLAGS) -env.Append() sources = [ 'raytracer.cc', 'scene.cc', 'sampler.cc', @@ -24,4 +24,10 @@ lib = env.StaticLibrary('pyrit', objs) +env.Alias('objs', objs) +env.Alias('static-lib', lib) +env.Alias('shared-objs', shared_objs) +env.Alias('python-module', pymodule) +env.Alias('libs', ['static-lib', 'python-module']) + Return('lib pymodule')