diff options
-rw-r--r-- | docs/markdown/Reference-manual.md | 2 | ||||
-rw-r--r-- | docs/markdown/Release-notes-for-0.43.0.md | 2 | ||||
-rw-r--r-- | docs/markdown/Release-notes-for-0.44.0.md | 12 | ||||
-rw-r--r-- | mesonbuild/compilers/compilers.py | 5 | ||||
-rw-r--r-- | mesonbuild/environment.py | 2 | ||||
-rwxr-xr-x | run_unittests.py | 19 | ||||
-rw-r--r-- | test cases/objc/6 c++ project objc subproject/master.cpp | 11 | ||||
-rw-r--r-- | test cases/objc/6 c++ project objc subproject/meson.build | 6 | ||||
-rw-r--r-- | test cases/objc/6 c++ project objc subproject/subprojects/foo/foo.m | 4 | ||||
-rw-r--r-- | test cases/objc/6 c++ project objc subproject/subprojects/foo/meson.build | 5 |
10 files changed, 59 insertions, 9 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index f797da1..14c931d 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -483,7 +483,7 @@ Keyword arguments are the following: then use the `.found()` method on the returned object to check whether it was found or not. -- `native` defines how this executable should be searched. By default +- `native` *(since 0.43)* defines how this executable should be searched. By default it is set to `false`, which causes Meson to first look for the executable in the cross file (when cross building) and if it is not defined there, then from the system. If set to `true`, the cross diff --git a/docs/markdown/Release-notes-for-0.43.0.md b/docs/markdown/Release-notes-for-0.43.0.md index 3f981e8..7702f3c 100644 --- a/docs/markdown/Release-notes-for-0.43.0.md +++ b/docs/markdown/Release-notes-for-0.43.0.md @@ -1,6 +1,6 @@ --- title: Release 0.43 -short-description: Release notes for 0.43 (preliminary) +short-description: Release notes for 0.43 ... # Portability improvements to Boost Dependency diff --git a/docs/markdown/Release-notes-for-0.44.0.md b/docs/markdown/Release-notes-for-0.44.0.md index 93e224d..56956d7 100644 --- a/docs/markdown/Release-notes-for-0.44.0.md +++ b/docs/markdown/Release-notes-for-0.44.0.md @@ -71,10 +71,12 @@ Added a new keyword argument to the `subdir` command. It is given a list of dependency objects and the function will only recurse in the subdirectory if they are all found. Typical usage goes like this. - d1 = dependency('foo') # This is found - d2 = dependency('bar') # This is not found +```meson +d1 = dependency('foo') # This is found +d2 = dependency('bar') # This is not found - subdir('somedir', if_found : [d1, d2]) +subdir('somedir', if_found : [d1, d2]) +``` In this case the subdirectory would not be entered since `d2` could not be found. @@ -138,6 +140,8 @@ Meson now ships an internal version of Python in the MSI installer packages. This means that it can run Python scripts that are part of your build transparently. That is, if you do the following: - myprog = find_program('myscript.py') +```meson +myprog = find_program('myscript.py') +``` Then Meson will run the script with its internal Python version if necessary. diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 24ae3c9..b14074b 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -49,7 +49,7 @@ cpp_suffixes = lang_suffixes['cpp'] + ('h',) c_suffixes = lang_suffixes['c'] + ('h',) # List of languages that can be linked with C code directly by the linker # used in build.py:process_compilers() and build.py:get_dynamic_linker() -clike_langs = ('objcpp', 'objc', 'd', 'cpp', 'c', 'fortran',) +clike_langs = ('d', 'objcpp', 'cpp', 'objc', 'c', 'fortran',) clike_suffixes = () for _l in clike_langs: clike_suffixes += lang_suffixes[_l] @@ -871,6 +871,9 @@ class Compiler: args += ['-Wl,-rpath-link,' + lpaths] return args + def thread_flags(self, env): + return [] + GCC_STANDARD = 0 GCC_OSX = 1 diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 858d31d..0c9a2f3 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -608,6 +608,7 @@ class Environment: p, out, err = Popen_safe(compiler + arg) except OSError as e: popen_exceptions[' '.join(compiler + arg)] = e + continue version = search_version(out) if 'Free Software Foundation' in out: defines = self.get_gnu_compiler_defines(compiler) @@ -634,6 +635,7 @@ class Environment: p, out, err = Popen_safe(compiler + arg) except OSError as e: popen_exceptions[' '.join(compiler + arg)] = e + continue version = search_version(out) if 'Free Software Foundation' in out: defines = self.get_gnu_compiler_defines(compiler) diff --git a/run_unittests.py b/run_unittests.py index cf229da..61ee770 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -37,7 +37,7 @@ from mesonbuild.interpreter import ObjectHolder from mesonbuild.mesonlib import is_linux, is_windows, is_osx, is_cygwin, windows_proof_rmtree from mesonbuild.mesonlib import python_command, meson_command, version_compare from mesonbuild.environment import Environment -from mesonbuild.dependencies import DependencyException +from mesonbuild.mesonlib import MesonException, EnvironmentException from mesonbuild.dependencies import PkgConfigDependency, ExternalProgram from run_tests import exe_suffix, get_fake_options @@ -1744,7 +1744,7 @@ class FailureTests(BasePlatformTests): f.write(contents) # Force tracebacks so we can detect them properly os.environ['MESON_FORCE_BACKTRACE'] = '1' - with self.assertRaisesRegex(DependencyException, match, msg=contents): + with self.assertRaisesRegex(MesonException, match, msg=contents): # Must run in-process or we'll get a generic CalledProcessError self.init(self.srcdir, extra_args=extra_args, inprocess=True) @@ -1865,6 +1865,21 @@ class FailureTests(BasePlatformTests): out, r'In subproject one: Unknown command line options: "one:two"') + def test_objc_cpp_detection(self): + ''' + Test that when we can't detect objc or objcpp, we fail gracefully. + ''' + env = Environment('', self.builddir, self.meson_command, + get_fake_options(self.prefix), []) + try: + objc = env.detect_objc_compiler(False) + objcpp = env.detect_objcpp_compiler(False) + except EnvironmentException: + code = "add_languages('objc')\nadd_languages('objcpp')" + self.assertMesonRaises(code, "Unknown compiler") + return + raise unittest.SkipTest("objc and objcpp found, can't test detection failure") + class WindowsTests(BasePlatformTests): ''' diff --git a/test cases/objc/6 c++ project objc subproject/master.cpp b/test cases/objc/6 c++ project objc subproject/master.cpp new file mode 100644 index 0000000..2f351d1 --- /dev/null +++ b/test cases/objc/6 c++ project objc subproject/master.cpp @@ -0,0 +1,11 @@ + +#include <iostream> + +extern "C" +int foo(); + +int main() { + std::cout << "Starting\n"; + std::cout << foo() << "\n"; + return 0; +} diff --git a/test cases/objc/6 c++ project objc subproject/meson.build b/test cases/objc/6 c++ project objc subproject/meson.build new file mode 100644 index 0000000..8a77ded --- /dev/null +++ b/test cases/objc/6 c++ project objc subproject/meson.build @@ -0,0 +1,6 @@ +project('master', ['cpp']) + +foo = subproject('foo') +dep = foo.get_variable('foo_dep') + +executable('master', 'master.cpp', dependencies: dep) diff --git a/test cases/objc/6 c++ project objc subproject/subprojects/foo/foo.m b/test cases/objc/6 c++ project objc subproject/subprojects/foo/foo.m new file mode 100644 index 0000000..e193b86 --- /dev/null +++ b/test cases/objc/6 c++ project objc subproject/subprojects/foo/foo.m @@ -0,0 +1,4 @@ + +int foo() { + return 42; +} diff --git a/test cases/objc/6 c++ project objc subproject/subprojects/foo/meson.build b/test cases/objc/6 c++ project objc subproject/subprojects/foo/meson.build new file mode 100644 index 0000000..2dbf8ab --- /dev/null +++ b/test cases/objc/6 c++ project objc subproject/subprojects/foo/meson.build @@ -0,0 +1,5 @@ +project('foo', ['objc']) + +l = static_library('foo', 'foo.m') + +foo_dep = declare_dependency(link_with : l) |