aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/Style-guide.md
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-02-06 21:04:09 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-02-08 00:33:44 +0200
commit0cc90ae2348164e4970c834df80467e5dc9fbd72 (patch)
treed865b21feca5c1ec4256377e4f1517e7ac365c71 /docs/markdown/Style-guide.md
parent54d78170876e7b762aa3452faa44ec1b7cd44372 (diff)
downloadmeson-0cc90ae2348164e4970c834df80467e5dc9fbd72.zip
meson-0cc90ae2348164e4970c834df80467e5dc9fbd72.tar.gz
meson-0cc90ae2348164e4970c834df80467e5dc9fbd72.tar.bz2
Add style guide documentation.
Diffstat (limited to 'docs/markdown/Style-guide.md')
-rw-r--r--docs/markdown/Style-guide.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/markdown/Style-guide.md b/docs/markdown/Style-guide.md
new file mode 100644
index 0000000..9008592
--- /dev/null
+++ b/docs/markdown/Style-guide.md
@@ -0,0 +1,36 @@
+---
+short-description: Style recommendations for Meson files
+...
+
+# Style recommendations
+
+This page lists some recommendations on organizing and formatting your
+Meson build files.
+
+## Tabs or spaces?
+
+Always spaces.
+
+## Naming options
+
+There are two ways of naming project options. As an example for
+booleans the first one is `foo` and the second one is
+`enable-foo`. The former style is recommended, because in Meson
+options have strong type, rather than being just strings.
+
+You should try to name options the same as is common in other
+projects. This is especially important for yielding options, because
+they require that both the parent and subproject options have the same
+name.
+
+# Global arguments
+
+Prefer `add_project_arguments` to `add_global_arguments` because using
+the latter prevents using the project as a subproject.
+
+# Cross compilation arguments
+
+Try to keep cross compilation arguments away from your build files as
+much as possible. Keep them in the cross file instead. This adds
+portability, since all changes needed to compile to a different
+platform are isolated in one place.