summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2025-01-06 16:12:46 -0800
committerDylan Baker <dylan@pnwbakers.com>2025-01-08 10:05:02 -0800
commit2180af4ac1537cf42d47891cf19e53de02087d2a (patch)
tree0efae3c2351176bc671339ba533e74b107a0114c
parente4ea17bf1d1443269b1fc37f87afd54b30abb8e3 (diff)
downloadmeson-2180af4ac1537cf42d47891cf19e53de02087d2a.tar.gz
templates: use library() instead of shared_library()
-rw-r--r--mesonbuild/templates/cpptemplates.py17
-rw-r--r--mesonbuild/templates/ctemplates.py18
-rw-r--r--mesonbuild/templates/cudatemplates.py18
-rw-r--r--mesonbuild/templates/fortrantemplates.py18
-rw-r--r--mesonbuild/templates/objcpptemplates.py18
-rw-r--r--mesonbuild/templates/objctemplates.py18
-rw-r--r--mesonbuild/templates/rusttemplates.py6
-rw-r--r--mesonbuild/templates/valatemplates.py6
8 files changed, 83 insertions, 36 deletions
diff --git a/mesonbuild/templates/cpptemplates.py b/mesonbuild/templates/cpptemplates.py
index bf95f9a58..eead3cf05 100644
--- a/mesonbuild/templates/cpptemplates.py
+++ b/mesonbuild/templates/cpptemplates.py
@@ -3,9 +3,12 @@
# Copyright © 2023-2025 Intel Corporation
from __future__ import annotations
+import typing as T
from mesonbuild.templates.sampleimpl import FileHeaderImpl
+if T.TYPE_CHECKING:
+ from ..minit import Arguments
hello_cpp_template = '''#include <iostream>
@@ -118,11 +121,11 @@ dependencies = [{dependencies}
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']
-shlib = shared_library(
+lib = library(
'{lib_name}',
'{source_file}',
install : true,
- cpp_args : lib_args,
+ cpp_shared_args : lib_args,
gnu_symbol_visibility : 'hidden',
dependencies : dependencies,
)
@@ -131,7 +134,7 @@ test_exe = executable(
'{test_exe_name}',
'{test_source_file}',
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
test('{test_name}', test_exe)
@@ -139,7 +142,7 @@ test('{test_name}', test_exe)
{ltoken}_dep = declare_dependency(
include_directories : include_directories('.'),
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
meson.override_dependency('{project_name}', {ltoken}_dep)
@@ -149,7 +152,7 @@ install_headers('{header_file}', subdir : '{header_dir}')
pkg_mod = import('pkgconfig')
pkg_mod.generate(
- shlib,
+ lib,
description : 'Meson sample project.',
subdirs : '{header_dir}',
)
@@ -166,3 +169,7 @@ class CppProject(FileHeaderImpl):
lib_header_template = lib_hpp_template
lib_test_template = lib_cpp_test_template
lib_meson_template = lib_cpp_meson_template
+
+ def __init__(self, args: Arguments):
+ super().__init__(args)
+ self.meson_version = '1.3.0'
diff --git a/mesonbuild/templates/ctemplates.py b/mesonbuild/templates/ctemplates.py
index b60e916b8..7cf04f6aa 100644
--- a/mesonbuild/templates/ctemplates.py
+++ b/mesonbuild/templates/ctemplates.py
@@ -3,9 +3,13 @@
# Copyright © 2023-2025 Intel Corporation
from __future__ import annotations
+import typing as T
from mesonbuild.templates.sampleimpl import FileHeaderImpl
+if T.TYPE_CHECKING:
+ from ..minit import Arguments
+
lib_h_template = '''#pragma once
#if defined _WIN32 || defined __CYGWIN__
@@ -67,11 +71,11 @@ lib_args = ['-DBUILDING_{utoken}']
dependencies = [{dependencies}
]
-shlib = shared_library(
+lib = library(
'{lib_name}',
'{source_file}',
install : true,
- c_args : lib_args,
+ c_shared_args : lib_args,
gnu_symbol_visibility : 'hidden',
dependencies : dependencies,
)
@@ -80,7 +84,7 @@ test_exe = executable(
'{test_exe_name}',
'{test_source_file}',
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
test('{test_name}', test_exe)
@@ -88,7 +92,7 @@ test('{test_name}', test_exe)
{ltoken}_dep = declare_dependency(
include_directories : include_directories('.'),
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
meson.override_dependency('{project_name}', {ltoken}_dep)
@@ -98,7 +102,7 @@ install_headers('{header_file}', subdir : '{header_dir}')
pkg_mod = import('pkgconfig')
pkg_mod.generate(
- shlib,
+ lib,
description : 'Meson sample project.',
subdirs : '{header_dir}',
)
@@ -150,3 +154,7 @@ class CProject(FileHeaderImpl):
lib_header_template = lib_h_template
lib_test_template = lib_c_test_template
lib_meson_template = lib_c_meson_template
+
+ def __init__(self, args: Arguments):
+ super().__init__(args)
+ self.meson_version = '1.3.0'
diff --git a/mesonbuild/templates/cudatemplates.py b/mesonbuild/templates/cudatemplates.py
index 4f0c606a4..416ba376a 100644
--- a/mesonbuild/templates/cudatemplates.py
+++ b/mesonbuild/templates/cudatemplates.py
@@ -3,9 +3,13 @@
# Copyright © 2023-2025 Intel Corporation
from __future__ import annotations
+import typing as T
from mesonbuild.templates.sampleimpl import FileHeaderImpl
+if T.TYPE_CHECKING:
+ from ..minit import Arguments
+
hello_cuda_template = '''#include <iostream>
@@ -118,11 +122,11 @@ lib_args = ['-DBUILDING_{utoken}']
dependencies = [{dependencies}
]
-shlib = shared_library(
+lib = library(
'{lib_name}',
'{source_file}',
install : true,
- cpp_args : lib_args,
+ cpp_shared_args : lib_args,
gnu_symbol_visibility : 'hidden',
dependencies : dependencies,
)
@@ -130,7 +134,7 @@ shlib = shared_library(
test_exe = executable(
'{test_exe_name}',
'{test_source_file}',
- link_with : shlib,
+ link_with : lib,
dependencies : dependencies,
)
test('{test_name}', test_exe)
@@ -139,7 +143,7 @@ test('{test_name}', test_exe)
{ltoken}_dep = declare_dependency(
include_directories : include_directories('.'),
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
meson.override_dependency('{project_name}', {ltoken}_dep)
@@ -149,7 +153,7 @@ install_headers('{header_file}', subdir : '{header_dir}')
pkg_mod = import('pkgconfig')
pkg_mod.generate(
- shlib,
+ lib,
description : 'Meson sample project.',
subdirs : '{header_dir}',
)
@@ -166,3 +170,7 @@ class CudaProject(FileHeaderImpl):
lib_header_template = lib_h_template
lib_test_template = lib_cuda_test_template
lib_meson_template = lib_cuda_meson_template
+
+ def __init__(self, args: Arguments):
+ super().__init__(args)
+ self.meson_version = '1.3.0'
diff --git a/mesonbuild/templates/fortrantemplates.py b/mesonbuild/templates/fortrantemplates.py
index f9aec7ef2..7aaa9d39c 100644
--- a/mesonbuild/templates/fortrantemplates.py
+++ b/mesonbuild/templates/fortrantemplates.py
@@ -3,9 +3,13 @@
# Copyright © 2023-2025 Intel Corporation
from __future__ import annotations
+import typing as T
from mesonbuild.templates.sampleimpl import FileImpl
+if T.TYPE_CHECKING:
+ from ..minit import Arguments
+
lib_fortran_template = '''
! This procedure will not be exported and is not
! directly callable by users of this library.
@@ -52,11 +56,11 @@ lib_args = ['-DBUILDING_{utoken}']
dependencies = [{dependencies}
]
-shlib = shared_library(
+lib = library(
'{lib_name}',
'{source_file}',
install : true,
- fortran_args : lib_args,
+ fortran_shared_args : lib_args,
gnu_symbol_visibility : 'hidden',
dependencies : dependencies,
)
@@ -64,7 +68,7 @@ shlib = shared_library(
test_exe = executable(
'{test_exe_name}',
'{test_source_file}',
- link_with : shlib,
+ link_with : lib,
dependencies : dependencies,
)
test('{test_name}', test_exe)
@@ -73,13 +77,13 @@ test('{test_name}', test_exe)
{ltoken}_dep = declare_dependency(
include_directories : include_directories('.'),
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
meson.override_dependency('{project_name}', {ltoken}_dep)
pkg_mod = import('pkgconfig')
pkg_mod.generate(
- shlib,
+ lib,
description : 'Meson sample project.',
subdirs : '{header_dir}',
)
@@ -125,3 +129,7 @@ class FortranProject(FileImpl):
lib_template = lib_fortran_template
lib_meson_template = lib_fortran_meson_template
lib_test_template = lib_fortran_test_template
+
+ def __init__(self, args: Arguments):
+ super().__init__(args)
+ self.meson_version = '1.3.0'
diff --git a/mesonbuild/templates/objcpptemplates.py b/mesonbuild/templates/objcpptemplates.py
index 7ea4c3f8e..45e70c6c9 100644
--- a/mesonbuild/templates/objcpptemplates.py
+++ b/mesonbuild/templates/objcpptemplates.py
@@ -3,9 +3,13 @@
# Copyright © 2023-2025 Intel Corporation
from __future__ import annotations
+import typing as T
from mesonbuild.templates.sampleimpl import FileHeaderImpl
+if T.TYPE_CHECKING:
+ from ..minit import Arguments
+
lib_h_template = '''#pragma once
#if defined _WIN32 || defined __CYGWIN__
@@ -67,11 +71,11 @@ dependencies = [{dependencies}
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']
-shlib = shared_library(
+lib = library(
'{lib_name}',
'{source_file}',
install : true,
- objcpp_args : lib_args,
+ objcpp_shared_args : lib_args,
dependencies : dependencies,
gnu_symbol_visibility : 'hidden',
)
@@ -80,7 +84,7 @@ test_exe = executable(
'{test_exe_name}',
'{test_source_file}',
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
test('{test_name}', test_exe)
@@ -88,7 +92,7 @@ test('{test_name}', test_exe)
{ltoken}_dep = declare_dependency(
include_directories : include_directories('.'),
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
meson.override_dependency('{project_name}', {ltoken}_dep)
@@ -98,7 +102,7 @@ install_headers('{header_file}', subdir : '{header_dir}')
pkg_mod = import('pkgconfig')
pkg_mod.generate(
- shlib,
+ lib,
description : 'Meson sample project.',
subdirs : '{header_dir}',
)
@@ -150,3 +154,7 @@ class ObjCppProject(FileHeaderImpl):
lib_header_template = lib_h_template
lib_test_template = lib_objcpp_test_template
lib_meson_template = lib_objcpp_meson_template
+
+ def __init__(self, args: Arguments):
+ super().__init__(args)
+ self.meson_version = '1.3.0'
diff --git a/mesonbuild/templates/objctemplates.py b/mesonbuild/templates/objctemplates.py
index de0217f96..0c7891fdb 100644
--- a/mesonbuild/templates/objctemplates.py
+++ b/mesonbuild/templates/objctemplates.py
@@ -3,9 +3,13 @@
# Copyright © 2023-2025 Intel Corporation
from __future__ import annotations
+import typing as T
from mesonbuild.templates.sampleimpl import FileHeaderImpl
+if T.TYPE_CHECKING:
+ from ..minit import Arguments
+
lib_h_template = '''#pragma once
#if defined _WIN32 || defined __CYGWIN__
@@ -67,11 +71,11 @@ dependencies = [{dependencies}
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']
-shlib = shared_library(
+lib = library(
'{lib_name}',
'{source_file}',
install : true,
- objc_args : lib_args,
+ objc_shared_args : lib_args,
dependencies : dependencies,
gnu_symbol_visibility : 'hidden',
)
@@ -80,14 +84,14 @@ test_exe = executable(
'{test_exe_name}',
'{test_source_file}',
dependencies : dependencies,
- link_with : shlib)
+ link_with : lib)
test('{test_name}', test_exe)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
include_directories : include_directories('.'),
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
meson.override_dependency('{project_name}', {ltoken}_dep)
@@ -97,7 +101,7 @@ install_headers('{header_file}', subdir : '{header_dir}')
pkg_mod = import('pkgconfig')
pkg_mod.generate(
- shlib,
+ lib,
description : 'Meson sample project.',
subdirs : '{header_dir}',
)
@@ -149,3 +153,7 @@ class ObjCProject(FileHeaderImpl):
lib_header_template = lib_h_template
lib_test_template = lib_objc_test_template
lib_meson_template = lib_objc_meson_template
+
+ def __init__(self, args: Arguments):
+ super().__init__(args)
+ self.meson_version = '1.3.0'
diff --git a/mesonbuild/templates/rusttemplates.py b/mesonbuild/templates/rusttemplates.py
index 2f2d94012..ee1f0081d 100644
--- a/mesonbuild/templates/rusttemplates.py
+++ b/mesonbuild/templates/rusttemplates.py
@@ -50,20 +50,20 @@ rust = import('rust')
dependencies = [{dependencies}
]
-shlib = static_library(
+lib = static_library(
'{lib_name}',
'{source_file}',
dependencies : dependencies,
install : true,
)
-rust.test('{test_name}', shlib)
+rust.test('{test_name}', lib)
# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
include_directories : include_directories('.'),
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
meson.override_dependency('{project_name}', {ltoken}_dep)
'''
diff --git a/mesonbuild/templates/valatemplates.py b/mesonbuild/templates/valatemplates.py
index 3720c3cb3..b2aab3f31 100644
--- a/mesonbuild/templates/valatemplates.py
+++ b/mesonbuild/templates/valatemplates.py
@@ -69,7 +69,7 @@ dependencies = [
# These arguments are only used to build the shared library
# not the executables that use the library.
-shlib = shared_library(
+lib = shared_library(
'foo',
'{source_file}',
dependencies : dependencies,
@@ -81,7 +81,7 @@ test_exe = executable(
'{test_exe_name}',
'{test_source_file}',
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
test('{test_name}', test_exe)
@@ -89,7 +89,7 @@ test('{test_name}', test_exe)
{ltoken}_dep = declare_dependency(
include_directories : include_directories('.'),
dependencies : dependencies,
- link_with : shlib,
+ link_with : lib,
)
meson.override_dependency('{project_name}', {ltoken}_dep)