From 7bbf7f94ea786e41ff1364cedaf7dd5c0bbf605a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 31 Dec 2009 21:10:25 +0000 Subject: scons: Build progs together with everything else. This is a substantial reorganization, This particular commit enables: - building the progs for unices platforms - glew is now built as a shared library (it is the default, and it is inconvenient and pointless to shift away from that default) - all progs get built by default --- progs/SConscript | 38 +++++++++++++++ progs/SConstruct | 65 ------------------------- progs/demos/SConscript | 124 ++++++++++++++++++++--------------------------- progs/fp/SConscript | 15 +----- progs/glsl/SConscript | 20 +------- progs/perf/SConscript | 11 +---- progs/redbook/SConscript | 20 +------- progs/samples/SConscript | 20 +------- progs/tests/SConscript | 20 +------- progs/trivial/SConscript | 11 +---- progs/vp/SConscript | 11 +---- progs/vpglsl/SConscript | 11 +---- progs/wgl/SConscript | 14 ++---- 13 files changed, 108 insertions(+), 272 deletions(-) delete mode 100644 progs/SConstruct (limited to 'progs') diff --git a/progs/SConscript b/progs/SConscript index 66eaf9e541..3b180d00bc 100644 --- a/progs/SConscript +++ b/progs/SConscript @@ -1,5 +1,43 @@ SConscript([ 'util/SConscript', +]) + +Import('*') + +progs_env = env.Clone() + +if progs_env['platform'] == 'windows': + progs_env.Append(CPPDEFINES = ['NOMINMAX']) + progs_env.Prepend(LIBS = [ + 'winmm', + 'kernel32', + 'user32', + 'gdi32', + ]) + +# OpenGL +if progs_env['platform'] == 'windows': + progs_env.Prepend(LIBS = ['glu32', 'opengl32']) +else: + progs_env.Prepend(LIBS = ['GLU', 'GL']) + +# Glut +progs_env.Prepend(LIBS = [glut]) + +# GLEW +progs_env.Prepend(LIBS = [glew]) + +progs_env.Prepend(CPPPATH = [ + '#progs/util', +]) + +progs_env.Prepend(LIBS = [ + util, +]) + +Export('progs_env') + +SConscript([ 'demos/SConscript', 'glsl/SConscript', 'redbook/SConscript', diff --git a/progs/SConstruct b/progs/SConstruct deleted file mode 100644 index 4d268cc6d7..0000000000 --- a/progs/SConstruct +++ /dev/null @@ -1,65 +0,0 @@ -import os -import os.path -import sys - -env = Environment( - tools = ['generic'], - toolpath = ['../scons'], - ENV = os.environ, -) - - -# Use Mesa's headers and libs -if 1: - build_topdir = 'build' - build_subdir = env['platform'] - if env['machine'] != 'generic': - build_subdir += '-' + env['machine'] - if env['debug']: - build_subdir += "-debug" - if env['profile']: - build_subdir += "-profile" - build_dir = os.path.join(build_topdir, build_subdir) - - env.Append(CPPDEFINES = ['GLEW_STATIC']) - env.Append(CPPPATH = ['#../include']) - env.Append(LIBPATH = [ - '#../' + build_dir + '/glew/', - '#../' + build_dir + '/glut/glx', - ]) - - -conf = Configure(env) - -# OpenGL -if env['platform'] == 'windows': - env.Prepend(LIBS = ['glu32', 'opengl32']) -else: - env.Prepend(LIBS = ['GLU', 'GL']) - -# Glut -env['GLUT'] = False -if conf.CheckCHeader('GL/glut.h'): - if env['platform'] == 'windows': - env['GLUT_LIB'] = 'glut32' - else: - env['GLUT_LIB'] = 'glut' - env['GLUT'] = True - -# GLEW -env['GLEW'] = False -if conf.CheckCHeader('GL/glew.h'): - env['GLEW_LIB'] = 'glew' - env['GLEW'] = True - env.Prepend(LIBS = ['glew']) - -conf.Finish() - - -Export('env') - -SConscript( - 'SConscript', - build_dir = env['build'], - duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html -) diff --git a/progs/demos/SConscript b/progs/demos/SConscript index f851870bcf..742dd66f36 100644 --- a/progs/demos/SConscript +++ b/progs/demos/SConscript @@ -1,84 +1,66 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - progs = [ - 'arbfplight', - 'arbfslight', - 'arbocclude', - 'bounce', - 'clearspd', - 'copypix', - 'cubemap', - 'drawpix', - 'engine', - 'fbo_firecube', - 'fire', - 'fogcoord', - 'fplight', - 'fslight', - 'gamma', - 'gearbox', - 'gears', - 'geartrain', - 'glinfo', - 'gloss', - 'gltestperf', - 'ipers', - 'isosurf', - 'lodbias', - 'morph3d', - 'multiarb', - 'paltex', - 'pointblast', - 'ray', - 'readpix', - 'reflect', - 'renormal', - 'shadowtex', - 'singlebuffer', - 'spectex', - 'spriteblast', - 'stex3d', - 'teapot', - 'terrain', - 'tessdemo', - 'texcyl', - 'texenv', - 'textures', - 'trispd', - 'tunnel', - 'tunnel2', - 'vao_demo', - 'winpos', - 'dinoshade', - 'fbotexture', - 'projtex', + 'arbfplight', + 'arbfslight', + 'arbocclude', + 'bounce', + 'clearspd', + 'copypix', + 'cubemap', + 'drawpix', + 'engine', + 'fbo_firecube', + 'fire', + 'fogcoord', + 'fplight', + 'fslight', + 'gamma', + 'gearbox', + 'gears', + 'geartrain', + 'glinfo', + 'gloss', + 'gltestperf', + 'ipers', + 'isosurf', + 'lodbias', + 'morph3d', + 'multiarb', + 'paltex', + 'pointblast', + 'ray', + 'readpix', + 'reflect', + 'renormal', + 'shadowtex', + 'singlebuffer', + 'spectex', + 'spriteblast', + 'stex3d', + 'teapot', + 'terrain', + 'tessdemo', + 'texcyl', + 'texenv', + 'textures', + 'trispd', + 'tunnel', + 'tunnel2', + 'vao_demo', + 'winpos', + 'dinoshade', + 'fbotexture', + 'projtex', ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) -env.Program( +progs_env.Program( target = 'rain', source = [ 'rain.cxx', diff --git a/progs/fp/SConscript b/progs/fp/SConscript index a78318542c..113e11ab54 100644 --- a/progs/fp/SConscript +++ b/progs/fp/SConscript @@ -1,15 +1,4 @@ -Import('env') - -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = ['$GLUT_LIB']) +Import('*') progs = [ 'fp-tri', @@ -24,7 +13,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = [prog + '.c'], ) diff --git a/progs/glsl/SConscript b/progs/glsl/SConscript index 7a4549cd70..8f2ebcf69c 100644 --- a/progs/glsl/SConscript +++ b/progs/glsl/SConscript @@ -1,23 +1,5 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - progs = [ 'array', 'bitmap', @@ -48,7 +30,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) diff --git a/progs/perf/SConscript b/progs/perf/SConscript index a5ec9a7c2a..691478ab64 100644 --- a/progs/perf/SConscript +++ b/progs/perf/SConscript @@ -1,11 +1,4 @@ -Import('env') - -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(LIBS = ['$GLUT_LIB']) +Import('*') progs = [ 'copytex', @@ -21,7 +14,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = [ prog + '.c', diff --git a/progs/redbook/SConscript b/progs/redbook/SConscript index 242cb6647f..24d7cff1b6 100644 --- a/progs/redbook/SConscript +++ b/progs/redbook/SConscript @@ -1,23 +1,5 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - progs = [ 'aaindex', 'aapoly', @@ -85,7 +67,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) diff --git a/progs/samples/SConscript b/progs/samples/SConscript index 7a8a0d62d8..134dfa9980 100644 --- a/progs/samples/SConscript +++ b/progs/samples/SConscript @@ -1,23 +1,5 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - progs = [ 'accum', 'bitmap1', @@ -52,7 +34,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) diff --git a/progs/tests/SConscript b/progs/tests/SConscript index ae6488b3e6..e2c6538288 100644 --- a/progs/tests/SConscript +++ b/progs/tests/SConscript @@ -1,23 +1,5 @@ Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(CPPPATH = [ - '../util', -]) - -env.Prepend(LIBS = [ - util, - '$GLUT_LIB' -]) - -if env['platform'] == 'windows': - env.Append(CPPDEFINES = ['NOMINMAX']) - env.Prepend(LIBS = ['winmm']) - linux_progs = [ 'api_speed', ] @@ -140,7 +122,7 @@ progs = [ ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '.c', ) diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript index 9a1f3575bd..613383c77b 100644 --- a/progs/trivial/SConscript +++ b/progs/trivial/SConscript @@ -1,11 +1,4 @@ -Import('env') - -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(LIBS = ['$GLUT_LIB']) +Import('*') progs = [ 'clear-fbo-tex', @@ -154,7 +147,7 @@ progs = [ ] for prog in progs: - prog = env.Program( + prog = progs_env.Program( target = prog, source = prog + '.c', ) diff --git a/progs/vp/SConscript b/progs/vp/SConscript index 640c5dd847..787cb793af 100644 --- a/progs/vp/SConscript +++ b/progs/vp/SConscript @@ -1,13 +1,6 @@ -Import('env') +Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(LIBS = ['$GLUT_LIB']) - -env.Program( +progs_env.Program( target = 'vp-tris', source = ['vp-tris.c'], ) diff --git a/progs/vpglsl/SConscript b/progs/vpglsl/SConscript index 640c5dd847..787cb793af 100644 --- a/progs/vpglsl/SConscript +++ b/progs/vpglsl/SConscript @@ -1,13 +1,6 @@ -Import('env') +Import('*') -if not env['GLUT']: - Return() - -env = env.Clone() - -env.Prepend(LIBS = ['$GLUT_LIB']) - -env.Program( +progs_env.Program( target = 'vp-tris', source = ['vp-tris.c'], ) diff --git a/progs/wgl/SConscript b/progs/wgl/SConscript index 31f61676de..248cc53a8d 100644 --- a/progs/wgl/SConscript +++ b/progs/wgl/SConscript @@ -1,25 +1,17 @@ Import('*') -if env['platform'] != 'windows': +if progs_env['platform'] != 'windows': Return() -env = env.Clone() - -env.Append(LIBS = [ - 'kernel32', - 'user32', - 'gdi32', -]) - progs = [ 'sharedtex_mt', 'wglthreads', ] for prog in progs: - env.Program( + progs_env.Program( target = prog, source = prog + '/' + prog + '.c', ) -env.Program('wglinfo', ['wglinfo.c']) +progs_env.Program('wglinfo', ['wglinfo.c']) -- cgit v1.2.3