def __init__(self, platform=None, **kwargs): SConsEnvironment.__init__(self, platform=platform, tools=[]) self._targets = [] ### our build process requires that we run everything from the top level dir self.SConscriptChdir(False) ### extract our specific command line variables commandLineOptions = self.getCommandLineOptions() ### set the arch and compiler independent options, overriding ### defauls with values specified on the command line setBaseVars(self, commandLineOptions) ### now load the architecture specific defaults Arch.updateEnv(self) ### should allow for a mechanism for user to override ### architecture specific defaults. currently we can only ### handle specification of the compiler ### since our build paths depend on the arch/compiler settings ### we can only set these paths now setVersionPaths(self) ### keep the sconsign database local to each build rather ### than polluting the source tree self.SConsignFile('$BUILDVERSIONDIR/sconsign') ### for emacs compile mode SCons.Util.display("scons: Entering directory `%s'" % os.getcwd())
def __init__(self, platform=None, **kwargs): SConsEnvironment.__init__(self, platform=platform, tools=[]) self._targets = [] ### our build process requires that we run everything from the top level dir self.SConscriptChdir(False) ### extract our specific command line variables commandLineOptions = self.getCommandLineOptions() ### set the arch and compiler independent options, overriding ### defauls with values specified on the command line setBaseVars(self,commandLineOptions) ### now load the architecture specific defaults Arch.updateEnv(self) ### should allow for a mechanism for user to override ### architecture specific defaults. currently we can only ### handle specification of the compiler ### since our build paths depend on the arch/compiler settings ### we can only set these paths now setVersionPaths(self) ### keep the sconsign database local to each build rather ### than polluting the source tree self.SConsignFile('$BUILDVERSIONDIR/sconsign') ### for emacs compile mode SCons.Util.display("scons: Entering directory `%s'" % os.getcwd())
def __init__( self, _platform=None, _tools=None, toolpath=None, variables=None, parse_flags=None, **kw ): """Create a new BaseEnvironment instance.""" if _tools is None: toolset = kw.setdefault('ARGUMENTS', {}).get('toolset', os.environ.get('FREELAN_TOOLSET', 'default')) _tools = [toolset, 'astyle', 'doxygen', 'nsis', 'innosetup'] if toolpath is None: toolpath = [os.path.abspath(os.path.dirname(__file__))] self.arch = kw.setdefault('ARGUMENTS', {}).get('arch', os.environ.get('FREELAN_ARCH', platform.machine())) kw.setdefault('TARGET_ARCH', self.arch) SConsEnvironment.__init__( self, _platform, _tools, toolpath, variables, parse_flags, **kw ) self.mode = kw.setdefault('ARGUMENTS', {}).get('mode', os.environ.get('FREELAN_MODE', 'release')) self.bindir = kw.setdefault('ARGUMENTS', {}).get('bindir', os.environ.get('FREELAN_BINDIR', 'bin')) self.libdir = kw.setdefault('ARGUMENTS', {}).get('libdir', os.environ.get('FREELAN_LIBDIR', 'lib')) self.static_suffix = kw.setdefault('ARGUMENTS', {}).get('static_suffix', os.environ.get('FREELAN_STATIC_SUFFIX', '_static')) if not self.mode in ['release', 'debug']: raise ValueError('\"mode\" can be either \"release\" or \"debug\"') # Parse environment overloads if 'ENV' in kw: for key, value in kw['ENV'].items(): if key.startswith('FREELAN_ENV_'): self[key[len('FREELAN_ENV_'):]] = value if not 'CXXFLAGS' in self: self['CXXFLAGS'] = [] if not 'LINKFLAGS' in self: self['LINKFLAGS'] = [] if not 'SHLINKFLAGS' in self: self['SHLINKFLAGS'] = []
def __init__(self, **kwargs): try: tools = list(kwargs.pop("tools")) tools.append('packaging') except KeyError: tools = ['default', 'packaging'] # omero_quiet is for internal use in order to # quiet down this instance for re-use. try: self.omero_quiet = kwargs.pop("omero_quiet") except KeyError: self.omero_quiet = False # Very odd error: using ENV = os.environ, rather than # ENV = dict(os.environ) causes *sub*processes to receive a fresh # environment with registry values for PATH, LIB, etc. *pre*pended to # the variables. SConsEnvironment.__init__(self, ENV=dict(os.environ), tools=tools, **kwargs) self.Decider('MD5-timestamp')
def __init__(self, **kwargs): try: tools = list(kwargs.pop("tools")) tools.append('packaging') except KeyError: tools = ['default', 'packaging'] # omero_quiet is for internal use in order to # quiet down this instance for re-use. try: self.omero_quiet = kwargs.pop("omero_quiet") except KeyError: self.omero_quiet = False # Very odd error: using ENV = os.environ, rather than # ENV = dict(os.environ) causes *sub*processes to receive a fresh # environment with registry values for PATH, LIB, etc. *pre*pended to # the variables. SConsEnvironment.__init__(self, ENV=dict(os.environ), tools=tools, **kwargs) self.Decider('MD5-timestamp')
def __init__( self, _platform=None, _tools=None, toolpath=None, variables=None, parse_flags=None, **kw ): """Create a new BaseEnvironment instance.""" if _tools is None: toolset = kw.setdefault('ARGUMENTS', {}).get('toolset', os.environ.get('FREELAN_TOOLSET', 'default')) _tools = [toolset, 'astyle', 'doxygen', 'nsis', 'innosetup'] if toolpath is None: toolpath = [os.path.abspath(os.path.dirname(__file__))] self.arch = kw.setdefault('ARGUMENTS', {}).get('arch', os.environ.get('FREELAN_ARCH', platform.machine())) kw.setdefault('TARGET_ARCH', self.arch) SConsEnvironment.__init__( self, _platform, _tools, toolpath, variables, parse_flags, **kw ) self.mode = kw.setdefault('ARGUMENTS', {}).get('mode', os.environ.get('FREELAN_MODE', 'release')) self.bindir = kw.setdefault('ARGUMENTS', {}).get('bindir', os.environ.get('FREELAN_BINDIR', 'bin')) self.libdir = kw.setdefault('ARGUMENTS', {}).get('libdir', os.environ.get('FREELAN_LIBDIR', 'lib')) self.static_suffix = kw.setdefault('ARGUMENTS', {}).get('static_suffix', os.environ.get('FREELAN_STATIC_SUFFIX', '_static')) if not self.mode in ['release', 'debug']: raise ValueError('\"mode\" can be either \"release\" or \"debug\"') # Parse environment overloads if 'ENV' in kw: for key, value in kw['ENV'].items(): if key.startswith('FREELAN_ENV_'): self[key[len('FREELAN_ENV_'):]] = value if not 'CXXFLAGS' in self: self['CXXFLAGS'] = [] # begin openwrt, ugly hardcoded patch due to the fact exported linux env variableS cannot be converted into python arrays # => FREELAN_ENV_CXXFLAGS="-I/home/log/openwrt/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include -I/home/log/openwrt/freelan/freelan-all/libcryptoplus/include ..." self['CXXFLAGS'] = ["-I/home/log/openwrt/trunk/staging_dir/target-mips_r2_eglibc-2.13/usr/include","-I/home/log/openwrt/freelan/freelan-all/libcryptoplus/include","-I/home/log/openwrt/trunk/build_dir/target-mips_r2_eglibc-2.13/libiconv/include","-I/home/log/openwrt/freelan/freelan-all/libfscp/include","-I/home/log/openwrt/freelan/freelan-all/libasiotap/include","-I/home/log/openwrt/freelan/freelan-all/libfreelan/include"] # end openwrt if not 'LINKFLAGS' in self: self['LINKFLAGS'] = [] # begin openwrt, same ugly patch for linked libs self['LINKFLAGS'] = ["-L/home/log/openwrt/trunk/staging_dir/target-mips_r2_eglibc-2.13/usr/lib","-L/home/log/openwrt/freelan/freelan-all/libcryptoplus/lib","-L/home/log/openwrt/trunk/build_dir/target-mips_r2_eglibc-2.13/libiconv","-L/home/log/openwrt/freelan/freelan-all/libfscp/lib","-L/home/log/openwrt/freelan/freelan-all/libasiotap/lib","-L/home/log/openwrt/freelan/freelan-all/libfreelan/lib"] # end openwrt if not 'SHLINKFLAGS' in self: self['SHLINKFLAGS'] = []
def __init__(self, path=None, os_platform=None, parse_flags=None, **kw): # Variables if path: variable_file = os.path.join(path, Environment._VARIABLE_FILE) else: variable_file = Environment._VARIABLE_FILE variables = Environment._create_variables(variable_file) # Tools if sys.platform == 'win32': toolset = 'mingw' else: toolset = 'default' tools = [toolset, 'doxygen', 'astyle'] toolpath = [os.path.abspath(os.path.dirname(__file__))] # Parent constructor SConsEnvironment.__init__(self, os_platform, tools, toolpath, variables, parse_flags, **kw) self.variables_help_text = variables.GenerateHelpText(self) variables.Save(variable_file, self) self['arch'] = (self['arch'] in ['64', 'x86_64']) and '64' or '32' if not 'CXXFLAGS' in self: self['CXXFLAGS'] = [] if not 'LIBPATH' in self: self['LIBPATH'] = [] if not 'LIBS' in self: self['LIBS'] = [] if not 'SHLINKFLAGS' in self: self['SHLINKFLAGS'] = [] # Build with debug symbols or not if self['mode'] == 'debug': self['CXXFLAGS'].append('-g') else: self['CXXFLAGS'].append('-DNDEBUG') self['CXXFLAGS'] += [ '-Wall', '-Wextra', '-Werror', '-pedantic', '-Wredundant-decls', '-O3', '-Wno-uninitialized', '-Wno-long-long', '-Wshadow' ] # Members if self['arch'] == '32': self.__libdir = 'lib' elif self['arch'] == '64': self.__libdir = 'lib64' if sys.platform != 'darwin': if self['arch'] == '32': self['CXXFLAGS'].append('-m32') self['LINKFLAGS'].append('-m32') elif self['arch'] == '64': self['CXXFLAGS'].append('-m64') self['LINKFLAGS'].append('-m64') else: self['CXXFLAGS'] += ['-arch', 'i386', '-arch', 'x86_64'] if sys.platform == 'win32': self['CXXFLAGS'].append('-D_WIN32_WINNT=0x0501') self['CXXFLAGS'].append( '-isystem' + os.path.abspath(os.path.join(self['mingw_path'], 'include'))) self['CXXFLAGS'].append('-isystem' + os.path.abspath( os.path.join(self['boost_path'], 'include', 'boost-' + self['boost_version']))) self['CXXFLAGS'].append( '-isystem' + os.path.abspath(os.path.join(self['openssl_path'], 'include'))) self['LIBPATH'].append(os.path.join(self['boost_path'], 'lib')) self['LIBPATH'].append(os.path.join(self['openssl_path'], 'lib')) else: if sys.platform.startswith('freebsd'): self['CXXFLAGS'].remove('-pedantic') self['CXXFLAGS'].append('-isystem' + os.path.abspath( os.path.join(self['boost_path'], 'include'))) self['LIBPATH'].append(os.path.join(self['boost_path'], 'lib'))
def __init__( self, path=None, os_platform=None, parse_flags=None, **kw): # Variables if path: variable_file = os.path.join(path, Environment._VARIABLE_FILE) else: variable_file = Environment._VARIABLE_FILE variables = Environment._create_variables(variable_file) # Tools if sys.platform == 'win32': toolset = 'mingw' else: toolset = 'default' tools = [toolset, 'doxygen', 'astyle'] toolpath = [os.path.abspath(os.path.dirname(__file__))] # Parent constructor SConsEnvironment.__init__(self, os_platform, tools, toolpath, variables, parse_flags, **kw) self.variables_help_text = variables.GenerateHelpText(self) variables.Save(variable_file, self) self['arch'] = (self['arch'] in ['64', 'x86_64']) and '64' or '32' if not 'CXXFLAGS' in self: self['CXXFLAGS'] = [] if not 'LIBPATH' in self: self['LIBPATH'] = [] if not 'LIBS' in self: self['LIBS'] = [] if not 'SHLINKFLAGS' in self: self['SHLINKFLAGS'] = [] # Build with debug symbols or not if self['mode'] == 'debug': self['CXXFLAGS'].append('-g') else: self['CXXFLAGS'].append('-DNDEBUG') self['CXXFLAGS'] += ['-Wall', '-Wextra', '-Werror', '-pedantic', '-Wredundant-decls', '-O3', '-Wno-uninitialized', '-Wno-long-long', '-Wshadow'] # Members if self['arch'] == '32': self.__libdir = 'lib' elif self['arch'] == '64': self.__libdir = 'lib64' if sys.platform != 'darwin': if self['arch'] == '32': self['CXXFLAGS'].append('-m32') self['LINKFLAGS'].append('-m32') elif self['arch'] == '64': self['CXXFLAGS'].append('-m64') self['LINKFLAGS'].append('-m64') else: self['CXXFLAGS'] += ['-arch', 'i386', '-arch', 'x86_64'] if sys.platform == 'win32': self['CXXFLAGS'].append('-D_WIN32_WINNT=0x0501') self['CXXFLAGS'].append('-isystem' + os.path.abspath(os.path.join(self['mingw_path'], 'include'))) self['CXXFLAGS'].append('-isystem' + os.path.abspath(os.path.join(self['boost_path'], 'include', 'boost-' + self['boost_version']))) self['CXXFLAGS'].append('-isystem' + os.path.abspath(os.path.join(self['openssl_path'], 'include'))) self['LIBPATH'].append(os.path.join(self['boost_path'], 'lib')) self['LIBPATH'].append(os.path.join(self['openssl_path'], 'lib')) else: if sys.platform.startswith('freebsd'): self['CXXFLAGS'].remove('-pedantic') self['CXXFLAGS'].append('-isystem' + os.path.abspath(os.path.join(self['boost_path'], 'include'))) self['LIBPATH'].append(os.path.join(self['boost_path'], 'lib'))
def __init__(self, *args, **kwargs): additionalParams = {} additionalParams['CPPPATH'] = [] additionalParams['CPPDEFINES'] = {} additionalParams['LIBPATH'] = [] additionalParams['LIBS'] = [] additionalParams['ENV'] = os.environ kwargs.update(additionalParams) SConsEnvironment.__init__(self, *args, **kwargs) #Stores SCons file signatures self.SConsignFile() #Caches implicit dependencies self.SetOption('implicit_cache', 1) #Do not fetch files from SCCS or RCS subdirectories #Desactivated: avoid extra searches and speed up the build a little self.SourceCode('.', None) #Sets the current compiler self.currentCC = None if self.CC.isMSVC(self): self.currentCC = self.CCMSVC() #FIXME This is done for compatibility reason self.GlobalAddDefines({'WIN32' : 1}) elif self.CC.isGCC(self): self.currentCC = self.CCGCC() elif self.CC.isMinGW(self): self.currentCC = self.CCGCC() else: self.currentCC = self.CCGCC() #Build mode ('debug', 'release' or 'release-symbols') self.__buildMode = None #Parses the command line parameters self.__parseConsoleArguments() #Project name self.__projectName = None #Cannot do that here, this does not work #self.__saveCurrentBuildPath() #self.__saveCurrentSourcePath() #see WengoSetVariable() and WengoGetVariable() self.__variables = {} #Command line arguments self.__consoleArguments = {} for arg, value in ARGUMENTS.iteritems(): self.__consoleArguments[arg] = value #Aliases, see Scons.Alias() #self.__aliases = {} #By default warnings are activated self.__activeWarnings() #System library (e.g Qt, boost...) or internal library? #By default internal library self.__isSystemLibrary = False #MacOS X app template path self.__macOSXTemplatePath = None