You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ruud Wijnands <wi...@gmail.com> on 2005/07/07 16:54:54 UTC

Question: maven 1 - native plugin usage

Hi,

I am new to maven and I would like to find out whether or not it is
possible to build native c++ code via the native plugin. I have a few
requirements and after investigating the native plugin I  think they
are not meet.

By studying the plugin I have the impression that I can only build
shared libraries, since the native:compile target is always renamed to
something like <artifactId>-<version>.so Is that true?

Here are my requirements:
- build a set of c++ files into a single shared library for linux
- build a set of c++ files into a single static library for linux
- build a c++ file into an application
- link against third-party libraries
- provide include paths to thirdparty libraties
- set compiler and link flags

If the stuff mentioned above is possible, does anyone have an or  some
examples for me?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Question: maven 1 - native plugin usage

Posted by Dennis Geurts <de...@gmail.com>.
Hi Ruud, 
 What you want is certainly possible...
 Although I haven't used this plugin on a linux platform (yet) I hope I'm 
able 
to get you up and running: 
 (but please provide your compiler/ linker args yourself :-) )
 in your properties file:
 
maven.native.compiler.name=gcc
maven.native.link=executable /// or shared if you want to 

maven.native.compiler.arg.start= <your compiler args that end up at the 
start of the command line>
maven.native.compiler.arg.mid= <your compiler args that end up in the 
middle>
maven.native.compiler.arg.end= <your compiler args that end up at the end>

maven.native.linker.arg.start= <your linker args that end up at the start>
maven.native.linker.arg.mid= <your linker args that end up in the middle>
maven.native.linker.arg.end = <your linker args that end up at the end>

after "maven native" the executable (or .so file) ends up in 
'target/native/'

and is named '_' (underscore), for the executable or 'lib_.so' for the 
shared library
If it's a libary, the file is copied to: ${maven.build.dir}/native/lib${
pom.artifactId}-${pom.currentVersion}.so

This is done (i think) for your convenience, but you can easily create a 
postGoal yourself to copy the executable
(the 'underscore' file) to a human readable name.

I always read the project.jelly. Even if you don't know jelly you can 
'infer' from the jelly code how the properties are used
and why things happen.

Hope this helps, feel free to ask more...

  Dennis

     On 7/7/05, Ruud Wijnands <wi...@gmail.com> wrote: 
> 
> Hi,
> 
> I am new to maven and I would like to find out whether or not it is
> possible to build native c++ code via the native plugin. I have a few
> requirements and after investigating the native plugin I think they
> are not meet.
> 
> By studying the plugin I have the impression that I can only build
> shared libraries, since the native:compile target is always renamed to
> something like <artifactId>-<version>.so Is that true?
> 
> Here are my requirements:
> - build a set of c++ files into a single shared library for linux
> - build a set of c++ files into a single static library for linux
> - build a c++ file into an application
> - link against third-party libraries
> - provide include paths to thirdparty libraties
> - set compiler and link flags
> 
> If the stuff mentioned above is possible, does anyone have an or some
> examples for me?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>