SConstruct now autogenerates header
This commit is contained in:
parent
8c75d02356
commit
1a7f0d4c28
21
SConstruct
21
SConstruct
@ -5,10 +5,11 @@
|
|||||||
# James Turk (jpt2433@rit.edu)
|
# James Turk (jpt2433@rit.edu)
|
||||||
#
|
#
|
||||||
# Version:
|
# Version:
|
||||||
# $Id: SConstruct,v 1.1 2005/03/01 07:50:22 cozman Exp $
|
# $Id: SConstruct,v 1.2 2005/03/01 10:43:34 cozman Exp $
|
||||||
|
|
||||||
import os,os.path
|
import os,os.path
|
||||||
import glob
|
import glob
|
||||||
|
import string
|
||||||
|
|
||||||
subDirs = ['', 'audio', 'math', 'util', 'util/filesys']
|
subDirs = ['', 'audio', 'math', 'util', 'util/filesys']
|
||||||
libName = 'photon'
|
libName = 'photon'
|
||||||
@ -24,6 +25,14 @@ class Builder:
|
|||||||
self.incFiles = Flatten([self.getFiles(d, '*.hpp')
|
self.incFiles = Flatten([self.getFiles(d, '*.hpp')
|
||||||
for d in self.incDirs])
|
for d in self.incDirs])
|
||||||
|
|
||||||
|
def getFilesRecursive(self, path, pat):
|
||||||
|
files = glob.glob( os.path.join(path,pat) )
|
||||||
|
for item in os.walk(path):
|
||||||
|
basePath = item[0]
|
||||||
|
for subdir in item[1]:
|
||||||
|
files += glob.glob( os.path.join(basePath,subdir,pat) )
|
||||||
|
return [modf.replace(path+os.sep, '').replace(os.sep,'/') for modf in files]
|
||||||
|
|
||||||
def combine(self, prefix, dirs):
|
def combine(self, prefix, dirs):
|
||||||
"""Add a prefix to all directories"""
|
"""Add a prefix to all directories"""
|
||||||
return [os.path.join(prefix,d) for d in dirs]
|
return [os.path.join(prefix,d) for d in dirs]
|
||||||
@ -64,6 +73,15 @@ class Builder:
|
|||||||
self.env.Default(reg)
|
self.env.Default(reg)
|
||||||
return reg
|
return reg
|
||||||
|
|
||||||
|
def buildSuperHeader(self,libName):
|
||||||
|
header = file('include/'+libName+'.hpp','w')
|
||||||
|
incGuard = string.upper(libName)+'_HPP'
|
||||||
|
header.write('#ifndef '+incGuard+'\n')
|
||||||
|
header.write('#define '+incGuard+'\n\n')
|
||||||
|
for inc in self.getFilesRecursive('./include','*.hpp'):
|
||||||
|
header.write('#include "'+inc+'"\n')
|
||||||
|
header.write('\n#endif // '+incGuard+'\n')
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
BuildDir('build', 'src', duplicate=0)
|
BuildDir('build', 'src', duplicate=0)
|
||||||
self.checkDepends()
|
self.checkDepends()
|
||||||
@ -71,6 +89,7 @@ class Builder:
|
|||||||
self.namedBuild('photon', os.path.join('lib',libName), 'Library',
|
self.namedBuild('photon', os.path.join('lib',libName), 'Library',
|
||||||
default=True,
|
default=True,
|
||||||
source = self.srcFiles, CPPPATH = self.incDirs)
|
source = self.srcFiles, CPPPATH = self.incDirs)
|
||||||
|
self.buildSuperHeader(libName)
|
||||||
|
|
||||||
|
|
||||||
b = Builder(subDirs)
|
b = Builder(subDirs)
|
||||||
|
Loading…
Reference in New Issue
Block a user