Compare commits

...

2 Commits

Author SHA1 Message Date
Daniel Eklöf c2ee82cc41 add support for "target_type: 'shared_module'" in build_target() 5 years ago
Jussi Pakkanen b0f90a793f Better detection of tab indentation. 5 years ago
  1. 14
      docs/markdown/Reference-manual.md
  2. 16
      docs/markdown/snippets/target-type-shared-module.md
  3. 4
      mesonbuild/interpreter.py
  4. 5
      run_project_tests.py
  5. 4
      test cases/common/122 shared module/meson.build
  6. 13
      test cases/common/184 bothlibraries/meson.build
  7. 1
      test cases/common/4 shared/meson.build
  8. 5
      test cases/common/93 default library/meson.build
  9. 18
      test cases/frameworks/18 vulkan/vulkanprog.c

@ -158,7 +158,19 @@ library. In addition it supports the following extra methods:
### build_target()
Creates a build target whose type can be set dynamically with the
`target_type` keyword argument. This declaration:
`target_type` keyword argument.
`target_type` may be set to one of:
- `executable`
- `shared_library`
- `shared_module`
- `static_library`
- `both_libraries`
- `library`
- `jar`
This declaration:
```meson
executable(<arguments and keyword arguments>)

@ -0,0 +1,16 @@
## `target_type` in `build_targets` accepts the value 'shared_module'
The `target_type` keyword argument in `build_target()` now accepts the
value `'shared_module'`.
The statement
```meson
build_target(..., target_type: 'shared_module')
```
is equivalent to this:
```meson
shared_module(...)
```

@ -3116,6 +3116,10 @@ external dependencies (including libraries) must go to "dependencies".''')
return self.build_target(node, args, kwargs, ExecutableHolder)
elif target_type == 'shared_library':
return self.build_target(node, args, kwargs, SharedLibraryHolder)
elif target_type == 'shared_module':
FeatureNew('build_target(target_type: \'shared_module\')',
'0.51.0').use(self.subproject)
return self.build_target(node, args, kwargs, SharedModuleHolder)
elif target_type == 'static_library':
return self.build_target(node, args, kwargs, StaticLibraryHolder)
elif target_type == 'both_libraries':

@ -702,9 +702,10 @@ def check_file(fname):
linenum = 1
with open(fname, 'rb') as f:
lines = f.readlines()
tabdetector = re.compile(br' *\t')
for line in lines:
if line.startswith(b'\t'):
print("File %s contains a literal tab on line %d. Only spaces are permitted." % (fname, linenum))
if re.match(tabdetector, line):
print("File %s contains a tab indent on line %d. Only spaces are permitted." % (fname, linenum))
sys.exit(1)
if b'\r' in line:
print("File %s contains DOS line ending on line %d. Only unix-style line endings are permitted." % (fname, linenum))

@ -12,6 +12,10 @@ e = executable('prog', 'prog.c',
link_with : l, export_dynamic : true, dependencies : dl)
test('import test', e, args : m)
# Same as above, but module created with build_target()
m2 = build_target('mymodule2', 'module.c', target_type: 'shared_module')
test('import test 2', e, args : m2)
# Shared module that does not export any symbols
shared_module('nosyms', 'nosyms.c',
install : true,

@ -10,3 +10,16 @@ exe_both = executable('prog-both', 'main.c', link_with : both_libs)
test('runtest-shared', exe_shared)
test('runtest-static', exe_static)
test('runtest-both', exe_both)
# Same as above, but using build_target()
both_libs2 = build_target('mylib2', 'libfile.c', target_type: 'both_libraries')
exe_shared2 = executable('prog-shared2', 'main.c',
link_with : both_libs2.get_shared_lib())
exe_static2 = executable('prog-static2', 'main.c',
c_args : ['-DSTATIC_COMPILATION'],
link_with : both_libs2.get_static_lib())
exe_both2 = executable('prog-both2', 'main.c', link_with : both_libs2)
test('runtest-shared-2', exe_shared2)
test('runtest-static-2', exe_static2)
test('runtest-both-2', exe_both2)

@ -1,2 +1,3 @@
project('shared library test', 'c')
lib = shared_library('mylib', 'libfile.c')
build_target('mylib2', 'libfile.c', target_type: 'shared_library')

@ -3,3 +3,8 @@ project('default library', 'cpp')
flib = library('ef', 'ef.cpp')
exe = executable('eftest', 'eftest.cpp', link_with : flib)
test('eftest', exe)
# Same as above, but using build_target()
flib2 = build_target('ef2', 'ef.cpp', target_type: 'library')
exe2 = executable('eftest2', 'eftest.cpp', link_with : flib2)
test('eftest2', exe2)

@ -4,14 +4,14 @@
int main()
{
VkInstanceCreateInfo instance_create_info = {
VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
NULL,
0,
NULL,
0,
NULL,
0,
NULL,
VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
NULL,
0,
NULL,
0,
NULL,
0,
NULL,
};
// we don't actually require instance creation to succeed since
@ -23,4 +23,4 @@ int main()
vkDestroyInstance(instance, NULL);
return 0;
}
}

Loading…
Cancel
Save