From 5851c133a0d336c2f7cef2f7d155e30f9fcc5d9a Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 14 Jul 2022 00:01:39 -0400 Subject: docs: add some function linkification in code snippets Let people easily find the documentation for concepts we are trying to teach. --- docs/markdown/Compiler-properties.md | 20 ++++++++++---------- docs/markdown/Configuration.md | 4 ++-- docs/markdown/Creating-Linux-binaries.md | 4 ++-- docs/markdown/Creating-OSX-packages.md | 2 +- docs/markdown/Cross-compilation.md | 8 ++++---- docs/markdown/Cuda-module.md | 2 +- docs/markdown/Installing.md | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/markdown/Compiler-properties.md b/docs/markdown/Compiler-properties.md index f12abaf..adbaa1d 100644 --- a/docs/markdown/Compiler-properties.md +++ b/docs/markdown/Compiler-properties.md @@ -7,7 +7,7 @@ object](Reference-manual_returned_compiler.html)* from the main *meson* variable. ```meson -compiler = meson.get_compiler('c') +compiler = [[#meson.get_compiler]]('c') ``` Here we extract the C compiler. We could also have given the argument @@ -64,7 +64,7 @@ void func() { printf("Compile me.\n"); } Then we can run the test. ```meson -result = compiler.compiles(code, name : 'basic check') +result = [[#compiler.compiles]](code, name : 'basic check') ``` The variable *result* will now contain either `true` or `false` @@ -88,7 +88,7 @@ void func() { printf("Compile me.\n"); } Then we can run the test. ```meson -result = compiler.links(code, args : '-lfoo', name : 'link check') +result = [[#compiler.links]](code, args : '-lfoo', name : 'link check') ``` The variable *result* will now contain either `true` or `false` @@ -110,7 +110,7 @@ int main(int argc, char **argv) { return 0; } ''' -result = compiler.run(code, name : 'basic check') +result = [[#compiler.run]](code, name : 'basic check') ``` The `result` variable encapsulates the state of the test, which can be @@ -141,7 +141,7 @@ program that includes the specified header. The following snippet describes how this feature can be used. ```meson -if compiler.has_header('sys/fstat.h') +if [[#compiler.has_header]]('sys/fstat.h') # header exists, do something endif ``` @@ -153,7 +153,7 @@ Often you need to determine the size of a particular element (such as above, the check can be done like this. ```meson -wcharsize = compiler.sizeof('wchar_t', prefix : '#include') +wcharsize = [[#compiler.sizeof]]('wchar_t', prefix : '#include') ``` This will put the size of `wchar_t` as reported by sizeof into @@ -174,7 +174,7 @@ is how we would check whether the function `open_memstream` exists in header `stdio.h` ```meson -if compiler.has_function('open_memstream', prefix : '#include ') +if [[#compiler.has_function]]('open_memstream', prefix : '#include ') # function exists, do whatever is required. endif ``` @@ -201,7 +201,7 @@ would check if a struct called `mystruct` from header `myheader.h` contains a member called `some_member`. ```meson -if compiler.has_member('struct mystruct', 'some_member', prefix : '#include') +if [[#compiler.has_member]]('struct mystruct', 'some_member', prefix : '#include') # member exists, do whatever is required endif ``` @@ -214,7 +214,7 @@ integer only at locations which are divisible by four. Determining the alignment of data types is simple. ```meson -int_alignment = compiler.alignment('int') # Will most likely contain the value 4. +int_alignment = [[#compiler.alignment]]('int') # Will most likely contain the value 4. ``` ## Has argument @@ -224,7 +224,7 @@ argument. This is implemented by compiling a small file with the given argument. ```meson -has_special_flags = compiler.has_argument('-Wspecialthing') +has_special_flags = [[#compiler.has_argument]]('-Wspecialthing') ``` *Note*: some compilers silently swallow command line arguments they do diff --git a/docs/markdown/Configuration.md b/docs/markdown/Configuration.md index 1402b16..48f071e 100644 --- a/docs/markdown/Configuration.md +++ b/docs/markdown/Configuration.md @@ -13,9 +13,9 @@ one found in other build systems such as CMake. Suppose we have the following Meson snippet: ```meson -conf_data = configuration_data() +conf_data = [[#configuration_data]] conf_data.set('version', '1.2.3') -configure_file(input : 'config.h.in', +[[#configure_file]](input : 'config.h.in', output : 'config.h', configuration : conf_data) ``` diff --git a/docs/markdown/Creating-Linux-binaries.md b/docs/markdown/Creating-Linux-binaries.md index 71c96e4..1489ce1 100644 --- a/docs/markdown/Creating-Linux-binaries.md +++ b/docs/markdown/Creating-Linux-binaries.md @@ -103,7 +103,7 @@ project](https://github.com/jpakkane/meson/tree/master/manual%20tests/4%20standa Make the script run during install with this: ```meson -meson.add_install_script('linux_bundler.sh') +[[#meson.add_install_script]]('linux_bundler.sh') ``` ## Final steps @@ -125,7 +125,7 @@ bin/myapp Install it with this Meson snippet: ```meson -install_data('myapp.sh', install_dir : '.') +[[#install_data]]('myapp.sh', install_dir : '.') ``` And now you are done. Zip up your `/tmp/myapp` directory and you have diff --git a/docs/markdown/Creating-OSX-packages.md b/docs/markdown/Creating-OSX-packages.md index dcae762..5a30b97 100644 --- a/docs/markdown/Creating-OSX-packages.md +++ b/docs/markdown/Creating-OSX-packages.md @@ -92,7 +92,7 @@ framework. In order to bundle it in our app, we first specify an installer script to run. ```meson -meson.add_install_script('install_script.sh') +[[#meson.add_install_script]]('install_script.sh') ``` The install script does two things. First it copies the whole diff --git a/docs/markdown/Cross-compilation.md b/docs/markdown/Cross-compilation.md index e44b4dd..0f982d8 100644 --- a/docs/markdown/Cross-compilation.md +++ b/docs/markdown/Cross-compilation.md @@ -262,16 +262,16 @@ The main *meson* object provides two functions to determine cross compilation status. ```meson -meson.is_cross_build() # returns true when cross compiling -meson.can_run_host_binaries() # returns true if the host binaries can be run, either with a wrapper or natively +[[#meson.is_cross_build]] # returns true when cross compiling +[[#meson.can_run_host_binaries]] # returns true if the host binaries can be run, either with a wrapper or natively ``` You can run system checks on both the system compiler or the cross compiler. You just have to specify which one to use. ```meson -build_compiler = meson.get_compiler('c', native : true) -host_compiler = meson.get_compiler('c', native : false) +build_compiler = [[#meson.get_compiler]]('c', native : true) +host_compiler = [[#meson.get_compiler]]('c', native : false) build_int_size = build_compiler.sizeof('int') host_int_size = host_compiler.sizeof('int') diff --git a/docs/markdown/Cuda-module.md b/docs/markdown/Cuda-module.md index 24a607a..81eb795 100644 --- a/docs/markdown/Cuda-module.md +++ b/docs/markdown/Cuda-module.md @@ -23,7 +23,7 @@ from Meson altogether. The module may be imported as follows: ``` meson -cuda = import('unstable-cuda') +cuda = [[#import]]('unstable-cuda') ``` It offers several useful functions that are enumerated below. diff --git a/docs/markdown/Installing.md b/docs/markdown/Installing.md index 2cc297f..2ad3417 100644 --- a/docs/markdown/Installing.md +++ b/docs/markdown/Installing.md @@ -96,7 +96,7 @@ also sets the variables `MESON_SOURCE_ROOT` and `MESON_BUILD_ROOT`. Telling Meson to run this script at install time is a one-liner. ```meson -meson.add_install_script('myscript.sh') +[[#meson.add_install_script]]('myscript.sh') ``` The argument is the name of the script file relative to the current -- cgit v1.1