2

I've got a largish project to which I've just added some XS code, and I'd like to keep the top-level directory as clean as possible. I want to put the XS file and typemap et al. into a subdirectory, but if I do, MakeMaker can't find them. So right now, they're just sitting out in the project root.

How to I tell MakeMaker to look in a subdirectory for the XS stuff so it can be built from there?

Hercynium
  • 929
  • 9
  • 18
  • @schwern - Thanks for your answer - I completely missed that option in the EUMM docs. I just want to add, I ended up switching to [Module::Build](http://metacpan.org/module/Module::Build) anyway because [Module::Build::WithXSpp](http://metacpan.org/module/Module::Build::WithXSpp) made a bunch of other things *much* easier. And switching was also easy because I'm using [Dist::Zilla](http://metacpan.org/module/Dist::Zilla). The [Dist::Zilla::Plugin::ModuleBuild::Custom](http://metacpan.org/module/Dist::Zilla::Plugin::ModuleBuild::Custom) module helped a whole lot, too! :) – Hercynium Mar 30 '12 at 14:48

1 Answers1

4

I believe if you put the .xs files into the lib directory, MakeMaker will find them.

You can explicitly tell MakeMaker where the .xs files and what .c file to translate it into using the XS option to WriteMakefile.

WriteMakefile(
    NAME    => "Foo::Bar",
    XS      => {
        "lib/Foo/Bar.xs" => "lib/Foo/Bar.c",
    }
);
Schwern
  • 153,029
  • 25
  • 195
  • 336