Compare commits

...

2 Commits

Author SHA1 Message Date
Daniel Mensinger 3b3f53ab55 mintro: Fix section key in buildoptions 5 years ago
Marc-André Lureau 341d245e68 Accept vs_module_defs for modules 5 years ago
  1. 10
      docs/markdown/IDE-integration.md
  2. 7
      docs/markdown/Reference-manual.md
  3. 4
      docs/markdown/snippets/shared_module_defs.md
  4. 2
      mesonbuild/build.py
  5. 14
      mesonbuild/mintro.py
  6. 9
      run_unittests.py
  7. 1
      test cases/windows/9 vs module defs generated/subdir/meson.build

@ -143,7 +143,8 @@ the `intro-buildoptions.json` file. Here is the JSON format for each option.
"description": "the description",
"type": "type ID",
"value": "value depends on type",
"section": "section ID"
"section": "section ID",
"machine": "machine ID"
}
```
@ -168,6 +169,13 @@ The possible values for `section` are:
- user
- test
The `machine` key specifies the machine configuration for the option. Possible
values are:
- any
- host
- build
To set the options, use the `meson configure` command.
Since Meson 0.50.0 it is also possible to get the default buildoptions

@ -1334,6 +1334,13 @@ variables defined in the [`executable`](#executable) it is loaded by,
you will need to set the `export_dynamic` argument of the executable to
`true`.
Supports the following extra keyword arguments:
- `vs_module_defs`, *(Added 0.52.0)*, a string, a File object, or
Custom Target for a Microsoft module definition file for controlling
symbol exports, etc., on platforms where that is possible
(e.g. Windows).
**Note:** Linking to a shared module is not supported on some
platforms, notably OSX. Consider using a
[`shared_library`](#shared_library) instead, if you need to both

@ -0,0 +1,4 @@
## Added `vs_module_defs` to `shared_module()`
Like `shared_library()`, `shared_module()` now accepts
`vs_module_defs` argument for controlling symbol exports, etc.

@ -91,7 +91,7 @@ known_build_target_kwargs = (
known_exe_kwargs = known_build_target_kwargs | {'implib', 'export_dynamic', 'link_language', 'pie'}
known_shlib_kwargs = known_build_target_kwargs | {'version', 'soversion', 'vs_module_defs', 'darwin_versions'}
known_shmod_kwargs = known_build_target_kwargs
known_shmod_kwargs = known_build_target_kwargs | {'vs_module_defs'}
known_stlib_kwargs = known_build_target_kwargs | {'pic'}
known_jar_kwargs = known_exe_kwargs | {'main_class'}

@ -229,31 +229,33 @@ def list_buildoptions(coredata: cdata.CoreData) -> List[dict]:
core_options = {k: o for k, o in coredata.builtins.items() if k in core_option_names}
add_keys(optlist, core_options, 'core')
add_keys(optlist, coredata.builtins_per_machine.host, 'core (for host machine)')
add_keys(optlist, coredata.builtins_per_machine.host, 'core', machine='host')
add_keys(
optlist,
{'build.' + k: o for k, o in coredata.builtins_per_machine.build.items()},
'core (for build machine)',
'core',
machine='build',
)
add_keys(optlist, coredata.backend_options, 'backend')
add_keys(optlist, coredata.base_options, 'base')
add_keys(optlist, coredata.compiler_options.host, 'compiler (for host machine)')
add_keys(optlist, coredata.compiler_options.host, 'compiler', machine='host')
add_keys(
optlist,
{'build.' + k: o for k, o in coredata.compiler_options.build.items()},
'compiler (for build machine)',
'compiler',
machine='build',
)
add_keys(optlist, dir_options, 'directory')
add_keys(optlist, coredata.user_options, 'user')
add_keys(optlist, test_options, 'test')
return optlist
def add_keys(optlist, options: Dict[str, cdata.UserOption], section):
def add_keys(optlist, options: Dict[str, cdata.UserOption], section: str, machine: str = 'any'):
keys = list(options.keys())
keys.sort()
for key in keys:
opt = options[key]
optdict = {'name': key, 'value': opt.value, 'section': section}
optdict = {'name': key, 'value': opt.value, 'section': section, 'machine': machine}
if isinstance(opt, cdata.UserStringOption):
typestr = 'string'
elif isinstance(opt, cdata.UserBooleanOption):

@ -2630,6 +2630,7 @@ int main(int argc, char **argv) {
'section': 'user',
'type': 'array',
'value': ['foo', 'bar'],
'machine': 'any',
}
tdir = os.path.join(self.unit_test_dir, '19 array option')
self.init(tdir)
@ -2655,6 +2656,7 @@ int main(int argc, char **argv) {
'section': 'user',
'type': 'array',
'value': ['foo', 'bar'],
'machine': 'any',
}
tdir = os.path.join(self.unit_test_dir, '19 array option')
self.init(tdir)
@ -2680,6 +2682,7 @@ int main(int argc, char **argv) {
'section': 'user',
'type': 'array',
'value': [],
'machine': 'any',
}
tdir = os.path.join(self.unit_test_dir, '19 array option')
self.init(tdir, extra_args='-Dlist=')
@ -3496,6 +3499,7 @@ recommended as it is not supported on some platforms''')
('section', str),
('type', str),
('description', str),
('machine', str),
]
buildoptions_typelist = [
@ -3506,6 +3510,9 @@ recommended as it is not supported on some platforms''')
('array', list, []),
]
buildoptions_sections = ['core', 'backend', 'base', 'compiler', 'directory', 'user', 'test']
buildoptions_machines = ['any', 'build', 'host']
dependencies_typelist = [
('name', str),
('compile_args', list),
@ -3561,6 +3568,8 @@ recommended as it is not supported on some platforms''')
valid_type = True
break
self.assertIn(i['section'], buildoptions_sections)
self.assertIn(i['machine'], buildoptions_machines)
self.assertTrue(valid_type)
if i['name'] in buildopts_to_find:
self.assertEqual(i['value'], buildopts_to_find[i['name']])

@ -7,3 +7,4 @@ def_file = configure_file(
)
shlib = shared_library('somedll', 'somedll.c', vs_module_defs : def_file)
shmod = shared_module('somemod', 'somedll.c', vs_module_defs : def_file)

Loading…
Cancel
Save