summaryrefslogtreecommitdiffstats
path: root/extras/autowaf.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-04-21 13:44:45 +0200
committerDavid Robillard <d@drobilla.net>2019-04-21 13:44:45 +0200
commit27c5c9327edf1bcea1bf5a74fc28603d92aaa1d1 (patch)
tree67a27eac44a1f975365ed58ae44a3cdfab6a34a3 /extras/autowaf.py
parentb074a1ef75005785ef7fadbaaaec7574ca4149ed (diff)
downloadautowaf-27c5c9327edf1bcea1bf5a74fc28603d92aaa1d1.tar.gz
autowaf-27c5c9327edf1bcea1bf5a74fc28603d92aaa1d1.tar.bz2
autowaf-27c5c9327edf1bcea1bf5a74fc28603d92aaa1d1.zip
Remove use_lib()
Instead of requiring wscripts to use a special function, this fixes set_lib_env() to set up the environment correctly so that libraries can be used in the same way as system-installed libraries.
Diffstat (limited to 'extras/autowaf.py')
-rw-r--r--extras/autowaf.py42
1 files changed, 17 insertions, 25 deletions
diff --git a/extras/autowaf.py b/extras/autowaf.py
index 8c6e258..6036e07 100644
--- a/extras/autowaf.py
+++ b/extras/autowaf.py
@@ -454,26 +454,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 +464,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):