logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

ExtUtils::Builder::AutoDetect::C - compiler configuration, derived from perl's configuration

Author

       Leon Timmermans <fawaka@gmail.com>

Delegates

compile($source,$target,%options)
       This compiles $source to $target. It takes the following optional arguments:

       type
           The type of the final product. This must be one of:

           •   executable

               An executable to be run. This is the default.

           •   static-library

               A static library to link against.

           •   dynamic-library

               A dynamic library to link against.

           •   loadable-object

               A  loadable  extension.  On  most platforms this is the same as a dynamic library, but some (Mac)
               make a distinction between these two.

       config
           A Perl configuration to take hints from, must be an "ExtUtils::Config" compatible object.

       profiles
           A list of profile that can  be  used  when  compiling  and  linking.  One  profile  comes  with  this
           distribution: '@Perl', which sets up the appropriate things to compile/link with "libperl".

       include_dirs
           A list of directories to add to the include path, e.g. "['include', '.']".

       define
           A hash of preprocessor defines, e.g. "{DEBUG => 1, HAVE_FEATURE => 0 }"

       extra_args
           A list of additional arguments to the compiler.

Description

       This module is a ExtUtils::Builder::Planner::Extension that facilitates compiling object.

Methods

add_methods(%options)
       This adds two delegate methods to the planner, "compile" and "link". It takes named arguments that will
       be prefixed to the named arguments for all delegate calls. In practice, it's mainly useful with the
       "config", "profile" and "type" arguments.

       If your $planner has a "config" delegate, that will be used as default value for "config".

       This is usually not called directly, but through ExtUtils::Builder::Planner's "load_extension" method.

   link(\@sources,$target,%options)
       type
           This works the same as with "compile".

       config
           This works the same as with "compile".

       profile
           This works the same as with "compile".

       libraries
           A list of libraries to link to. E.g. "['z']".

       library_dirs
           A list of directories to find libraries in. E.g. "['/opt/my-app/lib/']".

       extra_args
           A list of additional arguments to the linker.

Name

       ExtUtils::Builder::AutoDetect::C - compiler configuration, derived from perl's configuration

Synopsis

        my $planner = ExtUtils::Builder::Planner->new;
        $planner->load_extension('ExtUtils::Builder::AutoDetect::C', '0.001',
               profiles => ['@Perl'],
               type     => 'loadable-object',
        );
        $planner->compile('foo.c', 'foo.o', include_dirs => ['.']);
        $planner->link([ 'foo.o' ], 'foo.so', libraries => ['foo']);
        my $plan = $planner->materialize;
        $plan->run(['foo.so']);

Version

       version 0.032

See Also