aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-03-20 19:35:42 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2016-03-20 19:35:42 +0200
commit79de463993fb8201edd389df1626fec841f403d6 (patch)
tree93ea418949913504a023cd8285328d820862e5c5
parent0c63f75aafd664ad4d5a478cdbd9f3e8fd582736 (diff)
downloadmeson-79de463993fb8201edd389df1626fec841f403d6.zip
meson-79de463993fb8201edd389df1626fec841f403d6.tar.gz
meson-79de463993fb8201edd389df1626fec841f403d6.tar.bz2
Converted precompiled headers into a base option.
-rw-r--r--mesonbuild/backend/ninjabackend.py6
-rw-r--r--mesonbuild/compilers.py22
-rw-r--r--mesonbuild/coredata.py2
-rw-r--r--mesonbuild/mesonmain.py2
-rw-r--r--mesonbuild/mgui.py11
-rw-r--r--mesonbuild/mintro.py6
6 files changed, 17 insertions, 32 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 8cd5139..8e8fa42 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -247,7 +247,7 @@ int dummy;
self.generate_custom_generator_rules(target, outfile)
outname = self.get_target_filename(target)
obj_list = []
- use_pch = self.environment.coredata.get_builtin_option('use_pch')
+ use_pch = self.environment.coredata.base_options.get('b_pch', False)
is_unity = self.environment.coredata.get_builtin_option('unity')
if use_pch and target.has_pch():
pch_objects = self.generate_pch(target, outfile)
@@ -1487,7 +1487,7 @@ rule FORTRAN_DEP_HACK
rel_obj = os.path.join(self.get_target_private_dir(target), obj_basename)
rel_obj += '.' + self.environment.get_object_suffix()
dep_file = compiler.depfile_for_object(rel_obj)
- if self.environment.coredata.get_builtin_option('use_pch'):
+ if self.environment.coredata.base_options.get('b_pch', False):
pchlist = target.get_pch(compiler.language)
else:
pchlist = []
@@ -1506,7 +1506,7 @@ rule FORTRAN_DEP_HACK
custom_target_include_dirs.append(idir)
for i in custom_target_include_dirs:
commands+= compiler.get_include_args(i, False)
- if self.environment.coredata.get_builtin_option('use_pch'):
+ if self.environment.coredata.base_options.get('b_pch', False):
commands += self.get_pch_include_args(compiler, target)
crstr = ''
if target.is_cross:
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 50403ef..30f6e60 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -113,7 +113,9 @@ msvc_winlibs = ['kernel32.lib', 'user32.lib', 'gdi32.lib',
'uuid.lib', 'comdlg32.lib', 'advapi32.lib']
-base_options = {'b_lto': coredata.UserBooleanOption('b_lto', 'Use link time optimization', False),
+base_options = {
+ 'b_pch': coredata.UserBooleanOption('b_lto', 'Use precompiled headers', False),
+ 'b_lto': coredata.UserBooleanOption('b_lto', 'Use link time optimization', False),
'b_sanitize': coredata.UserComboOption('b_sanitize',
'Code sanitizer to use',
['none', 'address', 'thread', 'undefined', 'memory'],
@@ -1190,6 +1192,7 @@ class VisualStudioCCompiler(CCompiler):
self.warn_args = {'1': ['/W2'],
'2': ['/W3'],
'3': ['/w4']}
+ self.base_options = ['b_pch'] # FIXME add lto, pgo and the like
def get_always_args(self):
return self.always_args
@@ -1312,6 +1315,7 @@ class VisualStudioCPPCompiler(VisualStudioCCompiler):
VisualStudioCCompiler.__init__(self, exelist, version, is_cross, exe_wrap)
self.language = 'cpp'
self.default_suffix = 'cpp'
+ self.base_options = ['b_pch'] # FIXME add lto, pgo and the like
def can_compile(self, filename):
suffix = filename.split('.')[-1]
@@ -1388,7 +1392,7 @@ class GnuCCompiler(CCompiler):
self.warn_args = {'1': ['-Wall', '-Winvalid-pch'],
'2': ['-Wall', '-Wextra', '-Winvalid-pch'],
'3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']}
- self.base_options = ['b_lto', 'b_pgo', 'b_sanitize']
+ self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize']
if self.gcc_type != GCC_OSX:
self.base_options.append('b_lundef')
@@ -1453,7 +1457,7 @@ class GnuObjCCompiler(ObjCCompiler):
self.warn_args = {'1': ['-Wall', '-Winvalid-pch'],
'2': ['-Wall', '-Wextra', '-Winvalid-pch'],
'3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']}
- self.base_options = ['b_lto', 'b_pgo', 'b_sanitize']
+ self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize']
if self.gcc_type != GCC_OSX:
self.base_options.append('b_lundef')
@@ -1481,7 +1485,7 @@ class GnuObjCPPCompiler(ObjCPPCompiler):
self.warn_args = {'1': ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'],
'2': ['-Wall', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor'],
'3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor']}
- self.base_options = ['b_lto', 'b_pgo', 'b_sanitize']
+ self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize']
if self.gcc_type != GCC_OSX:
self.base_options.append('b_lundef')
@@ -1501,7 +1505,7 @@ class ClangObjCCompiler(GnuObjCCompiler):
def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None):
super().__init__(exelist, version, is_cross, exe_wrapper)
self.id = 'clang'
- self.base_options = ['b_lto', 'b_pgo', 'b_sanitize']
+ self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize']
self.clang_type = cltype
if self.clang_type != CLANG_OSX:
self.base_options.append('b_lundef')
@@ -1511,7 +1515,7 @@ class ClangObjCPPCompiler(GnuObjCPPCompiler):
super().__init__(exelist, version, is_cross, exe_wrapper)
self.id = 'clang'
self.clang_type = cltype
- self.base_options = ['b_lto', 'b_pgo', 'b_sanitize']
+ self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize']
if self.clang_type != CLANG_OSX:
self.base_options.append('b_lundef')
@@ -1523,7 +1527,7 @@ class ClangCCompiler(CCompiler):
self.warn_args = {'1': ['-Wall', '-Winvalid-pch'],
'2': ['-Wall', '-Wextra', '-Winvalid-pch'],
'3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']}
- self.base_options = ['b_lto', 'b_pgo', 'b_sanitize']
+ self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize']
if self.clang_type != CLANG_OSX:
self.base_options.append('b_lundef')
@@ -1571,7 +1575,7 @@ class GnuCPPCompiler(CPPCompiler):
self.warn_args = {'1': ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'],
'2': ['-Wall', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor'],
'3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor']}
- self.base_options = ['b_lto', 'b_pgo', 'b_sanitize']
+ self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize']
if self.gcc_type != GCC_OSX:
self.base_options.append('b_lundef')
@@ -1621,7 +1625,7 @@ class ClangCPPCompiler(CPPCompiler):
'2': ['-Wall', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor'],
'3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor']}
self.clang_type = cltype
- self.base_options = ['b_lto', 'b_pgo', 'b_sanitize']
+ self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize']
if self.clang_type != CLANG_OSX:
self.base_options.append('b_lundef')
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 5f5323d..5fea5a2 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -24,7 +24,6 @@ libtypelist = ['shared', 'static']
builtin_options = {'buildtype': True,
'strip': True,
'coverage': True,
- 'pch': True,
'unity': True,
'prefix': True,
'libdir' : True,
@@ -168,7 +167,6 @@ class CoreData():
self.builtin_options['backend'] = UserStringOption('backend', 'Backend to use', options.backend)
self.builtin_options['buildtype'] = UserComboOption('buildtype', 'Build type', build_types, options.buildtype)
self.builtin_options['strip'] = UserBooleanOption('strip', 'Strip on install', options.strip)
- self.builtin_options['use_pch'] = UserBooleanOption('use_pch', 'Use precompiled headers', options.use_pch)
self.builtin_options['unity'] = UserBooleanOption('unity', 'Unity build', options.unity)
self.builtin_options['warning_level'] = UserComboOption('warning_level', 'Warning level', warning_levels, options.warning_level)
self.builtin_options['werror'] = UserBooleanOption('werror', 'Warnings are errors', options.werror)
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index 9832ea8..426aef3 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -55,8 +55,6 @@ parser.add_argument('--buildtype', default='debug', choices=build_types, dest='b
help='build type go use (default: %(default)s)')
parser.add_argument('--strip', action='store_true', dest='strip', default=False,\
help='strip targets on install (default: %(default)s)')
-parser.add_argument('--disable-pch', action='store_false', dest='use_pch', default=True,\
- help='do not use precompiled headers')
parser.add_argument('--unity', action='store_true', dest='unity', default=False,\
help='unity build')
parser.add_argument('--werror', action='store_true', dest='werror', default=False,\
diff --git a/mesonbuild/mgui.py b/mesonbuild/mgui.py
index d85fa54..ffd1800 100644
--- a/mesonbuild/mgui.py
+++ b/mesonbuild/mgui.py
@@ -249,10 +249,6 @@ class OptionForm:
strip.setChecked(self.coredata.get_builtin_option('strip'))
strip.stateChanged.connect(self.strip_changed)
self.form.addRow('Strip on install', strip)
- pch = QCheckBox("")
- pch.setChecked(self.coredata.get_builtin_option('use_pch'))
- pch.stateChanged.connect(self.pch_changed)
- self.form.addRow('Enable pch', pch)
unity = QCheckBox("")
unity.setChecked(self.coredata.get_builtin_option('unity'))
unity.stateChanged.connect(self.unity_changed)
@@ -313,13 +309,6 @@ class OptionForm:
ns = True
self.coredata.strip = ns
- def pch_changed(self, newState):
- if newState == 0:
- ns = False
- else:
- ns = True
- self.coredata.use_pch = ns
-
def unity_changed(self, newState):
if newState == 0:
ns = False
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index ebc46cd..0881f69 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -96,15 +96,11 @@ def list_buildoptions(coredata, builddata):
'type' : 'boolean',
'description' : 'Strip on install',
'name' : 'strip'}
- pch = {'value' : coredata.builtin_options['use_pch'].value,
- 'type' : 'boolean',
- 'description' : 'Use precompiled headers',
- 'name' : 'pch'}
unity = {'value' : coredata.builtin_options['unity'].value,
'type' : 'boolean',
'description' : 'Unity build',
'name' : 'unity'}
- optlist = [buildtype, strip, pch, unity]
+ optlist = [buildtype, strip, unity]
add_keys(optlist, coredata.user_options)
add_keys(optlist, coredata.compiler_options)
add_keys(optlist, coredata.base_options)