summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/snippets/vs_module_defs_customtargetindex.md8
-rw-r--r--docs/yaml/functions/shared_library.yaml2
-rw-r--r--docs/yaml/functions/shared_module.yaml2
-rw-r--r--mesonbuild/build.py6
-rw-r--r--mesonbuild/interpreter/kwargs.py4
-rw-r--r--mesonbuild/interpreter/type_checking.py5
-rw-r--r--test cases/windows/10 vs module defs generated custom target/subdir/meson.build2
7 files changed, 22 insertions, 7 deletions
diff --git a/docs/markdown/snippets/vs_module_defs_customtargetindex.md b/docs/markdown/snippets/vs_module_defs_customtargetindex.md
new file mode 100644
index 000000000..d50d04ecb
--- /dev/null
+++ b/docs/markdown/snippets/vs_module_defs_customtargetindex.md
@@ -0,0 +1,8 @@
+## vs_module_defs keyword now supports indexes of custom_target
+
+This means you can do something like:
+```meson
+defs = custom_target('generate_module_defs', ...)
+shared_library('lib1', vs_module_defs : defs[0])
+shared_library('lib2', vs_module_defs : defs[2])
+```
diff --git a/docs/yaml/functions/shared_library.yaml b/docs/yaml/functions/shared_library.yaml
index 5076b9341..f633aca96 100644
--- a/docs/yaml/functions/shared_library.yaml
+++ b/docs/yaml/functions/shared_library.yaml
@@ -45,6 +45,8 @@ kwargs:
Specify a Microsoft module definition file for controlling symbol exports,
etc., on platforms where that is possible (e.g. Windows).
+ *(Since 1.3.0)* [[@custom_idx]] are supported
+
rust_abi:
type: str
since: 1.3.0
diff --git a/docs/yaml/functions/shared_module.yaml b/docs/yaml/functions/shared_module.yaml
index 46086ba30..6b94e56ad 100644
--- a/docs/yaml/functions/shared_module.yaml
+++ b/docs/yaml/functions/shared_module.yaml
@@ -40,6 +40,8 @@ kwargs:
Specify a Microsoft module definition file for controlling symbol exports,
etc., on platforms where that is possible (e.g. Windows).
+ *(Since 1.3.0)* [[@custom_idx]] are supported
+
rust_abi:
type: str
since: 1.3.0
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 7b5cfa786..10f226117 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -2331,13 +2331,13 @@ class SharedLibrary(BuildTarget):
elif isinstance(path, File):
# When passing a generated file.
self.vs_module_defs = path
- elif isinstance(path, CustomTarget):
+ elif isinstance(path, (CustomTarget, CustomTargetIndex)):
# When passing output of a Custom Target
- self.vs_module_defs = File.from_built_file(path.subdir, path.get_filename())
+ self.vs_module_defs = File.from_built_file(path.get_subdir(), path.get_filename())
else:
raise InvalidArguments(
'Shared library vs_module_defs must be either a string, '
- 'a file object or a Custom Target')
+ 'a file object, a Custom Target, or a Custom Target Index')
self.process_link_depends(path)
rust_abi = kwargs.get('rust_abi')
diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py
index ba5b5d0cc..cbe440513 100644
--- a/mesonbuild/interpreter/kwargs.py
+++ b/mesonbuild/interpreter/kwargs.py
@@ -359,7 +359,7 @@ class _SharedLibMixin(TypedDict):
darwin_versions: T.Optional[T.Tuple[str, str]]
soversion: T.Optional[str]
version: T.Optional[str]
- vs_module_defs: T.Optional[T.Union[str, File, build.CustomTarget]]
+ vs_module_defs: T.Optional[T.Union[str, File, build.CustomTarget, build.CustomTargetIndex]]
class SharedLibrary(_BuildTarget, _SharedLibMixin, _LibraryMixin):
@@ -368,7 +368,7 @@ class SharedLibrary(_BuildTarget, _SharedLibMixin, _LibraryMixin):
class SharedModule(_BuildTarget, _LibraryMixin):
- vs_module_defs: T.Optional[T.Union[str, File, build.CustomTarget]]
+ vs_module_defs: T.Optional[T.Union[str, File, build.CustomTarget, build.CustomTargetIndex]]
class Library(_BuildTarget, _SharedLibMixin, _StaticLibMixin, _LibraryMixin):
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py
index 8f5fd0848..0d0267d54 100644
--- a/mesonbuild/interpreter/type_checking.py
+++ b/mesonbuild/interpreter/type_checking.py
@@ -513,9 +513,10 @@ RUST_ABI_KW: KwargInfo[T.Union[str, None]] = KwargInfo(
since='1.3.0',
validator=in_set_validator({'rust', 'c'}))
-_VS_MODULE_DEFS_KW: KwargInfo[T.Optional[T.Union[str, File, CustomTarget]]] = KwargInfo(
+_VS_MODULE_DEFS_KW: KwargInfo[T.Optional[T.Union[str, File, CustomTarget, CustomTargetIndex]]] = KwargInfo(
'vs_module_defs',
- (str, File, CustomTarget, NoneType),
+ (str, File, CustomTarget, CustomTargetIndex, NoneType),
+ since_values={CustomTargetIndex: '1.3.0'}
)
# Applies to all build_target like classes
diff --git a/test cases/windows/10 vs module defs generated custom target/subdir/meson.build b/test cases/windows/10 vs module defs generated custom target/subdir/meson.build
index c4ae33ae4..027769244 100644
--- a/test cases/windows/10 vs module defs generated custom target/subdir/meson.build
+++ b/test cases/windows/10 vs module defs generated custom target/subdir/meson.build
@@ -5,3 +5,5 @@ def_file = custom_target('gen_def',
output: 'somedll.def')
shlib = shared_library('somedll', 'somedll.c', vs_module_defs: def_file)
+
+shared_library('somedll2', 'somedll.c', vs_module_defs: def_file[0])