summaryrefslogtreecommitdiff
path: root/mesonbuild/templates/cpptemplates.py
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 /mesonbuild/templates/cpptemplates.py
parentb94cbbfb79eaeaf863d77fca1dd051b102471ad3 (diff)
downloadmeson-1b14526243c3e12c132ee8f81089fea0425bab7d.tar.gz
templates: standardize Meson formatting
We have all kinds of formatting, different indents, different line break standards.
Diffstat (limited to 'mesonbuild/templates/cpptemplates.py')
-rw-r--r--mesonbuild/templates/cpptemplates.py38
1 files changed, 26 insertions, 12 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.