aboutsummaryrefslogtreecommitdiff
path: root/test cases
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 /test cases
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 'test cases')
-rw-r--r--test cases/common/13 pch/c/meson.build6
-rw-r--r--test cases/common/13 pch/cpp/prog.cc3
-rw-r--r--test cases/common/13 pch/generated/meson.build6
-rw-r--r--test cases/common/13 pch/meson.build10
-rw-r--r--test cases/common/13 pch/mixed/meson.build8
-rw-r--r--test cases/common/13 pch/withIncludeDirectories/meson.build6
6 files changed, 38 insertions, 1 deletions
diff --git a/test cases/common/13 pch/c/meson.build b/test cases/common/13 pch/c/meson.build
index fe4ac68..6fba15b 100644
--- a/test cases/common/13 pch/c/meson.build
+++ b/test cases/common/13 pch/c/meson.build
@@ -1,8 +1,14 @@
cc = meson.get_compiler('c')
cc_id = cc.get_id()
+
if cc_id == 'lcc'
error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.')
endif
+# PGI compiler only supports PCH for C++
+if cc_id == 'pgi'
+ subdir_done()
+endif
+
exe = executable('prog', 'prog.c',
c_pch : 'pch/prog.h')
diff --git a/test cases/common/13 pch/cpp/prog.cc b/test cases/common/13 pch/cpp/prog.cc
index 629d880..ea258c6 100644
--- a/test cases/common/13 pch/cpp/prog.cc
+++ b/test cases/common/13 pch/cpp/prog.cc
@@ -1,8 +1,11 @@
+// Note: if using PGI compilers, you will need to add #include "prog.hh"
+// even though you're using precompiled headers.
void func() {
std::cout << "This is a function that fails to compile if iostream is not included."
<< std::endl;
}
int main(int argc, char **argv) {
+ func();
return 0;
}
diff --git a/test cases/common/13 pch/generated/meson.build b/test cases/common/13 pch/generated/meson.build
index 1ef771b..ba06bce 100644
--- a/test cases/common/13 pch/generated/meson.build
+++ b/test cases/common/13 pch/generated/meson.build
@@ -1,9 +1,15 @@
cc = meson.get_compiler('c')
cc_id = cc.get_id()
+
if cc_id == 'lcc'
error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.')
endif
+# PGI compiler only supports PCH for C++
+if cc_id == 'pgi'
+ subdir_done()
+endif
+
generated_customTarget = custom_target('makeheader',
output: 'generated_customTarget.h',
command : [find_program('gen_custom.py'), '@OUTPUT0@'])
diff --git a/test cases/common/13 pch/meson.build b/test cases/common/13 pch/meson.build
index 4438c9e..334afc5 100644
--- a/test cases/common/13 pch/meson.build
+++ b/test cases/common/13 pch/meson.build
@@ -1,4 +1,12 @@
-project('pch test', 'c', 'cpp')
+project('pch test', 'c', 'cpp',
+ meson_version: '>= 0.46.0')
+
+cc = meson.get_compiler('c')
+cc_id = cc.get_id()
+
+if cc_id == 'pgi'
+ error('MESON_SKIP_TEST: PGI compiler does support PCH, however, PGI cannot tolerate spaces in the --pch_dir path and Meson run_project_tests.py uses spaces in temporary build path names. If this test is run individually with no spaces in build path, it will pass.')
+endif
subdir('c')
subdir('cpp')
diff --git a/test cases/common/13 pch/mixed/meson.build b/test cases/common/13 pch/mixed/meson.build
index cbb7bac..266e7a5 100644
--- a/test cases/common/13 pch/mixed/meson.build
+++ b/test cases/common/13 pch/mixed/meson.build
@@ -1,3 +1,11 @@
+cc = meson.get_compiler('c')
+cc_id = cc.get_id()
+
+# PGI compiler only supports PCH for C++
+if cc_id == 'pgi'
+ subdir_done()
+endif
+
exe = executable(
'prog',
files('main.cc', 'func.c'),
diff --git a/test cases/common/13 pch/withIncludeDirectories/meson.build b/test cases/common/13 pch/withIncludeDirectories/meson.build
index 68e544b..95f7888 100644
--- a/test cases/common/13 pch/withIncludeDirectories/meson.build
+++ b/test cases/common/13 pch/withIncludeDirectories/meson.build
@@ -1,9 +1,15 @@
cc = meson.get_compiler('c')
cc_id = cc.get_id()
+
if cc_id == 'lcc'
error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.')
endif
+# PGI compiler only supports PCH for C++
+if cc_id == 'pgi'
+ subdir_done()
+endif
+
exe = executable('prog', 'prog.c',
include_directories: 'include',
c_pch : 'pch/prog.h')