aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/mixins
diff options
context:
space:
mode:
authorMichael Hirsch, Ph.D <10931741+scivision@users.noreply.github.com>2019-07-30 11:07:20 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2019-07-30 18:07:20 +0300
commit1e53f67187a5df2eff19e65416f4e4c8d06f6257 (patch)
treeb7ef43a6afc033b3db404535a8b2cac52539a4c6 /mesonbuild/compilers/mixins
parent986587067cf49d4466a706f94c8247e6992873c8 (diff)
downloadmeson-1e53f67187a5df2eff19e65416f4e4c8d06f6257.zip
meson-1e53f67187a5df2eff19e65416f4e4c8d06f6257.tar.gz
meson-1e53f67187a5df2eff19e65416f4e4c8d06f6257.tar.bz2
PGI: cpp_pch precompiled headers functionality
* PGI C++ PCH enable PGI compilers support precompiled headers for C++ only. The common/13 pch test passes if run manually with no spaces in the build path. However, since Meson run_project_tests.py makes temporary build directories with spaces in each tests, PGI --pch_dir can't handle this and fails. So we skip the test for PGI despite it working for usual case with no-spaces in build dir. Note: it's fine to have spaces in full path for sourcedir, just no spaces in relative path to builddir. * doc
Diffstat (limited to 'mesonbuild/compilers/mixins')
-rw-r--r--mesonbuild/compilers/mixins/pgi.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/mesonbuild/compilers/mixins/pgi.py b/mesonbuild/compilers/mixins/pgi.py
index a75c62d..ad94271 100644
--- a/mesonbuild/compilers/mixins/pgi.py
+++ b/mesonbuild/compilers/mixins/pgi.py
@@ -16,6 +16,7 @@
import typing
import os
+from pathlib import Path
from ..compilers import clike_debug_args, clike_optimization_args
@@ -42,8 +43,9 @@ pgi_buildtype_linker_args = {
} # type: typing.Dict[str, typing.List[str]]
-class PGICompiler:
+class PGICompiler():
def __init__(self, compiler_type: 'CompilerType'):
+ self.base_options = ['b_pch']
self.id = 'pgi'
self.compiler_type = compiler_type
@@ -93,3 +95,17 @@ class PGICompiler:
def get_always_args(self) -> typing.List[str]:
return []
+
+ def get_pch_suffix(self) -> str:
+ # PGI defaults to .pch suffix for PCH on Linux and Windows with --pch option
+ return 'pch'
+
+ def get_pch_use_args(self, pch_dir: str, header: str) -> typing.List[str]:
+ # PGI supports PCH for C++ only.
+ hdr = Path(pch_dir).resolve().parent / header
+ if self.language == 'cpp':
+ return ['--pch',
+ '--pch_dir', str(hdr.parent),
+ '-I{}'.format(hdr.parent)]
+ else:
+ return []