| Dist::Build::XS(3pm) | User Contributed Perl Documentation | Dist::Build::XS(3pm) |
Dist::Build::XS - An XS implementation for Dist::Build
version 0.020
# planner/xs.pl
load_extension('Dist::Build::XS');
add_xs(
module => 'Foo::Bar',
extra_sources => [ glob 'src/*.c' ],
libraries => [ 'foo' ],
);
This module implements support for XS for Dist::Build.
This method takes the following named arguments, all optional:
The name of the module to be compiled. This defaults to $main_module unless "file" is given, in which case the name is derived from the path.
The version of the module, defaulting to the dist version.
The name of the XS file. By default it's derived from the $module_name, e.g. "lib/Foo/Bar.xs" for "Foo::Bar".
This hash contains defines for the C files. E.g. "{ DEBUG => 1 }".
A list of directories to add to the include path. For the xs file the directory it is in is automatically added to this list.
A list of C files to compile with this module. Instead of just a name, entries can also be a hash with the following entries:
The name of the input file. Mandatory.
The name of the object that will be compiled. Will be derive from the source name by default.
An array containing additional include directories for this objects
A hash containing additional defines for this object.
An array containing additional flags for this compilation.
A list of object files to link with the module.
Additional flags to feed to the compiler. This can either be an array or a (shell-quoted) string.
Extra C files to compile with this module.
Extra libraries to find libraries in.
Libraries to link to.
Additional flags to feed to the compiler. This can either be an array or a (shell-quoted) string.
This method is like "add_xs", except that instead of taking "module" or "file" named arguments, it takes a "dir" argument (defaulting to 'lib'). It will search that directory for all XS files, and build them with the other arguments passed to this function.
Various extensions exist that modify the behavior of "add_xs". Among these are:
This adds an "import" argument to imports include directories and compilation flags exported by other modules using Dist::Build::XS::Export.
This adds a "write_constants" argument, integrating ExtUtils::Constant.
This adds an "alien" argument to link to libraries using Alien::Base.
This adds a "pkg_config" argument to link to libraries using "pkg-config" files.
Leon Timmermans <fawaka@gmail.com>
This software is copyright (c) 2024 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| 2025-05-11 | perl v5.40.1 |