aboutsummaryrefslogtreecommitdiff
path: root/test cases/common/13 pch
diff options
context:
space:
mode:
authorNicolas Schneider <nioncode+git@gmail.com>2019-01-27 16:52:21 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2019-03-01 21:50:31 +0200
commitded0defc3fa12d11d722dba78f9dba66256a3b16 (patch)
treefede9ee481c79a3b70cbf923fa99b4491e50224b /test cases/common/13 pch
parentfcd608c13128dd97021356c005a1be2936862dad (diff)
downloadmeson-ded0defc3fa12d11d722dba78f9dba66256a3b16.zip
meson-ded0defc3fa12d11d722dba78f9dba66256a3b16.tar.gz
meson-ded0defc3fa12d11d722dba78f9dba66256a3b16.tar.bz2
auto generate msvc pch source file if none is provided by the user
Diffstat (limited to 'test cases/common/13 pch')
-rw-r--r--test cases/common/13 pch/c/meson.build2
-rw-r--r--test cases/common/13 pch/c/pch/prog_pch.c5
-rw-r--r--test cases/common/13 pch/cpp/meson.build2
-rw-r--r--test cases/common/13 pch/cpp/pch/prog_pch.cc5
-rw-r--r--test cases/common/13 pch/generated/meson.build2
-rw-r--r--test cases/common/13 pch/generated/pch/prog_pch.c5
-rw-r--r--test cases/common/13 pch/meson.build1
-rw-r--r--test cases/common/13 pch/mixed/meson.build15
-rw-r--r--test cases/common/13 pch/mixed/pch/func_pch.c1
-rw-r--r--test cases/common/13 pch/mixed/pch/main_pch.cc1
-rw-r--r--test cases/common/13 pch/userDefined/meson.build10
-rw-r--r--test cases/common/13 pch/userDefined/pch/pch.c5
-rw-r--r--test cases/common/13 pch/userDefined/pch/pch.h1
-rw-r--r--test cases/common/13 pch/userDefined/prog.c8
-rw-r--r--test cases/common/13 pch/withIncludeDirectories/meson.build2
-rw-r--r--test cases/common/13 pch/withIncludeDirectories/pch/prog_pch.c5
16 files changed, 31 insertions, 39 deletions
diff --git a/test cases/common/13 pch/c/meson.build b/test cases/common/13 pch/c/meson.build
index cb8349d..fe4ac68 100644
--- a/test cases/common/13 pch/c/meson.build
+++ b/test cases/common/13 pch/c/meson.build
@@ -5,4 +5,4 @@ if cc_id == 'lcc'
endif
exe = executable('prog', 'prog.c',
-c_pch : ['pch/prog_pch.c', 'pch/prog.h'])
+c_pch : 'pch/prog.h')
diff --git a/test cases/common/13 pch/c/pch/prog_pch.c b/test cases/common/13 pch/c/pch/prog_pch.c
deleted file mode 100644
index 4960505..0000000
--- a/test cases/common/13 pch/c/pch/prog_pch.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#if !defined(_MSC_VER)
-#error "This file is only for use with MSVC."
-#endif
-
-#include "prog.h"
diff --git a/test cases/common/13 pch/cpp/meson.build b/test cases/common/13 pch/cpp/meson.build
index 802c3e1..b01cd58 100644
--- a/test cases/common/13 pch/cpp/meson.build
+++ b/test cases/common/13 pch/cpp/meson.build
@@ -1 +1 @@
-exe = executable('prog', 'prog.cc', cpp_pch : ['pch/prog.hh', 'pch/prog_pch.cc'])
+exe = executable('prog', 'prog.cc', cpp_pch : 'pch/prog.hh')
diff --git a/test cases/common/13 pch/cpp/pch/prog_pch.cc b/test cases/common/13 pch/cpp/pch/prog_pch.cc
deleted file mode 100644
index aff1225..0000000
--- a/test cases/common/13 pch/cpp/pch/prog_pch.cc
+++ /dev/null
@@ -1,5 +0,0 @@
-#if !defined(_MSC_VER)
-#error "This file is only for use with MSVC."
-#endif
-
-#include "prog.hh"
diff --git a/test cases/common/13 pch/generated/meson.build b/test cases/common/13 pch/generated/meson.build
index 372a00e..1ef771b 100644
--- a/test cases/common/13 pch/generated/meson.build
+++ b/test cases/common/13 pch/generated/meson.build
@@ -13,4 +13,4 @@ generated_generator = generator(find_program('gen_generator.py'),
arguments: ['@INPUT@', '@OUTPUT@'])
exe = executable('prog', 'prog.c', generated_customTarget, generated_generator.process('generated_generator.in'),
- c_pch: ['pch/prog_pch.c', 'pch/prog.h'])
+ c_pch: 'pch/prog.h')
diff --git a/test cases/common/13 pch/generated/pch/prog_pch.c b/test cases/common/13 pch/generated/pch/prog_pch.c
deleted file mode 100644
index 4960505..0000000
--- a/test cases/common/13 pch/generated/pch/prog_pch.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#if !defined(_MSC_VER)
-#error "This file is only for use with MSVC."
-#endif
-
-#include "prog.h"
diff --git a/test cases/common/13 pch/meson.build b/test cases/common/13 pch/meson.build
index 43129c9..4438c9e 100644
--- a/test cases/common/13 pch/meson.build
+++ b/test cases/common/13 pch/meson.build
@@ -3,6 +3,7 @@ project('pch test', 'c', 'cpp')
subdir('c')
subdir('cpp')
subdir('generated')
+subdir('userDefined')
subdir('withIncludeDirectories')
if meson.backend() == 'xcode'
diff --git a/test cases/common/13 pch/mixed/meson.build b/test cases/common/13 pch/mixed/meson.build
index f0c3eca..cbb7bac 100644
--- a/test cases/common/13 pch/mixed/meson.build
+++ b/test cases/common/13 pch/mixed/meson.build
@@ -1,17 +1,6 @@
exe = executable(
'prog',
files('main.cc', 'func.c'),
- c_pch : ['pch/func.h', 'pch/func_pch.c'],
- cpp_pch : ['pch/main_pch.cc', 'pch/main.h'],
+ c_pch : ['pch/func.h'],
+ cpp_pch : ['pch/main.h'],
)
-
-# test pch when only a header is given (not supported by msvc)
-cc = meson.get_compiler('c')
-if not ['msvc', 'clang-cl'].contains(cc.get_id())
- exe2 = executable(
- 'prog2',
- files('main.cc', 'func.c'),
- c_pch : 'pch/func.h',
- cpp_pch : 'pch/main.h',
- )
-endif
diff --git a/test cases/common/13 pch/mixed/pch/func_pch.c b/test cases/common/13 pch/mixed/pch/func_pch.c
deleted file mode 100644
index 5566739..0000000
--- a/test cases/common/13 pch/mixed/pch/func_pch.c
+++ /dev/null
@@ -1 +0,0 @@
-#include"func.h"
diff --git a/test cases/common/13 pch/mixed/pch/main_pch.cc b/test cases/common/13 pch/mixed/pch/main_pch.cc
deleted file mode 100644
index acd3f57..0000000
--- a/test cases/common/13 pch/mixed/pch/main_pch.cc
+++ /dev/null
@@ -1 +0,0 @@
-#include"main.h"
diff --git a/test cases/common/13 pch/userDefined/meson.build b/test cases/common/13 pch/userDefined/meson.build
new file mode 100644
index 0000000..9b60572
--- /dev/null
+++ b/test cases/common/13 pch/userDefined/meson.build
@@ -0,0 +1,10 @@
+cc = meson.get_compiler('c')
+cc_id = cc.get_id()
+
+# User supplied PCH implementation should override the auto
+# generated one. PCH implementations are only supported for
+# msvc and generally should not be used at all. Support for
+# them is only kept for backwards compatibility.
+if cc_id == 'msvc'
+ exe = executable('prog', 'prog.c', c_pch : ['pch/pch.h', 'pch/pch.c'])
+endif
diff --git a/test cases/common/13 pch/userDefined/pch/pch.c b/test cases/common/13 pch/userDefined/pch/pch.c
new file mode 100644
index 0000000..c107b1a
--- /dev/null
+++ b/test cases/common/13 pch/userDefined/pch/pch.c
@@ -0,0 +1,5 @@
+#include "pch.h"
+
+int foo() {
+ return 0;
+}
diff --git a/test cases/common/13 pch/userDefined/pch/pch.h b/test cases/common/13 pch/userDefined/pch/pch.h
new file mode 100644
index 0000000..5d5f8f0
--- /dev/null
+++ b/test cases/common/13 pch/userDefined/pch/pch.h
@@ -0,0 +1 @@
+int foo();
diff --git a/test cases/common/13 pch/userDefined/prog.c b/test cases/common/13 pch/userDefined/prog.c
new file mode 100644
index 0000000..eb068d9
--- /dev/null
+++ b/test cases/common/13 pch/userDefined/prog.c
@@ -0,0 +1,8 @@
+// No includes here, they need to come from the PCH
+
+int main(int argc, char **argv) {
+ // Method is implemented in pch.c.
+ // This makes sure that we can properly handle user defined
+ // pch implementation files and not only auto-generated ones.
+ return foo();
+}
diff --git a/test cases/common/13 pch/withIncludeDirectories/meson.build b/test cases/common/13 pch/withIncludeDirectories/meson.build
index 2ab2cd8..68e544b 100644
--- a/test cases/common/13 pch/withIncludeDirectories/meson.build
+++ b/test cases/common/13 pch/withIncludeDirectories/meson.build
@@ -6,4 +6,4 @@ endif
exe = executable('prog', 'prog.c',
include_directories: 'include',
- c_pch : ['pch/prog_pch.c', 'pch/prog.h'])
+ c_pch : 'pch/prog.h')
diff --git a/test cases/common/13 pch/withIncludeDirectories/pch/prog_pch.c b/test cases/common/13 pch/withIncludeDirectories/pch/prog_pch.c
deleted file mode 100644
index 4960505..0000000
--- a/test cases/common/13 pch/withIncludeDirectories/pch/prog_pch.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#if !defined(_MSC_VER)
-#error "This file is only for use with MSVC."
-#endif
-
-#include "prog.h"