diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-04-06 21:48:51 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-04-06 21:48:51 +0300 |
commit | 9701d4d555d2c393e5941180c3fda33b8426a08e (patch) | |
tree | c787ca160921cddb8292bd0923ba89dafbb014a8 | |
parent | 5174c255b230d6cb1284550014acd0769194d2f4 (diff) | |
download | meson-9701d4d555d2c393e5941180c3fda33b8426a08e.zip meson-9701d4d555d2c393e5941180c3fda33b8426a08e.tar.gz meson-9701d4d555d2c393e5941180c3fda33b8426a08e.tar.bz2 |
Added support for GNUStep.
-rw-r--r-- | dependencies.py | 50 | ||||
-rw-r--r-- | test cases/objc/2 nsstring/meson.build | 5 | ||||
-rw-r--r-- | test cases/objc/2 nsstring/stringprog.m | 10 |
3 files changed, 65 insertions, 0 deletions
diff --git a/dependencies.py b/dependencies.py index 29e9a68..7ed1b9d 100644 --- a/dependencies.py +++ b/dependencies.py @@ -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, } diff --git a/test cases/objc/2 nsstring/meson.build b/test cases/objc/2 nsstring/meson.build new file mode 100644 index 0000000..9edd646 --- /dev/null +++ b/test cases/objc/2 nsstring/meson.build @@ -0,0 +1,5 @@ +project('nsstring', 'objc') + +dep = find_dep('gnustep', required : true) +exe = executable('stringprog', 'stringprog.m', deps : dep) +add_test('stringtest', exe) diff --git a/test cases/objc/2 nsstring/stringprog.m b/test cases/objc/2 nsstring/stringprog.m new file mode 100644 index 0000000..f1a2532 --- /dev/null +++ b/test cases/objc/2 nsstring/stringprog.m @@ -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; +} + |