-
-
Notifications
You must be signed in to change notification settings - Fork 36
meson build automation utility
Zeioth edited this page Mar 25, 2024
·
8 revisions
When compiler.nvim detects a mason.build
file in the current working directory, Telescope will be populated with all its executable
and custom_target
entries.
Create a meson.build file in your working directory and copy/paste this:
project('HelloWorld', 'cpp')
# Example of a target
hello_world = executable('hello_world', 'main.cpp')
# Example of custom target to run all tasks
build_all = custom_target('build_all', command: 'echo', output: 'echo', input: [hello_world])
Now let's create the file we are building on the example above: Create main.cpp
in the same directory.
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
When you open the compiler you will see the option to run it
And this is the result
In the same way you can run hello world, you can execute any command necessary to build your program.
(optionally) You can define the next globals
global | defaut value |
---|---|
MESON_CLEAN_FIRST |
false |
MESON_BUILD_DIR |
./build |
MESON_BUILD_TYPE |
debug |
Example:
let g:MESON_BUILD_TYPE='release'
Globals persist between Neovim sessions.