Added support for GNUStep.

pull/15/head
Jussi Pakkanen 12 years ago
parent 5174c255b2
commit 9701d4d555
  1. 50
      dependencies.py
  2. 5
      test cases/objc/2 nsstring/meson.build
  3. 10
      test cases/objc/2 nsstring/stringprog.m

@ -364,6 +364,55 @@ class Qt5Dependency(Dependency):
# Fix this to be more portable, especially to MSVC.
return ['-fPIE']
class GnuStepDependency(Dependency):
def __init__(self, kwargs):
Dependency.__init__(self)
self.modules = kwargs.get('modules', [])
self.detect()
def detect(self):
confprog = 'gnustep-config'
gp = subprocess.Popen([confprog, '--help'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
gp.communicate()
if gp.returncode != 0:
self.flags = None
if 'gui' in self.modules:
arg = '--gui-libs'
else:
arg = '--base-libs'
fp = subprocess.Popen([confprog, '--objc-flags'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
flagtxt = fp.communicate()[0].decode()
flags = flagtxt.split()
self.flags = self.filter_flags(flags)
fp = subprocess.Popen([confprog, arg],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
libtxt = fp.communicate()[0].decode()
self.libs = libtxt.split()
def filter_flags(self, flags):
"""gnustep-config returns a bunch of garbage flags such
as -O2 and so on. Drop everything that is not needed."""
result = []
for f in flags:
if f.startswith('-D') or f.startswith('-f') or \
f.startswith('-I') or f == '-pthread' or\
(f.startswith('-W') and not f == '-Wall'):
result.append(f)
return result
def found(self):
return self.flags is not None
def get_compile_flags(self):
if self.flags is None:
return []
return self.flags
def get_link_flags(self):
return self.libs
def get_dep_identifier(name, kwargs):
elements = [name]
@ -381,4 +430,5 @@ packages = {'boost': BoostDependency,
'gmock': GMockDependency,
'qt5': Qt5Dependency,
'Qt5': Qt5Dependency, # Qt people sure do love their upper case.
'gnustep': GnuStepDependency,
}

@ -0,0 +1,5 @@
project('nsstring', 'objc')
dep = find_dep('gnustep', required : true)
exe = executable('stringprog', 'stringprog.m', deps : dep)
add_test('stringtest', exe)

@ -0,0 +1,10 @@
#import<Foundation/NSString.h>
int main(int argc, char **argv) {
int result;
NSString *str = [NSString new];
result = [str length];
[str release];
return result;
}
Loading…
Cancel
Save