Make extract_objects work with subdirectories.

pull/131/head
Jussi Pakkanen 10 years ago
parent 1eeec5749f
commit ff51f2196f
  1. 7
      backends.py
  2. 7
      test cases/common/25 object extraction/meson.build
  3. 3
      test cases/common/25 object extraction/src/lib.c

@ -167,11 +167,12 @@ class Backend():
targetdir = self.get_target_private_dir(extobj.target)
suffix = '.' + self.environment.get_object_suffix()
for osrc in extobj.srclist:
osrc = osrc.fname
osrc_base = osrc.fname
if not self.source_suffix_in_objs:
osrc = '.'.join(osrc.split('.')[:-1])
osrc_base = '.'.join(osrc.split('.')[:-1])
objbase = os.path.join(osrc.subdir, osrc.fname).replace('/', '_').replace('\\', '_')
objname = os.path.join(proj_dir_to_build_root,
targetdir, os.path.basename(osrc) + suffix)
targetdir, os.path.basename(objbase) + suffix)
result.append(objname)
return result

@ -3,10 +3,11 @@ project('object extraction', 'c')
if meson.is_unity()
message('Skipping extraction test because this is a Unity build.')
else
lib = shared_library('somelib', 'lib.c')
lib1 = shared_library('somelib', 'src/lib.c')
lib2 = shared_library('somelib2', 'lib.c')
obj1 = lib.extract_objects('lib.c')
obj2 = lib.extract_objects(['lib.c'])
obj1 = lib1.extract_objects('src/lib.c')
obj2 = lib2.extract_objects(['lib.c'])
e1 = executable('main 1', 'main.c', objects : obj1)
e2 = executable('main 2', 'main.c', objects : obj2)

Loading…
Cancel
Save