aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonmain.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-05-13 10:36:58 -0400
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-06-06 20:02:37 +0000
commit5af98d16b93139f11f8b42cc0c4d613548dd1d69 (patch)
tree00ca08712ece3f064cd9ae4117681f73929f96c2 /mesonbuild/mesonmain.py
parent218ed2de89c3729e9d8d6a5d8e80e0a9461714ca (diff)
downloadmeson-5af98d16b93139f11f8b42cc0c4d613548dd1d69.zip
meson-5af98d16b93139f11f8b42cc0c4d613548dd1d69.tar.gz
meson-5af98d16b93139f11f8b42cc0c4d613548dd1d69.tar.bz2
Delay backend creation until project() is parsed
The project() function could have a different value for the backend option in its default_options kwargs. Also set backend options, passing them in command line had no effect previously.
Diffstat (limited to 'mesonbuild/mesonmain.py')
-rw-r--r--mesonbuild/mesonmain.py32
1 files changed, 5 insertions, 27 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index f7a57d8..50a8c7e 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -148,30 +148,8 @@ class MesonApp:
else:
mlog.log('Build type:', mlog.bold('native build'))
b = build.Build(env)
- if self.options.backend == 'ninja':
- from .backend import ninjabackend
- g = ninjabackend.NinjaBackend(b)
- elif self.options.backend == 'vs':
- from .backend import vs2010backend
- g = vs2010backend.autodetect_vs_version(b)
- env.coredata.set_builtin_option('backend', g.name)
- mlog.log('Auto detected Visual Studio backend:', mlog.bold(g.name))
- elif self.options.backend == 'vs2010':
- from .backend import vs2010backend
- g = vs2010backend.Vs2010Backend(b)
- elif self.options.backend == 'vs2015':
- from .backend import vs2015backend
- g = vs2015backend.Vs2015Backend(b)
- elif self.options.backend == 'vs2017':
- from .backend import vs2017backend
- g = vs2017backend.Vs2017Backend(b)
- elif self.options.backend == 'xcode':
- from .backend import xcodebackend
- g = xcodebackend.XCodeBackend(b)
- else:
- raise RuntimeError('Unknown backend "%s".' % self.options.backend)
- intr = interpreter.Interpreter(b, g)
+ intr = interpreter.Interpreter(b)
if env.is_cross_build():
mlog.log('Host machine cpu family:', mlog.bold(intr.builtin['host_machine'].cpu_family_method([], {})))
mlog.log('Host machine cpu:', mlog.bold(intr.builtin['host_machine'].cpu_method([], {})))
@@ -194,14 +172,14 @@ class MesonApp:
# possible, but before build files, and if any error occurs, delete it.
cdf = env.dump_coredata()
if self.options.profile:
- fname = 'profile-{}-backend.log'.format(self.options.backend)
+ fname = 'profile-{}-backend.log'.format(intr.backend.name)
fname = os.path.join(self.build_dir, 'meson-private', fname)
- profile.runctx('g.generate(intr)', globals(), locals(), filename=fname)
+ profile.runctx('intr.backend.generate(intr)', globals(), locals(), filename=fname)
else:
- g.generate(intr)
+ intr.backend.generate(intr)
build.save(b, dumpfile)
# Post-conf scripts must be run after writing coredata or else introspection fails.
- g.run_postconf_scripts()
+ intr.backend.run_postconf_scripts()
except:
if 'cdf' in locals():
old_cdf = cdf + '.prev'