Move lib environment methods to the lib tool
This commit is contained in:
parent
9031c61ad7
commit
c9e28a2bff
2 changed files with 11 additions and 13 deletions
|
@ -154,10 +154,6 @@ class Environment(SCons.Environment.Environment):
|
||||||
continue
|
continue
|
||||||
yield (lib, lib_dir)
|
yield (lib, lib_dir)
|
||||||
|
|
||||||
#
|
|
||||||
# Library processing
|
|
||||||
#
|
|
||||||
|
|
||||||
def process_lib_dirs(self):
|
def process_lib_dirs(self):
|
||||||
self.log('Processing libs in #{} ...'.format(self.lib_root.path))
|
self.log('Processing libs in #{} ...'.format(self.lib_root.path))
|
||||||
for name, lib in self.lib_dirs:
|
for name, lib in self.lib_dirs:
|
||||||
|
@ -170,14 +166,6 @@ class Environment(SCons.Environment.Environment):
|
||||||
# do_sconscript(env, env.source_root, src_out_dir)
|
# do_sconscript(env, env.source_root, src_out_dir)
|
||||||
self.Append(CPPPATH=[self.src_root])
|
self.Append(CPPPATH=[self.src_root])
|
||||||
|
|
||||||
def lib(self, name):
|
|
||||||
return self['LIBS'].get(name)
|
|
||||||
|
|
||||||
def register_lib(self, name, lib):
|
|
||||||
if name in self['LIBS']:
|
|
||||||
self.log_error('Library has already been built: {}'.format(name))
|
|
||||||
self['LIBS'][name] = lib
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test processing
|
# Test processing
|
||||||
#
|
#
|
||||||
|
|
|
@ -8,6 +8,15 @@ SCons builder for a lib directory.
|
||||||
import SCons.Errors
|
import SCons.Errors
|
||||||
import SCons.Script
|
import SCons.Script
|
||||||
|
|
||||||
|
def _lib(env, name):
|
||||||
|
return env['LIBS'].get(name)
|
||||||
|
|
||||||
|
|
||||||
|
def _register_lib(env, name, lib):
|
||||||
|
if name in env['LIBS']:
|
||||||
|
env.log_error('Library has already been built: {}'.format(name))
|
||||||
|
env['LIBS'][name] = lib
|
||||||
|
|
||||||
|
|
||||||
def _process_lib_dir(env, lib, src_dir=None, out_dir=None, inc_dir=None):
|
def _process_lib_dir(env, lib, src_dir=None, out_dir=None, inc_dir=None):
|
||||||
if not src_dir:
|
if not src_dir:
|
||||||
|
@ -39,7 +48,7 @@ def _build_library(env, lib_func):
|
||||||
|
|
||||||
def builder(env, lib_name, sources, *args, **kwargs):
|
def builder(env, lib_name, sources, *args, **kwargs):
|
||||||
lib = original_builder(lib_name, sources, *args, **kwargs)
|
lib = original_builder(lib_name, sources, *args, **kwargs)
|
||||||
env.register_lib(lib_name, lib)
|
_register_lib(env, lib_name, lib)
|
||||||
return lib
|
return lib
|
||||||
|
|
||||||
return builder
|
return builder
|
||||||
|
@ -54,6 +63,7 @@ def generate(env):
|
||||||
env.AddMethod(_build_library(env, env.Library), 'Library')
|
env.AddMethod(_build_library(env, env.Library), 'Library')
|
||||||
env.AddMethod(_build_library(env, env.StaticLibrary), 'StaticLibrary')
|
env.AddMethod(_build_library(env, env.StaticLibrary), 'StaticLibrary')
|
||||||
env.AddMethod(_build_library(env, env.SharedLibrary), 'SharedLibrary')
|
env.AddMethod(_build_library(env, env.SharedLibrary), 'SharedLibrary')
|
||||||
|
env.AddMethod(_lib, 'lib')
|
||||||
|
|
||||||
def exists(env):
|
def exists(env):
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue