summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2025-01-06 14:28:14 -0800
committerDylan Baker <dylan@pnwbakers.com>2025-01-08 09:58:00 -0800
commit1b14526243c3e12c132ee8f81089fea0425bab7d (patch)
tree1dc41cf7fbee3d6cefc2368c9de8939097ce56ae
parentb94cbbfb79eaeaf863d77fca1dd051b102471ad3 (diff)
downloadmeson-1b14526243c3e12c132ee8f81089fea0425bab7d.tar.gz
templates: standardize Meson formatting
We have all kinds of formatting, different indents, different line break standards.
-rw-r--r--mesonbuild/templates/cpptemplates.py38
-rw-r--r--mesonbuild/templates/cstemplates.py37
-rw-r--r--mesonbuild/templates/ctemplates.py37
-rw-r--r--mesonbuild/templates/cudatemplates.py38
-rw-r--r--mesonbuild/templates/dlangtemplates.py49
-rw-r--r--mesonbuild/templates/fortrantemplates.py37
-rw-r--r--mesonbuild/templates/javatemplates.py37
-rw-r--r--mesonbuild/templates/mesontemplates.py34
-rw-r--r--mesonbuild/templates/objcpptemplates.py37
-rw-r--r--mesonbuild/templates/objctemplates.py34
-rw-r--r--mesonbuild/templates/rusttemplates.py34
-rw-r--r--mesonbuild/templates/valatemplates.py57
12 files changed, 324 insertions, 145 deletions
diff --git a/mesonbuild/templates/cpptemplates.py b/mesonbuild/templates/cpptemplates.py
index f21729982..2d7955ed7 100644
--- a/mesonbuild/templates/cpptemplates.py
+++ b/mesonbuild/templates/cpptemplates.py
@@ -21,14 +21,19 @@ int main(int argc, char **argv) {{
}}
'''
-hello_cpp_meson_template = '''project('{project_name}', 'cpp',
+hello_cpp_meson_template = '''project(
+ '{project_name}',
+ 'cpp',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3',
- 'cpp_std=c++14'])
+ default_options : ['warning_level=3', 'cpp_std=c++14'],
+)
-exe = executable('{exe_name}', '{source_name}',
- install : true)
+exe = executable(
+ '{exe_name}',
+ '{source_name}',
+ install : true,
+)
test('basic', exe)
'''
@@ -94,29 +99,38 @@ int main(int argc, char **argv) {{
}}
'''
-lib_cpp_meson_template = '''project('{project_name}', 'cpp',
+lib_cpp_meson_template = '''project(
+ '{project_name}',
+ 'cpp',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3', 'cpp_std=c++14'])
+ default_options : ['warning_level=3', 'cpp_std=c++14'],
+)
# These arguments are only used to build the shared library
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']
-shlib = shared_library('{lib_name}', '{source_file}',
+shlib = shared_library(
+ '{lib_name}',
+ '{source_file}',
install : true,
cpp_args : lib_args,
gnu_symbol_visibility : 'hidden',
)
-test_exe = executable('{test_exe_name}', '{test_source_file}',
- link_with : shlib)
+test_exe = executable(
+ '{test_exe_name}',
+ '{test_source_file}',
+ link_with : shlib,
+)
test('{test_name}', test_exe)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : shlib)
+ include_directories : include_directories('.'),
+ link_with : shlib,
+)
# Make this library usable from the system's
# package manager.
diff --git a/mesonbuild/templates/cstemplates.py b/mesonbuild/templates/cstemplates.py
index 4dbb39863..7ab1548d2 100644
--- a/mesonbuild/templates/cstemplates.py
+++ b/mesonbuild/templates/cstemplates.py
@@ -24,13 +24,19 @@ public class {class_name} {{
'''
-hello_cs_meson_template = '''project('{project_name}', 'cs',
+hello_cs_meson_template = '''project(
+ '{project_name}',
+ 'cs',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
-exe = executable('{exe_name}', '{source_name}',
- install : true)
+exe = executable(
+ '{exe_name}',
+ '{source_name}',
+ install : true,
+)
test('basic', exe)
'''
@@ -62,23 +68,32 @@ public class {class_test} {{
'''
-lib_cs_meson_template = '''project('{project_name}', 'cs',
+lib_cs_meson_template = '''project(
+ '{project_name}',
+ 'cs',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
-stlib = shared_library('{lib_name}', '{source_file}',
+stlib = shared_library(
+ '{lib_name}',
+ '{source_file}',
install : true,
)
-test_exe = executable('{test_exe_name}', '{test_source_file}',
- link_with : stlib)
+test_exe = executable(
+ '{test_exe_name}',
+ '{test_source_file}',
+ link_with : stlib,
+)
test('{test_name}', test_exe)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : stlib)
+ include_directories : include_directories('.'),
+ link_with : stlib,
+)
'''
diff --git a/mesonbuild/templates/ctemplates.py b/mesonbuild/templates/ctemplates.py
index a879b9ac5..cfb5a4003 100644
--- a/mesonbuild/templates/ctemplates.py
+++ b/mesonbuild/templates/ctemplates.py
@@ -52,29 +52,38 @@ int main(int argc, char **argv) {{
}}
'''
-lib_c_meson_template = '''project('{project_name}', 'c',
+lib_c_meson_template = '''project(
+ '{project_name}',
+ 'c',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
# These arguments are only used to build the shared library
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']
-shlib = shared_library('{lib_name}', '{source_file}',
+shlib = shared_library(
+ '{lib_name}',
+ '{source_file}',
install : true,
c_args : lib_args,
gnu_symbol_visibility : 'hidden',
)
-test_exe = executable('{test_exe_name}', '{test_source_file}',
- link_with : shlib)
+test_exe = executable(
+ '{test_exe_name}',
+ '{test_source_file}',
+ link_with : shlib,
+)
test('{test_name}', test_exe)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : shlib)
+ include_directories : include_directories('.'),
+ link_with : shlib,
+)
# Make this library usable from the system's
# package manager.
@@ -105,13 +114,19 @@ int main(int argc, char **argv) {{
}}
'''
-hello_c_meson_template = '''project('{project_name}', 'c',
+hello_c_meson_template = '''project(
+ '{project_name}',
+ 'c',
meson_version : '>= {meson_version}',
version : '{version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
-exe = executable('{exe_name}', '{source_name}',
- install : true)
+exe = executable(
+ '{exe_name}',
+ '{source_name}',
+ install : true,
+)
test('basic', exe)
'''
diff --git a/mesonbuild/templates/cudatemplates.py b/mesonbuild/templates/cudatemplates.py
index c79150e81..189fe9847 100644
--- a/mesonbuild/templates/cudatemplates.py
+++ b/mesonbuild/templates/cudatemplates.py
@@ -21,14 +21,19 @@ int main(int argc, char **argv) {{
}}
'''
-hello_cuda_meson_template = '''project('{project_name}', ['cuda', 'cpp'],
+hello_cuda_meson_template = '''project(
+ '{project_name}',
+ ['cuda', 'cpp'],
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3',
- 'cpp_std=c++14'])
+ default_options : ['warning_level=3', 'cpp_std=c++14'],
+)
-exe = executable('{exe_name}', '{source_name}',
- install : true)
+exe = executable(
+ '{exe_name}',
+ '{source_name}',
+ install : true,
+)
test('basic', exe)
'''
@@ -94,29 +99,38 @@ int main(int argc, char **argv) {{
}}
'''
-lib_cuda_meson_template = '''project('{project_name}', ['cuda', 'cpp'],
+lib_cuda_meson_template = '''project(
+ '{project_name}',
+ ['cuda', 'cpp'],
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
# These arguments are only used to build the shared library
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']
-shlib = shared_library('{lib_name}', '{source_file}',
+shlib = shared_library(
+ '{lib_name}',
+ '{source_file}',
install : true,
cpp_args : lib_args,
gnu_symbol_visibility : 'hidden',
)
-test_exe = executable('{test_exe_name}', '{test_source_file}',
- link_with : shlib)
+test_exe = executable(
+ '{test_exe_name}',
+ '{test_source_file}',
+ link_with : shlib,
+)
test('{test_name}', test_exe)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : shlib)
+ include_directories : include_directories('.'),
+ link_with : shlib,
+)
# Make this library usable from the system's
# package manager.
diff --git a/mesonbuild/templates/dlangtemplates.py b/mesonbuild/templates/dlangtemplates.py
index eb102aede..85968e1f5 100644
--- a/mesonbuild/templates/dlangtemplates.py
+++ b/mesonbuild/templates/dlangtemplates.py
@@ -24,13 +24,19 @@ int main(string[] args) {{
}}
'''
-hello_d_meson_template = '''project('{project_name}', 'd',
- version : '{version}',
- meson_version : '>= {meson_version}',
- default_options: ['warning_level=3'])
+hello_d_meson_template = '''project(
+ '{project_name}',
+ 'd',
+ version : '{version}',
+ meson_version : '>= {meson_version}',
+ default_options : ['warning_level=3'],
+)
-exe = executable('{exe_name}', '{source_name}',
- install : true)
+exe = executable(
+ '{exe_name}',
+ '{source_name}',
+ install : true,
+)
test('basic', exe)
'''
@@ -63,32 +69,43 @@ int main(string[] args) {{
}}
'''
-lib_d_meson_template = '''project('{project_name}', 'd',
+lib_d_meson_template = '''project(
+ '{project_name}',
+ 'd',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
-stlib = static_library('{lib_name}', '{source_file}',
+stlib = static_library(
+ '{lib_name}',
+ '{source_file}',
install : true,
gnu_symbol_visibility : 'hidden',
)
-test_exe = executable('{test_exe_name}', '{test_source_file}',
- link_with : stlib)
+test_exe = executable(
+ '{test_exe_name}',
+ '{test_source_file}',
+ link_with : stlib,
+)
test('{test_name}', test_exe)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : stlib)
+ include_directories : include_directories('.'),
+ link_with : stlib,
+)
# Make this library usable from the Dlang
# build system.
dlang_mod = import('dlang')
-if find_program('dub', required: false).found()
- dlang_mod.generate_dub_file(meson.project_name().to_lower(), meson.source_root(),
+if find_program('dub', required : false).found()
+ dlang_mod.generate_dub_file(
+ meson.project_name().to_lower(),
+ meson.source_root(),
name : meson.project_name(),
- license: meson.project_license(),
+ license : meson.project_license(),
sourceFiles : '{source_file}',
description : 'Meson sample project.',
version : '{version}',
diff --git a/mesonbuild/templates/fortrantemplates.py b/mesonbuild/templates/fortrantemplates.py
index 6e3383653..c1a6e0148 100644
--- a/mesonbuild/templates/fortrantemplates.py
+++ b/mesonbuild/templates/fortrantemplates.py
@@ -37,29 +37,38 @@ print *,{function_name}()
end program
'''
-lib_fortran_meson_template = '''project('{project_name}', 'fortran',
+lib_fortran_meson_template = '''project(
+ '{project_name}',
+ 'fortran',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
# These arguments are only used to build the shared library
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']
-shlib = shared_library('{lib_name}', '{source_file}',
+shlib = shared_library(
+ '{lib_name}',
+ '{source_file}',
install : true,
fortran_args : lib_args,
gnu_symbol_visibility : 'hidden',
)
-test_exe = executable('{test_exe_name}', '{test_source_file}',
- link_with : shlib)
+test_exe = executable(
+ '{test_exe_name}',
+ '{test_source_file}',
+ link_with : shlib,
+)
test('{test_name}', test_exe)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : shlib)
+ include_directories : include_directories('.'),
+ link_with : shlib,
+)
pkg_mod = import('pkgconfig')
pkg_mod.generate(
@@ -82,13 +91,19 @@ print *,"This is project ", PROJECT_NAME
end program
'''
-hello_fortran_meson_template = '''project('{project_name}', 'fortran',
+hello_fortran_meson_template = '''project(
+ '{project_name}',
+ 'fortran',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
-exe = executable('{exe_name}', '{source_name}',
- install : true)
+exe = executable(
+ '{exe_name}',
+ '{source_name}',
+ install : true,
+)
test('basic', exe)
'''
diff --git a/mesonbuild/templates/javatemplates.py b/mesonbuild/templates/javatemplates.py
index caaa98920..8596ad946 100644
--- a/mesonbuild/templates/javatemplates.py
+++ b/mesonbuild/templates/javatemplates.py
@@ -24,14 +24,20 @@ public class {class_name} {{
'''
-hello_java_meson_template = '''project('{project_name}', 'java',
+hello_java_meson_template = '''project(
+ '{project_name}',
+ 'java',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
-exe = jar('{exe_name}', '{source_name}',
+exe = jar(
+ '{exe_name}',
+ '{source_name}',
main_class : '{exe_name}',
- install : true)
+ install : true,
+)
test('basic', exe)
'''
@@ -65,25 +71,34 @@ public class {class_test} {{
'''
-lib_java_meson_template = '''project('{project_name}', 'java',
+lib_java_meson_template = '''project(
+ '{project_name}',
+ 'java',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
-jarlib = jar('{class_name}', '{source_file}',
+jarlib = jar(
+ '{class_name}',
+ '{source_file}',
main_class : '{class_name}',
install : true,
)
-test_jar = jar('{class_test}', '{test_source_file}',
+test_jar = jar(
+ '{class_test}',
+ '{test_source_file}',
main_class : '{class_test}',
- link_with : jarlib)
+ link_with : jarlib,
+)
test('{test_name}', test_jar)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : jarlib)
+ include_directories : include_directories('.'),
+ link_with : jarlib,
+)
'''
diff --git a/mesonbuild/templates/mesontemplates.py b/mesonbuild/templates/mesontemplates.py
index 76f56a1a0..5fe73930f 100644
--- a/mesonbuild/templates/mesontemplates.py
+++ b/mesonbuild/templates/mesontemplates.py
@@ -9,26 +9,38 @@ import typing as T
if T.TYPE_CHECKING:
from ..minit import Arguments
-meson_executable_template = '''project('{project_name}', {language},
+meson_executable_template = '''project(
+ '{project_name}',
+ {language},
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : [{default_options}])
+ default_options : [{default_options}],
+)
+
+executable(
+ '{executable}',
+ {sourcespec},{depspec}
+ install : true,
+)
-executable('{executable}',
- {sourcespec},{depspec}
- install : true)
'''
-meson_jar_template = '''project('{project_name}', '{language}',
+meson_jar_template = '''project(
+ '{project_name}',
+ '{language}',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : [{default_options}])
+ default_options : [{default_options}],
+)
+
+jar(
+ '{executable}',
+ {sourcespec},{depspec}
+ main_class : '{main_class}',
+ install : true,
+)
-jar('{executable}',
- {sourcespec},{depspec}
- main_class: '{main_class}',
- install : true)
'''
diff --git a/mesonbuild/templates/objcpptemplates.py b/mesonbuild/templates/objcpptemplates.py
index 91ce177c3..a9e1099a2 100644
--- a/mesonbuild/templates/objcpptemplates.py
+++ b/mesonbuild/templates/objcpptemplates.py
@@ -52,29 +52,38 @@ int main(int argc, char **argv) {{
}}
'''
-lib_objcpp_meson_template = '''project('{project_name}', 'objcpp',
+lib_objcpp_meson_template = '''project(
+ '{project_name}',
+ 'objcpp',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
# These arguments are only used to build the shared library
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']
-shlib = shared_library('{lib_name}', '{source_file}',
+shlib = shared_library(
+ '{lib_name}',
+ '{source_file}',
install : true,
objcpp_args : lib_args,
gnu_symbol_visibility : 'hidden',
)
-test_exe = executable('{test_exe_name}', '{test_source_file}',
- link_with : shlib)
+test_exe = executable(
+ '{test_exe_name}',
+ '{test_source_file}',
+ link_with : shlib,
+)
test('{test_name}', test_exe)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : shlib)
+ include_directories : include_directories('.'),
+ link_with : shlib,
+)
# Make this library usable from the system's
# package manager.
@@ -105,13 +114,19 @@ int main(int argc, char **argv) {{
}}
'''
-hello_objcpp_meson_template = '''project('{project_name}', 'objcpp',
+hello_objcpp_meson_template = '''project(
+ '{project_name}',
+ 'objcpp',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
-exe = executable('{exe_name}', '{source_name}',
- install : true)
+exe = executable(
+ '{exe_name}',
+ '{source_name}',
+ install : true,
+)
test('basic', exe)
'''
diff --git a/mesonbuild/templates/objctemplates.py b/mesonbuild/templates/objctemplates.py
index 59a6cd88b..64141e456 100644
--- a/mesonbuild/templates/objctemplates.py
+++ b/mesonbuild/templates/objctemplates.py
@@ -52,29 +52,37 @@ int main(int argc, char **argv) {{
}}
'''
-lib_objc_meson_template = '''project('{project_name}', 'objc',
+lib_objc_meson_template = '''project(
+ '{project_name}',
+ 'objc',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
# These arguments are only used to build the shared library
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']
-shlib = shared_library('{lib_name}', '{source_file}',
+shlib = shared_library(
+ '{lib_name}',
+ '{source_file}',
install : true,
objc_args : lib_args,
gnu_symbol_visibility : 'hidden',
)
-test_exe = executable('{test_exe_name}', '{test_source_file}',
+test_exe = executable(
+ '{test_exe_name}',
+ '{test_source_file}',
link_with : shlib)
test('{test_name}', test_exe)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : shlib)
+ include_directories : include_directories('.'),
+ link_with : shlib,
+)
# Make this library usable from the system's
# package manager.
@@ -105,13 +113,19 @@ int main(int argc, char **argv) {{
}}
'''
-hello_objc_meson_template = '''project('{project_name}', 'objc',
+hello_objc_meson_template = '''project(
+ '{project_name}',
+ 'objc',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3'],
+)
-exe = executable('{exe_name}', '{source_name}',
- install : true)
+exe = executable(
+ '{exe_name}',
+ '{source_name}',
+ install : true,
+)
test('basic', exe)
'''
diff --git a/mesonbuild/templates/rusttemplates.py b/mesonbuild/templates/rusttemplates.py
index 83d8d4f95..a012afb85 100644
--- a/mesonbuild/templates/rusttemplates.py
+++ b/mesonbuild/templates/rusttemplates.py
@@ -37,21 +37,29 @@ mod tests {{
'''
-lib_rust_meson_template = '''project('{project_name}', 'rust',
+lib_rust_meson_template = '''project(
+ '{project_name}',
+ 'rust',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['rust_std=2021', 'warning_level=3'])
+ default_options : ['rust_std=2021', 'warning_level=3'],
+)
rust = import('rust')
-shlib = static_library('{lib_name}', '{source_file}', install : true)
+shlib = static_library(
+ '{lib_name}',
+ '{source_file}',
+ install : true,
+)
rust.test('{test_name}', shlib)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : shlib)
+ include_directories : include_directories('.'),
+ link_with : shlib,
+)
'''
hello_rust_template = '''
@@ -61,13 +69,19 @@ fn main() {{
}}
'''
-hello_rust_meson_template = '''project('{project_name}', 'rust',
+hello_rust_meson_template = '''project(
+ '{project_name}',
+ 'rust',
version : '{version}',
meson_version : '>= {meson_version}',
- default_options : ['rust_std=2021', 'warning_level=3'])
-
-exe = executable('{exe_name}', '{source_name}',
- install : true)
+ default_options : ['rust_std=2021', 'warning_level=3'],
+)
+
+exe = executable(
+ '{exe_name}',
+ '{source_name}',
+ install : true,
+)
test('basic', exe)
'''
diff --git a/mesonbuild/templates/valatemplates.py b/mesonbuild/templates/valatemplates.py
index 438434032..b8ae6e067 100644
--- a/mesonbuild/templates/valatemplates.py
+++ b/mesonbuild/templates/valatemplates.py
@@ -12,17 +12,24 @@ hello_vala_template = '''void main (string[] args) {{
}}
'''
-hello_vala_meson_template = '''project('{project_name}', 'vala',
+hello_vala_meson_template = '''project(
+ '{project_name}',
+ 'vala',
meson_version : '>= {meson_version}',
- version : '{version}')
+ version : '{version}',
+)
dependencies = [
- dependency('glib-2.0'),
- dependency('gobject-2.0'),
+ dependency('glib-2.0'),
+ dependency('gobject-2.0'),
]
-exe = executable('{exe_name}', '{source_name}', dependencies : dependencies,
- install : true)
+exe = executable(
+ '{exe_name}',
+ '{source_name}',
+ dependencies : dependencies,
+ install : true,
+)
test('basic', exe)
'''
@@ -48,30 +55,42 @@ public void main() {{
}}
'''
-lib_vala_meson_template = '''project('{project_name}', 'vala',
+lib_vala_meson_template = '''project(
+ '{project_name}',
+ 'vala',
meson_version : '>= {meson_version}',
- version : '{version}')
+ version : '{version}',
+)
dependencies = [
- dependency('glib-2.0'),
- dependency('gobject-2.0'),
+ dependency('glib-2.0'),
+ dependency('gobject-2.0'),
]
# These arguments are only used to build the shared library
# not the executables that use the library.
-shlib = shared_library('foo', '{source_file}',
- dependencies: dependencies,
- install: true,
- install_dir: [true, true, true])
-
-test_exe = executable('{test_exe_name}', '{test_source_file}', dependencies : dependencies,
- link_with : shlib)
+shlib = shared_library(
+ 'foo',
+ '{source_file}',
+ dependencies : dependencies,
+ install : true,
+ install_dir : [true, true, true],
+)
+
+test_exe = executable(
+ '{test_exe_name}',
+ '{test_source_file}',
+ dependencies : dependencies,
+ link_with : shlib,
+)
test('{test_name}', test_exe)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
- include_directories: include_directories('.'),
- link_with : shlib)
+ include_directories : include_directories('.'),
+ link_with : shlib,
+)
+
'''