Move more things to the lib tool
This commit is contained in:
parent
e0f3f0a2b4
commit
bd7a79c9e1
2 changed files with 17 additions and 15 deletions
|
@ -2,7 +2,6 @@
|
||||||
# Eryn Wells <eryn@erynwells.me>
|
# Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import SCons.Environment
|
import SCons.Environment
|
||||||
|
@ -146,20 +145,6 @@ class Environment(SCons.Environment.Environment):
|
||||||
'''Return the main source root directory for this environment.'''
|
'''Return the main source root directory for this environment.'''
|
||||||
return self['SRC_ROOT']
|
return self['SRC_ROOT']
|
||||||
|
|
||||||
@property
|
|
||||||
def lib_dirs(self):
|
|
||||||
for lib in os.listdir(self['LIB_ROOT'].abspath):
|
|
||||||
lib_dir = self['LIB_ROOT'].Dir(lib)
|
|
||||||
if not lib_dir.isdir():
|
|
||||||
continue
|
|
||||||
yield (lib, lib_dir)
|
|
||||||
|
|
||||||
def process_lib_dirs(self):
|
|
||||||
self.log('Processing libs in #{} ...'.format(self.lib_root.path))
|
|
||||||
for name, lib in self.lib_dirs:
|
|
||||||
self.log(' - {}'.format(name))
|
|
||||||
self.LibDir(name)
|
|
||||||
|
|
||||||
def process_src(self):
|
def process_src(self):
|
||||||
out_dir = self.build_root.Dir('src')
|
out_dir = self.build_root.Dir('src')
|
||||||
# TODO: Do the thing.
|
# TODO: Do the thing.
|
||||||
|
|
|
@ -5,9 +5,12 @@
|
||||||
SCons builder for a lib directory.
|
SCons builder for a lib directory.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
import SCons.Errors
|
import SCons.Errors
|
||||||
import SCons.Script
|
import SCons.Script
|
||||||
|
|
||||||
|
|
||||||
def _lib(env, name):
|
def _lib(env, name):
|
||||||
return env['LIBS'].get(name)
|
return env['LIBS'].get(name)
|
||||||
|
|
||||||
|
@ -18,6 +21,19 @@ def _register_lib(env, name, lib):
|
||||||
env['LIBS'][name] = lib
|
env['LIBS'][name] = lib
|
||||||
|
|
||||||
|
|
||||||
|
def _lib_dirs(env):
|
||||||
|
for lib in os.listdir(env.lib_root.abspath):
|
||||||
|
lib_dir = env.lib_root.Dir(lib)
|
||||||
|
if not lib_dir.isdir():
|
||||||
|
continue
|
||||||
|
yield (lib, lib_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def _process_lib_dirs(env):
|
||||||
|
for name, _ in _lib_dirs(env):
|
||||||
|
env.LibDir(name)
|
||||||
|
|
||||||
|
|
||||||
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:
|
||||||
src_dir = env.lib_root.Dir(lib)
|
src_dir = env.lib_root.Dir(lib)
|
||||||
|
@ -64,6 +80,7 @@ def generate(env):
|
||||||
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')
|
env.AddMethod(_lib, 'lib')
|
||||||
|
env.AddMethod(_process_lib_dirs, 'process_lib_dirs')
|
||||||
|
|
||||||
def exists(env):
|
def exists(env):
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue