aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorNicholas Vinson <nvinson234@gmail.com>2023-09-04 13:04:00 -0400
committerXavier Claessens <xclaesse@gmail.com>2023-09-09 07:30:56 -0400
commitb51bce070eead2b65e56f087acf23829a6304ae2 (patch)
tree57ce789fe3fce4ddb8fbd98d33d2cf1d697166f2 /test cases
parent3c47216fe945a45834daa38f71e287dcfaf345c7 (diff)
downloadmeson-b51bce070eead2b65e56f087acf23829a6304ae2.zip
meson-b51bce070eead2b65e56f087acf23829a6304ae2.tar.gz
meson-b51bce070eead2b65e56f087acf23829a6304ae2.tar.bz2
Add macro_name option to configure_file
Allow macro_name to be speficied as a parameter to configure_file(). This allows C macro-style include guards to be added to configure_file()'s output when a template file is not given. This change simplifies the creation of configure files that define macros with dynamic names and want the C-style include guards.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/269 configure file output format/expected/config.mg23
-rw-r--r--test cases/common/269 configure file output format/meson.build9
2 files changed, 32 insertions, 0 deletions
diff --git a/test cases/common/269 configure file output format/expected/config.mg b/test cases/common/269 configure file output format/expected/config.mg
new file mode 100644
index 0000000..ccdb4e7
--- /dev/null
+++ b/test cases/common/269 configure file output format/expected/config.mg
@@ -0,0 +1,23 @@
+/*
+ * Autogenerated by the Meson build system.
+ * Do not edit, your changes will be lost.
+ */
+
+#ifndef CONFIG_MAGNESIUM_H
+#define CONFIG_MAGNESIUM_H
+
+#define bool
+
+#undef false
+
+/* ultimate question of life, the universe, and everything */
+#define int 42
+
+/* This is
+a multiline
+description */
+#define str "hello world!"
+
+#define unquoted float
+
+#endif
diff --git a/test cases/common/269 configure file output format/meson.build b/test cases/common/269 configure file output format/meson.build
index 796b9d6..17650e3 100644
--- a/test cases/common/269 configure file output format/meson.build
+++ b/test cases/common/269 configure file output format/meson.build
@@ -27,12 +27,21 @@ config_json = configure_file(
output: 'config.json'
)
+config_mg = configure_file(
+ configuration: data,
+ macro_name: 'CONFIG_MAGNESIUM_H',
+ output_format: 'c',
+ output: 'config_mg.h'
+)
+
py = find_program('python3')
compare_py = files('compare.py')
expected_config_h = files('expected/config.h')
expected_config_nasm = files('expected/config.nasm')
expected_config_json = files('expected/config.json')
+expected_config_mg = files('expected/config.mg')
test('c_output', py, args: [compare_py, expected_config_h, config_h])
test('nasm_output', py, args: [compare_py, expected_config_nasm, config_nasm])
test('json_output', py, args: [compare_py, expected_config_json, config_json])
+test('c_mg_output', py, args: [compare_py, expected_config_mg, config_mg])