automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Advice on the project structure for a library


From: Ralf Corsepius
Subject: Re: Advice on the project structure for a library
Date: Wed, 04 Jun 2008 04:54:28 +0200

On Tue, 2008-06-03 at 15:29 +0200, Jef Driesen wrote:
> Ralf Wildenhues wrote:
> > * Jef Driesen wrote on Tue, Jun 03, 2008 at 12:31:29PM CEST:
> >>>> CFLAGS=-I${includedir}
> >>>> #include <libfoo/header.h>
> >>>>
> >>>> or
> >>>>
> >>>> CFLAGS=-I${includedir}/libfoo
> >>>> #include <header.h>
> > [...]
> >>> It's purely a matter of preference.  You're right to segregate the  
> >>> headers, but a project shouldn't mandate one #include/-I style over 
> >>> another.
> >> I don't really want to mandate a specific style to the users of my  
> >> library. I just want to use the first style inside my own library, and  
> >> right now that doesn't work.

> Is there any preference for choosing libfoo or include/libfoo, or is 
> that just personal taste?
The latter.

I for one prefer this layout
libfoo/Makefile.am
libfoo/configure.ac
libfoo/src/<sources+private headers>
libfoo/include/foo/<public headers>

Pro:
* Clean separate of private and public headers
* include/foo can have identical layout as "final installation.
[use #include "xxx.h" for private headers and #include <foo/xxx.h> +
AM_CPPFLAGS = -I$(top_srcdir)/include for public headers]
Con:
* Somewhat tricky to set up with autotools.

Another layout, I am occasionally using is:
libfoo/Makefile.am
libfoo/configure.ac
libfoo/foo/<sources+all headers>

Pro:
* Slightly easier to use than the approach above.
Con:
* Not keeping private and public headers separate.

Ralf






reply via email to

[Prev in Thread] Current Thread [Next in Thread]