diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-05-24 20:04:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-24 20:04:01 +0300 |
commit | fe84a6f43fc15630fe794c9e9811af7475e864b1 (patch) | |
tree | 8ca3bcec6fb2b2bb12aed6ff5f044fb2ceb59232 | |
parent | 56b41d1c7913c540a67e4fcdcd4c48505a59f9c7 (diff) | |
parent | 50c81d267b3522e8bdd2dcc2b85c0740bea88ce2 (diff) | |
download | meson-fe84a6f43fc15630fe794c9e9811af7475e864b1.zip meson-fe84a6f43fc15630fe794c9e9811af7475e864b1.tar.gz meson-fe84a6f43fc15630fe794c9e9811af7475e864b1.tar.bz2 |
Merge pull request #1843 from alvarez86/objcxx_args
Add support for objc_args and objcpp_args
-rw-r--r-- | mesonbuild/build.py | 10 | ||||
-rw-r--r-- | test cases/objc/4 objc args/meson.build | 4 | ||||
-rw-r--r-- | test cases/objc/4 objc args/prog.m | 11 | ||||
-rw-r--r-- | test cases/objc/5 objc++ args/meson.build | 4 | ||||
-rw-r--r-- | test cases/objc/5 objc++ args/prog.mm | 16 |
5 files changed, 45 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 855c0bd..8163bca 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -28,6 +28,8 @@ known_basic_kwargs = {'install': True, 'c_pch': True, 'cpp_pch': True, 'c_args': True, + 'objc_args': True, + 'objcpp_args': True, 'cpp_args': True, 'cs_args': True, 'vala_args': True, @@ -627,6 +629,14 @@ class BuildTarget(Target): if not isinstance(valalist, list): valalist = [valalist] self.add_compiler_args('vala', valalist) + objclist = kwargs.get('objc_args', []) + if not isinstance(objclist, list): + objclist = [objclist] + self.add_compiler_args('objc', objclist) + objcpplist = kwargs.get('objcpp_args', []) + if not isinstance(objcpplist, list): + objcpplist = [objcpplist] + self.add_compiler_args('objcpp', objcpplist) fortranlist = kwargs.get('fortran_args', []) if not isinstance(fortranlist, list): fortranlist = [fortranlist] diff --git a/test cases/objc/4 objc args/meson.build b/test cases/objc/4 objc args/meson.build new file mode 100644 index 0000000..8887d96 --- /dev/null +++ b/test cases/objc/4 objc args/meson.build @@ -0,0 +1,4 @@ +project('objective c args', 'objc') + +exe = executable('prog', 'prog.m', objc_args : ['-DMESON_TEST']) +test('objective c args', exe) diff --git a/test cases/objc/4 objc args/prog.m b/test cases/objc/4 objc args/prog.m new file mode 100644 index 0000000..bfd686a --- /dev/null +++ b/test cases/objc/4 objc args/prog.m @@ -0,0 +1,11 @@ +#import<stdio.h> + +int main(int argc, char **argv) +{ +#ifdef MESON_TEST + int x = 3; +#endif + + printf("x = %d\n", x); + return 0; +} diff --git a/test cases/objc/5 objc++ args/meson.build b/test cases/objc/5 objc++ args/meson.build new file mode 100644 index 0000000..e0e34b0 --- /dev/null +++ b/test cases/objc/5 objc++ args/meson.build @@ -0,0 +1,4 @@ +project('objective c++ args', 'objcpp') + +exe = executable('prog', 'prog.mm', objcpp_args : ['-DMESON_OBJCPP_TEST']) +test('objective c++ args', exe) diff --git a/test cases/objc/5 objc++ args/prog.mm b/test cases/objc/5 objc++ args/prog.mm new file mode 100644 index 0000000..3decaf2 --- /dev/null +++ b/test cases/objc/5 objc++ args/prog.mm @@ -0,0 +1,16 @@ +#import<stdio.h> + +class TestClass +{ +}; + +int main(int argc, char **argv) +{ +#ifdef MESON_OBJCPP_TEST +int x = 1; +#endif + + printf("x = %x\n", x); + + return 0; +} |