Started work on CoreData.

pull/15/head
Jussi Pakkanen 12 years ago
parent 8d6a681b23
commit 7bf35b75fa
  1. 12
      backends.py
  2. 33
      coredata.py
  3. 17
      environment.py

@ -121,11 +121,11 @@ class Backend():
commands = []
commands += self.build.get_global_flags(compiler)
commands += target.get_extra_args(compiler.get_language())
if self.environment.options.buildtype != 'plain':
if self.environment.new_coredata.buildtype != 'plain':
commands += compiler.get_debug_flags()
if self.environment.options.buildtype == 'optimized':
if self.environment.new_coredata.buildtype == 'optimized':
commands += compiler.get_std_opt_flags()
if self.environment.options.coverage:
if self.environment.new_coredata.coverage:
commands += compiler.get_coverage_flags()
commands += compiler.get_std_warn_flags()
if isinstance(target, interpreter.SharedLibrary):
@ -175,7 +175,7 @@ class NinjaBackend(Backend):
self.generate_tests(outfile)
outfile.write('# Install rules\n\n')
self.generate_install(outfile)
if self.environment.options.coverage:
if self.environment.new_coredata.coverage:
outfile.write('# Coverage rules\n\n')
self.generate_coverage_rules(outfile)
outfile.write('# Suffix\n\n')
@ -231,7 +231,7 @@ class NinjaBackend(Backend):
libdir = self.environment.get_libdir()
bindir = self.environment.get_bindir()
should_strip = self.environment.options.strip
should_strip = self.environment.new_coredata.strip
for t in self.build.get_targets().values():
if t.should_install():
if isinstance(t, interpreter.Executable):
@ -454,7 +454,7 @@ class NinjaBackend(Backend):
commands += dep.get_link_flags()
dependencies = target.get_dependencies()
commands += self.build_target_link_arguments(dependencies)
if self.environment.options.coverage:
if self.environment.new_coredata.coverage:
commands += linker.get_coverage_link_flags()
if len(dependencies) == 0:
dep_targets = ''

@ -0,0 +1,33 @@
#!/usr/bin/python3 -tt
# Copyright 2012 Jussi Pakkanen
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file contains all data that must persist over multiple
# invocations of Meson. It is roughly the same thing as
# cmakecache.
class CoreData():
def __init__(self, options):
self.prefix = options.prefix
self.libdir = options.libdir
self.bindir = options.bindir
self.includedir = options.includedir
self.datadir = options.datadir
self.mandir = options.mandir
self.backend = options.backend
self.buildtype = options.buildtype
self.strip = options.strip
self.coverage = options.coverage

@ -15,6 +15,7 @@
# limitations under the License.
import subprocess, os.path
import coredata
build_filename = 'meson.build'
@ -232,10 +233,12 @@ class Environment():
self.source_dir = source_dir
self.build_dir = build_dir
self.meson_script_file = main_script_file
self.options = options
self.scratch_dir = os.path.join(build_dir, 'meson-private')
os.makedirs(self.scratch_dir, exist_ok=True)
self.old_coredata = coredata.CoreData(options) # FIXME: read from disk
self.new_coredata = coredata.CoreData(self.old_coredata)
self.default_c = ['cc']
self.default_cxx = ['c++']
self.default_static_linker = ['ar']
@ -356,22 +359,22 @@ class Environment():
return self.object_suffix
def get_prefix(self):
return self.options.prefix
return self.new_coredata.prefix
def get_libdir(self):
return self.options.libdir
return self.new_coredata.libdir
def get_bindir(self):
return self.options.bindir
return self.new_coredata.bindir
def get_includedir(self):
return self.options.includedir
return self.new_coredata.includedir
def get_mandir(self):
return self.options.mandir
return self.new_coredata.mandir
def get_datadir(self):
return self.options.datadir
return self.new_coredata.datadir
class Dependency():
def __init__(self):

Loading…
Cancel
Save