diff options
-rw-r--r-- | waflib/extras/autowaf.py | 68 | ||||
-rw-r--r-- | wscript | 7 |
2 files changed, 24 insertions, 51 deletions
diff --git a/waflib/extras/autowaf.py b/waflib/extras/autowaf.py index 8c6e258..870a69a 100644 --- a/waflib/extras/autowaf.py +++ b/waflib/extras/autowaf.py @@ -7,9 +7,6 @@ import time from waflib import Configure, ConfigSet, Build, Context, Logs, Options, Utils from waflib.TaskGen import feature, before, after -global g_is_child -g_is_child = False - NONEMPTY = -10 if sys.platform == 'win32': @@ -454,26 +451,6 @@ def append_property(obj, key, val): else: setattr(obj, key, val) -def use_lib(bld, obj, libs): - abssrcdir = os.path.abspath('.') - libs_list = libs.split() - for l in libs_list: - in_headers = l.lower() in bld.env['AUTOWAF_LOCAL_HEADERS'] - in_libs = l.lower() in bld.env['AUTOWAF_LOCAL_LIBS'] - if in_libs: - append_property(obj, 'use', ' lib%s ' % l.lower()) - append_property(obj, 'framework', bld.env['FRAMEWORK_' + l]) - if in_headers or in_libs: - if bld.env.MSVC_COMPILER: - inc_flag = '/I' + os.path.join(abssrcdir, l.lower()) - else: - inc_flag = '-iquote ' + os.path.join(abssrcdir, l.lower()) - for f in ['CFLAGS', 'CXXFLAGS']: - if inc_flag not in bld.env[f]: - bld.env.prepend_value(f, inc_flag) - else: - append_property(obj, 'uselib', ' ' + l) - @feature('c', 'cxx') @before('apply_link') def version_lib(self): @@ -484,22 +461,34 @@ def version_lib(self): if [x for x in applicable if x in self.features]: self.target = self.target + 'D' -def set_lib_env(conf, name, version, has_objects=True): +def set_lib_env(conf, + name, + version, + has_objects=True, + include_path=None, + lib_path=None): "Set up environment for local library as if found via pkg-config." NAME = name.upper() major_ver = version.split('.')[0] pkg_var_name = 'PKG_' + name.replace('-', '_') + '_' + major_ver lib_name = '%s-%s' % (name, major_ver) - lib_path = [str(conf.path.get_bld())] + + if lib_path is None: + lib_path = str(conf.path.get_bld()) + + if include_path is None: + include_path = str(conf.path) + if conf.env.PARDEBUG: lib_name += 'D' + conf.env[pkg_var_name] = lib_name - conf.env['INCLUDES_' + NAME] = ['${INCLUDEDIR}/%s-%s' % (name, major_ver)] - conf.env['LIBPATH_' + NAME] = lib_path + conf.env['INCLUDES_' + NAME] = [include_path] + conf.env['LIBPATH_' + NAME] = [lib_path] if has_objects: conf.env['LIB_' + NAME] = [lib_name] - conf.run_env.append_unique(lib_path_name, lib_path) + conf.run_env.append_unique(lib_path_name, [lib_path]) conf.define(NAME + '_VERSION', version) def display_msg(conf, msg, status=None, color=None): @@ -526,14 +515,6 @@ def compile_flags(env, lib): return ' '.join(map(lambda x: env['CPPPATH_ST'] % x, env['INCLUDES_' + lib])) -def set_recursive(): - global g_is_child - g_is_child = True - -def is_child(): - global g_is_child - return g_is_child - def build_pc(bld, name, version, version_suffix, libs, subst_dict={}): """Build a pkg-config file for a library. @@ -588,13 +569,6 @@ def build_pc(bld, name, version, version_suffix, libs, subst_dict={}): obj.__dict__.update(subst_dict) -def build_dir(name, subdir): - if is_child(): - return os.path.join('build', name, subdir) - else: - return os.path.join('build', subdir) - - def make_simple_dox(name): "Clean up messy Doxygen documentation after it is built" name = name.lower() @@ -641,12 +615,8 @@ def build_dox(bld, name, version, srcdir, blddir, outdir='', versioned=True): if not bld.env['DOCS']: return - # Doxygen paths in are relative to the doxygen file, not build directory - if is_child(): - src_dir = os.path.join(srcdir, name.lower()) - else: - src_dir = srcdir - + # Doxygen paths in are relative to the doxygen file + src_dir = bld.path.srcpath() subst_tg = bld(features='subst', source='doc/reference.doxygen.in', target='doc/reference.doxygen', @@ -94,6 +94,9 @@ def configure(conf): and not conf.is_defined('HAVE_GCOV')): conf.check_cc(lib='gcov', define_name='HAVE_GCOV', mandatory=False) + autowaf.set_lib_env(conf, 'lv2', VERSION, has_objects=False) + autowaf.set_local_lib(conf, 'lv2', has_objects=False) + if conf.env.BUILD_PLUGINS: for i in ['eg-amp.lv2', 'eg-fifths.lv2', @@ -109,8 +112,6 @@ def configure(conf): except Exception as e: Logs.warn('Configuration failed, not building %s (%s)' % (i, e)) - autowaf.set_lib_env(conf, 'lv2', VERSION, has_objects=False) - autowaf.display_summary( conf, {'Bundle directory': conf.env.LV2DIR, @@ -237,6 +238,7 @@ def build_spec(bld, path): bld(features = 'c cprogram', source = test, lib = test_lib, + uselib = 'LV2', target = os.path.splitext(str(test.get_bld()))[0], install_path = None, cflags = test_cflags, @@ -418,6 +420,7 @@ def build(bld): source = bld.path.get_bld().make_node('build-test.c'), target = 'build-test', includes = '.', + uselib = 'LV2', install_path = None) if bld.env.BUILD_BOOK: |