be0d3f3da4
I have everything except for save() and load() written. My unittest is fairly comprehensive and tests everything implemented so far, so with any luck putting in save() and load() features will go quickly. Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
#!/usr/bin/python
|
|
import os
|
|
|
|
# Configuration variables
|
|
CONFIG_VERSION = 6.0
|
|
CONFIG_DEBUG = True
|
|
|
|
|
|
# Set up default environment
|
|
CONFIG_ENV = [ "-O2" ]
|
|
if CONFIG_DEBUG == True:
|
|
CONFIG_ENV = [ "-Wall", "-Werror", "-g", "-DCONFIG_DEBUG" ]
|
|
|
|
env = Environment( CCFLAGS = CONFIG_ENV )
|
|
env.Append(CPPPATH = os.path.abspath("include"))
|
|
env.Append(CXXCOMSTR = "C++ $TARGET")
|
|
env.Append(LINKCOMSTR = "Linking $TARGET")
|
|
|
|
|
|
# Class to store configuration data
|
|
class Config:
|
|
# Set up reasonable defaults
|
|
def __init__(self):
|
|
self.VERSION = CONFIG_VERSION
|
|
self.DEBUG = CONFIG_DEBUG
|
|
self.ENV = CONFIG_ENV
|
|
self.DATABASE = False
|
|
self.FILE = False
|
|
self.INDEX = False
|
|
self.TEST = False
|
|
|
|
def package(self, name):
|
|
env.ParseConfig("pkg-config --cflags --libs %s" % name)
|
|
|
|
def reconfigure(self):
|
|
env.Replace( CCFLAGS = self.ENV )
|
|
if self.DATABASE: env.Append( CCFLAGS = "-DCONFIG_DATABASE" )
|
|
if self.FILE: env.Append( CCFLAGS = "-DCONFIG_FILE" )
|
|
if self.TEST: env.Append( CCFLAGS = "-DCONFIG_TEST" )
|
|
|
|
def reset(self):
|
|
self.DATABASE = False
|
|
self.FILE = False
|
|
self.INDEX = False
|
|
self.TEST = False
|
|
self.reconfigure()
|
|
|
|
CONFIG = Config()
|
|
Export("env", "CONFIG")
|
|
|
|
|
|
# Import SConscript files
|
|
include = SConscript("include/Sconscript")
|
|
design = SConscript("design/Sconscript")
|
|
tests = SConscript("tests/Sconscript")
|