From 0c83f8352d288134ede8f4b8854e455007ce02b7 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 5 Jun 2017 03:29:40 +0530 Subject: dependencies: Add a new class ExternalDependency This class now consolidates a lot of the logic that each external dependency was duplicating in its class definition. All external dependencies now set: * self.version * self.compile_args and self.link_args * self.is_found (if found) * self.sources * etc And the abstract ExternalDependency class defines the methods that will fetch those properties. Some classes still override that for various reasons, but those should also be migrated to properties as far as possible. Next step is to consolidate and standardize the way in which we call 'configuration binaries' such as sdl2-config, llvm-config, pkg-config, etc. Currently each class has to duplicate code involved with that even though the format is very similar. Currently only pkg-config supports multiple version requirements, and some classes don't even properly check the version requirement. That will also become easier now. --- mesonbuild/backend/backends.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/backend') diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 3044ce6..05d6e03 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -429,7 +429,7 @@ class Backend: break commands += ['--pkg', dep.name] elif isinstance(dep, dependencies.ExternalLibrary): - commands += dep.get_lang_args('vala') + commands += dep.get_link_args('vala') else: commands += dep.get_compile_args() # Qt needs -fPIC for executables -- cgit v1.1 From 130076642974e62bdda3a6bf97317323cc8331f7 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 9 Jun 2017 19:14:58 +0530 Subject: vs: Always check VSINSTALLDIR in case VisualStudioVersion is unset This happened on the CI, so it could happen on people's machines too: https://ci.appveyor.com/project/jpakkane/meson/build/2870/job/p2n70hg01vp3dkgl https://ci.appveyor.com/project/jpakkane/meson/build/2870/job/7ifh64mi1999guxt --- mesonbuild/backend/vs2010backend.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'mesonbuild/backend') diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index fafde8f..d4a7a19 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -29,26 +29,24 @@ from ..environment import Environment def autodetect_vs_version(build): vs_version = os.getenv('VisualStudioVersion', None) - if vs_version: - if vs_version == '14.0': - from mesonbuild.backend.vs2015backend import Vs2015Backend - return Vs2015Backend(build) - if vs_version == '15.0': - from mesonbuild.backend.vs2017backend import Vs2017Backend - return Vs2017Backend(build) - raise MesonException('Could not detect Visual Studio (unknown Visual Studio version: "{}")!\n' - 'Please specify the exact backend to use.'.format(vs_version)) - vs_install_dir = os.getenv('VSINSTALLDIR', None) - if not vs_install_dir: - raise MesonException('Could not detect Visual Studio (neither VisualStudioVersion nor VSINSTALLDIR set in ' - 'environment)!\nPlease specify the exact backend to use.') - + if not vs_version and not vs_install_dir: + raise MesonException('Could not detect Visual Studio: VisualStudioVersion and VSINSTALLDIR are unset!\n' + 'Are we inside a Visual Studio build environment? ' + 'You can also try specifying the exact backend to use.') + # VisualStudioVersion is set since Visual Studio 12.0, but sometimes + # vcvarsall.bat doesn't set it, so also use VSINSTALLDIR + if vs_version == '14.0' or 'Visual Studio 14' in vs_install_dir: + from mesonbuild.backend.vs2015backend import Vs2015Backend + return Vs2015Backend(build) + if vs_version == '15.0' or 'Visual Studio 17' in vs_install_dir or \ + 'Visual Studio\\2017' in vs_install_dir: + from mesonbuild.backend.vs2017backend import Vs2017Backend + return Vs2017Backend(build) if 'Visual Studio 10.0' in vs_install_dir: return Vs2010Backend(build) - - raise MesonException('Could not detect Visual Studio (unknown VSINSTALLDIR: "{}")!\n' - 'Please specify the exact backend to use.'.format(vs_install_dir)) + raise MesonException('Could not detect Visual Studio using VisualStudioVersion: {!r} or VSINSTALLDIR: {!r}!\n' + 'Please specify the exact backend to use.'.format(vs_version, vs_install_dir)) def split_o_flags_args(args): """ -- cgit v1.1 From b6b3905325884c5fd2a502d09680b5a35564f0df Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 9 Jun 2017 20:25:27 +0530 Subject: vs: Sometimes WindowsSDKVersion is unset https://ci.appveyor.com/project/jpakkane/meson/build/2871/job/ti4qpoptd5tk19sn --- mesonbuild/backend/vs2017backend.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mesonbuild/backend') diff --git a/mesonbuild/backend/vs2017backend.py b/mesonbuild/backend/vs2017backend.py index 35d56f3..fe1d7c7 100644 --- a/mesonbuild/backend/vs2017backend.py +++ b/mesonbuild/backend/vs2017backend.py @@ -24,4 +24,6 @@ class Vs2017Backend(Vs2010Backend): self.platform_toolset = 'v141' self.vs_version = '2017' # WindowsSDKVersion should be set by command prompt. - self.windows_target_platform_version = os.getenv('WindowsSDKVersion', None).rstrip('\\') + sdk_version = os.environ.get('WindowsSDKVersion', None) + if sdk_version: + self.windows_target_platform_version = sdk_version.rstrip('\\') -- cgit v1.1