[petsc-dev] How to deal with OS-specific include paths?

Jed Brown jedbrown at mcs.anl.gov
Mon Mar 18 18:22:41 CDT 2013


On Mon, Mar 18, 2013 at 6:17 PM, Karl Rupp <rupp at mcs.anl.gov> wrote:

> some packages such as OpenCL and OpenGL may be located in different
> subfolders depending on which OS we're on:
>  Mac OS: OpenCL/*.h   and    OpenGL/*.h
>  other:      CL/*.h   and        GL/*.h
> How is this properly translated into BuildSystem-specific package files?
> In opengl.py I only find
>     self.includes          = ['OpenGL/gl.h']
> and I can confirm that it fails to find the headers on my machine (Linux
> Mint). However, if I change the line in opengl.py to ['GL/gl.h'],
> everything works as expected.
>

We test each variant until we find one that works. I don't think there is
an automatic way to do that currently so you'd have to call checkCompile()
in sequence.


> So, the question is: How to deal with these OS-specific things? Within
> header files there is the standard
>  #if defined(__APPLE__)
>

We (almost) never do this in the C file because it's fragile and fails too
late. Instead, configure would normally test and set a macro indicating how
to do it safely.


> approach, but how does this translate to BuildSystem?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130318/2750488d/attachment.html>


More information about the petsc-dev mailing list